mirror of https://github.com/yt-dlp/yt-dlp.git
[extractor/youtube] Fix `:ytnotifications` extractor (#3775)
Still some issues, see https://github.com/yt-dlp/yt-dlp/pull/3775 Authored by: coletdjnz
This commit is contained in:
parent
e50c3500b4
commit
c7a7baaa13
|
@ -5673,11 +5673,13 @@ class YoutubeNotificationsIE(YoutubeTabBaseInfoExtractor):
|
||||||
channel = traverse_obj(
|
channel = traverse_obj(
|
||||||
notification, ('contextualMenu', 'menuRenderer', 'items', 1, 'menuServiceItemRenderer', 'text', 'runs', 1, 'text'),
|
notification, ('contextualMenu', 'menuRenderer', 'items', 1, 'menuServiceItemRenderer', 'text', 'runs', 1, 'text'),
|
||||||
expected_type=str)
|
expected_type=str)
|
||||||
|
notification_title = self._get_text(notification, 'shortMessage')
|
||||||
|
if notification_title:
|
||||||
|
notification_title = notification_title.replace('\xad', '') # remove soft hyphens
|
||||||
|
# TODO: handle recommended videos
|
||||||
title = self._search_regex(
|
title = self._search_regex(
|
||||||
rf'{re.escape(channel)} [^:]+: (.+)', self._get_text(notification, 'shortMessage'),
|
rf'{re.escape(channel or "")}[^:]+: (.+)', notification_title,
|
||||||
'video title', default=None)
|
'video title', default=None)
|
||||||
if title:
|
|
||||||
title = title.replace('\xad', '') # remove soft hyphens
|
|
||||||
upload_date = (strftime_or_none(self._extract_time_text(notification, 'sentTimeText')[0], '%Y%m%d')
|
upload_date = (strftime_or_none(self._extract_time_text(notification, 'sentTimeText')[0], '%Y%m%d')
|
||||||
if self._configuration_arg('approximate_date', ie_key=YoutubeTabIE.ie_key())
|
if self._configuration_arg('approximate_date', ie_key=YoutubeTabIE.ie_key())
|
||||||
else None)
|
else None)
|
||||||
|
|
Loading…
Reference in New Issue