Compare commits

...

3 Commits

Author SHA1 Message Date
kclauhk
01be29d9dd
Update yt_dlp/extractor/facebook.py
Co-authored-by: pukkandan <pukkandan.ytdlp@gmail.com>
2023-11-30 19:16:12 +08:00
pukkandan
199342bcd1
Update yt_dlp/extractor/facebook.py 2023-11-30 16:35:32 +05:30
kclauhk
560367064b
Update facebook.py 2023-11-30 19:03:57 +08:00

View File

@ -52,7 +52,7 @@ class FacebookIE(InfoExtractor):
)\?(?:.*?)(?:v|video_id|story_fbid)=| )\?(?:.*?)(?:v|video_id|story_fbid)=|
[^/]+/videos/(?:[^/]+/)?| [^/]+/videos/(?:[^/]+/)?|
[^/]+/posts/| [^/]+/posts/|
groups/[^/]+/permalink/| groups/[^/]+/(?:permalink|posts)/|
watchparty/ watchparty/
)| )|
facebook: facebook:
@ -614,8 +614,8 @@ class FacebookIE(InfoExtractor):
..., 'comet_sections', 'content', 'story', (None, 'attached_story'), 'attachments', ..., 'comet_sections', 'content', 'story', (None, 'attached_story'), 'attachments',
..., ('styles', 'throwbackStyles', 'style_type_renderer'), (None, ...), 'attachment'), expected_type=dict) or [] ..., ('styles', 'throwbackStyles', 'style_type_renderer'), (None, ...), 'attachment'), expected_type=dict) or []
for attachment in attachments: for attachment in attachments:
ns = (try_get(attachment, lambda x: x['all_subattachments']['nodes'], list) ns = traverse_obj(attachment, ('all_subattachments', 'nodes', ..., {dict}),
or traverse_obj(attachment, (..., 'attachments', ..., 'styles', 'attachment'), expected_type=dict) or []) (..., 'attachments', ..., 'styles', 'attachment', {dict}))
for n in ns: for n in ns:
parse_attachment(n) parse_attachment(n)
parse_attachment(attachment) parse_attachment(attachment)
@ -638,7 +638,7 @@ class FacebookIE(InfoExtractor):
if len(entries) > 1: if len(entries) > 1:
return self.playlist_result(entries, video_id) return self.playlist_result(entries, video_id)
video_info = entries[0] if len(entries) > 0 else {'id': video_id} video_info = entries[0] if entries else {'id': video_id}
webpage_info = extract_metadata(webpage) webpage_info = extract_metadata(webpage)
# honor precise duration in video info # honor precise duration in video info
if video_info.get('duration'): if video_info.get('duration'):