]> jfr.im git - yt-dlp.git/commitdiff
bugfix for a44ca5a470e09b5170fc9c3a46733f050fadbfae, 19a0394044bfad36cd665450271b8eb0...
authorpukkandan <redacted>
Mon, 18 Apr 2022 21:27:20 +0000 (02:57 +0530)
committerpukkandan <redacted>
Mon, 18 Apr 2022 21:29:20 +0000 (02:59 +0530)
Closes #3472

yt_dlp/extractor/facebook.py
yt_dlp/postprocessor/ffmpeg.py
yt_dlp/postprocessor/metadataparser.py
yt_dlp/utils.py

index f15a364249407ccd2d186494541cd507a420bbbd..de45f9298737c274316b8b31c92277dc0df9f447 100644 (file)
@@ -394,10 +394,8 @@ def extract_metadata(webpage):
                 r'handleWithCustomApplyEach\(\s*ScheduledApplyEach\s*,\s*(\{.+?\})\s*\);', webpage)]
             post = traverse_obj(post_data, (
                 ..., 'require', ..., ..., ..., '__bbox', 'result', 'data'), expected_type=dict) or []
-            media = traverse_obj(
-                post,
-                (..., 'attachments', ..., 'media', lambda _, m: str(m['id']) == video_id and m['__typename'] == 'Video'),
-                expected_type=dict)
+            media = traverse_obj(post, (..., 'attachments', ..., lambda k, v: (
+                k == 'media' and str(v['id']) == video_id and v['__typename'] == 'Video')), expected_type=dict)
             title = get_first(media, ('title', 'text'))
             description = get_first(media, ('creation_story', 'comet_sections', 'message', 'story', 'message', 'text'))
             uploader_data = get_first(media, 'owner') or get_first(post, ('node', 'actors', ...)) or {}
index 6fe1b6cdd618c185fbf5322c6641ddd585ac6a4d..d909149ef3970427818376c22dfc19afaab7d7ce 100644 (file)
@@ -1151,7 +1151,7 @@ def run(self, info):
         entries = info.get('entries') or []
         if not any(entries) or (self._only_multi_video and info['_type'] != 'multi_video'):
             return [], info
-        elif traverse_obj(entries, (..., 'requested_downloads', lambda _, v: len(v) > 1)):
+        elif traverse_obj(entries, (..., lambda k, v: k == 'requested_downloads' and len(v) > 1)):
             raise PostProcessingError('Concatenation is not supported when downloading multiple separate formats')
 
         in_files = traverse_obj(entries, (..., 'requested_downloads', 0, 'filepath')) or []
index 98885bd194c3d21f635c51acdbc610798a3bc351..51b927b9116a103c07e16721c473474652b19702 100644 (file)
@@ -6,12 +6,12 @@
 
 class MetadataParserPP(PostProcessor):
     def __init__(self, downloader, actions):
-        super().__init__(self, downloader)
+        super().__init__(downloader)
         self._actions = []
         for f in actions:
             action, *args = f
             assert action in self.Actions
-            self._actions.append(action(*args))
+            self._actions.append(action(self, *args))
 
     @classmethod
     def validate_action(cls, action, *data):
@@ -21,7 +21,7 @@ def validate_action(cls, action, *data):
         """
         if action not in cls.Actions:
             raise ValueError(f'{action!r} is not a valid action')
-        getattr(cls, action.value)(cls, *data)  # So this can raise error to validate
+        action(cls, *data)  # So this can raise error to validate
 
     @staticmethod
     def field_to_template(tmpl):
index cf52fb2b63c989ce2d590d621c4a5e347a4903d9..e1db7b868137110ff24b2760b20dfa6cb686bd2d 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/env python3
-import asyncio
 import atexit
 import base64
 import binascii
@@ -41,6 +40,7 @@
 import zlib
 
 from .compat import (
+    asyncio,
     compat_brotli,
     compat_chr,
     compat_cookiejar,