summary refs log tree commit diff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2020-12-11 22:36:52 +0100
committerRemita Amine <remitamine@gmail.com>2020-12-11 22:44:18 +0100
commit59fea63dc2636b2bde10d56116c273cd5d516eed (patch)
tree9433b36b10ef90e569e99690e920f424beee03e9
parent22933e02d402a4d9d5d5fa55c19166df760d3b25 (diff)
downloadyoutube-dl-59fea63dc2636b2bde10d56116c273cd5d516eed.tar.gz
youtube-dl-59fea63dc2636b2bde10d56116c273cd5d516eed.tar.xz
youtube-dl-59fea63dc2636b2bde10d56116c273cd5d516eed.zip
[facebook] add support for videos attached to Relay based story pages(#10795)
-rw-r--r--youtube_dl/extractor/facebook.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/youtube_dl/extractor/facebook.py b/youtube_dl/extractor/facebook.py
index cc45aacc0..0c48101f8 100644
--- a/youtube_dl/extractor/facebook.py
+++ b/youtube_dl/extractor/facebook.py
@@ -265,6 +265,17 @@ class FacebookIE(InfoExtractor):
             'timestamp': 1606162592,
         },
         'skip': 'Requires logging in',
+    }, {
+        # node.comet_sections.content.story.attached_story.attachments.style_type_renderer.attachment.media
+        'url': 'https://www.facebook.com/groups/ateistiskselskab/permalink/10154930137678856/',
+        'info_dict': {
+            'id': '211567722618337',
+            'ext': 'mp4',
+            'title': 'Facebook video #211567722618337',
+            'uploader_id': '127875227654254',
+            'upload_date': '20161122',
+            'timestamp': 1479793574,
+        },
     }]
     _SUPPORTED_PAGLETS_REGEX = r'(?:pagelet_group_mall|permalink_video_pagelet|hyperfeed_story_id_[0-9a-f]+)'
 
@@ -451,7 +462,11 @@ class FacebookIE(InfoExtractor):
                     if not nodes and node:
                         nodes.append(node)
                     for node in nodes:
-                        attachments = try_get(node, lambda x: x['comet_sections']['content']['story']['attachments'], list) or []
+                        story = try_get(node, lambda x: x['comet_sections']['content']['story'], dict) or {}
+                        attachments = try_get(story, [
+                            lambda x: x['attached_story']['attachments'],
+                            lambda x: x['attachments']
+                        ], list) or []
                         for attachment in attachments:
                             attachment = try_get(attachment, lambda x: x['style_type_renderer']['attachment'], dict)
                             ns = try_get(attachment, lambda x: x['all_subattachments']['nodes'], list) or []