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 {}
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 []
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):
"""
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):
#!/usr/bin/env python3
-import asyncio
import atexit
import base64
import binascii
import zlib
from .compat import (
+ asyncio,
compat_brotli,
compat_chr,
compat_cookiejar,