[facebook] try to reduce unessessary tahoe requests
authorRemita Amine <remitamine@gmail.com>
Thu, 10 Dec 2020 11:10:33 +0000 (12:10 +0100)
committerRemita Amine <remitamine@gmail.com>
Thu, 10 Dec 2020 11:10:33 +0000 (12:10 +0100)
youtube_dl/extractor/facebook.py

index 7459fde3457366304e751d0e03d86341d223d8f3..c23ff298e750a64def431067b06f5725c463e31a 100644 (file)
@@ -328,11 +328,10 @@ class FacebookIE(InfoExtractor):
                     js_data, lambda x: x['jsmods']['instances'], list) or [])
 
         if not video_data:
-            server_js_data = self._parse_json(
-                self._search_regex(
-                    r'bigPipe\.onPageletArrive\(({.+?})\)\s*;\s*}\s*\)\s*,\s*["\']onPageletArrive\s+(?:pagelet_group_mall|permalink_video_pagelet|hyperfeed_story_id_\d+)',
-                    webpage, 'js data', default='{}'),
-                video_id, transform_source=js_to_json, fatal=False)
+            server_js_data = self._parse_json(self._search_regex([
+                r'bigPipe\.onPageletArrive\(({.+?})\)\s*;\s*}\s*\)\s*,\s*["\']onPageletArrive\s+(?:pagelet_group_mall|permalink_video_pagelet|hyperfeed_story_id_\d+)',
+                r'bigPipe\.onPageletArrive\(({.*?id\s*:\s*"permalink_video_pagelet".*?})\);'
+            ], webpage, 'js data', default='{}'), video_id, js_to_json, False)
             video_data = extract_from_jsmods_instances(server_js_data)
 
         if not video_data: