before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
import re from .common import InfoExtractor from ..utils import ( ExtractorError, lowercase_escape, url_or_none, ) class ChaturbateIE(InfoExtractor): _VALID_URL = r'https?://(?:[^/]+\.)?chaturbate\.(?P<domain>com|eu|global)/(?:fullvideo/?\?.*?\bb=)?(?P<id>[^/?&#]+)' _TESTS = [{ 'url': 'ht...
```suggestion _VALID_URL = r'https?://(?:[^/]+\.)?chaturbate\.(?P<tld>com|eu|global)/(?:fullvideo/?\?.*?\bb=)?(?P<id>[^/?&#]+)' ```
import re from .common import InfoExtractor from ..utils import ( ExtractorError, lowercase_escape, url_or_none, ) class ChaturbateIE(InfoExtractor): _VALID_URL = r'https?://(?:[^/]+\.)?chaturbate\.(?P<tld>com|eu|global)/(?:fullvideo/?\?.*?\bb=)?(?P<id>[^/?&#]+)' _TESTS = [{ 'url': 'https...
@@ -9,7 +9,7 @@ class ChaturbateIE(InfoExtractor): - _VALID_URL = r'https?://(?:[^/]+\.)?chaturbate\.com/(?:fullvideo/?\?.*?\bb=)?(?P<id>[^/?&#]+)' + _VALID_URL = r'https?://(?:[^/]+\.)?chaturbate\.(?P<domain>com|eu|global)/(?:fullvideo/?\?.*?\bb=)?(?P<id>[^/?&#]+)'
yt_dlp/extractor/chaturbate.py
12
Python
0.714
suggestion
137
37
37
false
[ie/Chaturbate] Support alternate domains
10,595
yt-dlp/yt-dlp
132,642
Python
bashonly
manavchaudhary1
'url': 'https://www.chaturbate.com/siswet19/', 'info_dict': { 'id': 'siswet19', 'ext': 'mp4', 'title': 're:^siswet19 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'age_limit': 18, 'is_live': True, }, 'params': { 's...
```suggestion video_id, tld = self._match_valid_url(url).group('id', 'tld') ```
'url': 'https://www.chaturbate.com/siswet19/', 'info_dict': { 'id': 'siswet19', 'ext': 'mp4', 'title': 're:^siswet19 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'age_limit': 18, 'is_live': True, }, 'params': { 's...
@@ -34,10 +34,12 @@ class ChaturbateIE(InfoExtractor): _ROOM_OFFLINE = 'Room is currently offline' def _real_extract(self, url): - video_id = self._match_id(url) + mobj = self._match_valid_url(url) + video_id = mobj.group('id') + domain = mobj.group('domain')
yt_dlp/extractor/chaturbate.py
26
Python
0.571
suggestion
89
51
51
false
[ie/Chaturbate] Support alternate domains
10,595
yt-dlp/yt-dlp
132,642
Python
bashonly
manavchaudhary1
'ext': 'mp4', 'title': 're:^siswet19 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'age_limit': 18, 'is_live': True, }, 'params': { 'skip_download': True, }, 'skip': 'Room is offline', }, { 'url': 'https://chaturba...
```suggestion f'https://chaturbate.{tld}/{video_id}/', video_id, ```
'ext': 'mp4', 'title': 're:^siswet19 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'age_limit': 18, 'is_live': True, }, 'params': { 'skip_download': True, }, 'skip': 'Room is offline', }, { 'url': 'https://chaturba...
@@ -34,10 +34,12 @@ class ChaturbateIE(InfoExtractor): _ROOM_OFFLINE = 'Room is currently offline' def _real_extract(self, url): - video_id = self._match_id(url) + mobj = self._match_valid_url(url) + video_id = mobj.group('id') + domain = mobj.group('domain') webpage =...
yt_dlp/extractor/chaturbate.py
26
Python
0.571
suggestion
82
51
51
false
[ie/Chaturbate] Support alternate domains
10,595
yt-dlp/yt-dlp
132,642
Python
bashonly
manavchaudhary1
if video_type not in {'series', 'episodes'}: webpage = self._download_webpage(url, video_id, note='Resolving to new URL') video_id = self._match_id(self._search_regex( (r'canonical"\s*href="(https?://tver\.jp/[^"]+)"', r'&link=(https?://tver\.jp/[^?&]+)[?&]'), ...
- Since we are extracting the player ID from a static URL, we could instead just hardcode the ID and skip the extra request - `url_transparent` is not needed here since we are not returning any additional metadata ```suggestion # Player ID is taken from .content.brightcove.E200.pro.pc.account_id: ...
def _real_initialize(self): create_response = self._download_json( 'https://platform-api.tver.jp/v2/api/platform_users/browser/create', None, note='Creating session', data=b'device_type=pc', headers={ 'Origin': 'https://s.tver.jp', 'Referer': 'https:/...
@@ -53,6 +53,27 @@ def _real_extract(self, url): (r'canonical"\s*href="(https?://tver\.jp/[^"]+)"', r'&link=(https?://tver\.jp/[^?&]+)[?&]'), webpage, 'url regex')) + if video_type == 'olympic/paris2024/video': + olympic_api_info = self._download_json( + ...
yt_dlp/extractor/tver.py
26
Python
0.857
refactor
645
51
51
false
[ie/TVer] Add support for downloading Paris Olympic (2024) VOD
10,600
yt-dlp/yt-dlp
132,642
Python
bashonly
vvto33
def _extract_n_function_name(self, jscode): # Examples (with placeholders nfunc, narray, idx): # * .get("n"))&&(b=nfunc(b) # * .get("n"))&&(b=narray[idx](b) # * b=String.fromCharCode(110),c=a.get(b))&&c=narray[idx](c) # * a.D&&(b="nn"[+a.D],c=a.get(b))&&(c=narray[idx](c)...
Some of the `\` aren't required: ```suggestion \s*\{(?:(?!};).)+?["']enhanced_except_''', ```
def _extract_n_function_name(self, jscode): # Examples (with placeholders nfunc, narray, idx): # * .get("n"))&&(b=nfunc(b) # * .get("n"))&&(b=narray[idx](b) # * b=String.fromCharCode(110),c=a.get(b))&&c=narray[idx](c) # * a.D&&(b="nn"[+a.D],c=a.get(b))&&(c=narray[idx](c)...
@@ -3174,18 +3174,32 @@ def _decrypt_nsig(self, s, video_id, player_url): return ret def _extract_n_function_name(self, jscode): + # Examples (with placeholders nfunc, narray, idx): + # * .get("n"))&&(b=nfunc(b) + # * .get("n"))&&(b=narray[idx](b) + # * b=String.fromCharCo...
yt_dlp/extractor/youtube.py
26
Python
0.714
suggestion
112
51
51
false
[ie/youtube] Fix `n` function name extraction for player `20dfca59`
10,611
yt-dlp/yt-dlp
132,642
Python
dirkf
bashonly
f'console.log(function({", ".join(args)}) {{ {func_body} }}({s!r}));', video_id=video_id, note='Executing signature code').strip() self.write_debug(f'Decrypted nsig {s} => {ret}') return ret def _extract_n_function_name(self, jscode): # Examples (with placeh...
Good idea! Another way to organise it is to make the pattern below an alternative in the first `_search_regex()` (ie, `tuple` of 2 patterns). To make this work, change the second pattern's `name` group to `nfunc` and add a dummy `(?P<idx>)`, eg at the end, and remove the `default` results. The fallback pattern can s...
f'console.log(function({", ".join(args)}) {{ {func_body} }}({s!r}));', video_id=video_id, note='Executing signature code').strip() self.write_debug(f'Decrypted nsig {s} => {ret}') return ret def _extract_n_function_name(self, jscode): # Examples (with placeh...
@@ -3174,18 +3174,32 @@ def _decrypt_nsig(self, s, video_id, player_url): return ret def _extract_n_function_name(self, jscode): + # Examples (with placeholders nfunc, narray, idx): + # * .get("n"))&&(b=nfunc(b) + # * .get("n"))&&(b=narray[idx](b) + # * b=String.fromCharCo...
yt_dlp/extractor/youtube.py
26
Python
0.857
bug
539
51
51
false
[ie/youtube] Fix `n` function name extraction for player `20dfca59`
10,611
yt-dlp/yt-dlp
132,642
Python
dirkf
bashonly
return ret def _extract_n_function_name(self, jscode): # Examples (with placeholders nfunc, narray, idx): # * .get("n"))&&(b=nfunc(b) # * .get("n"))&&(b=narray[idx](b) # * b=String.fromCharCode(110),c=a.get(b))&&c=narray[idx](c) # * a.D&&(b="nn"[+a.D],c=a.get(b))...
`[\w$]` would be more compact even if it might potentially match weird Unicode characters too (without `(?a)`).
return ret def _extract_n_function_name(self, jscode): # Examples (with placeholders nfunc, narray, idx): # * .get("n"))&&(b=nfunc(b) # * .get("n"))&&(b=narray[idx](b) # * b=String.fromCharCode(110),c=a.get(b))&&c=narray[idx](c) # * a.D&&(b="nn"[+a.D],c=a.get(b))...
@@ -3174,18 +3174,32 @@ def _decrypt_nsig(self, s, video_id, player_url): return ret def _extract_n_function_name(self, jscode): + # Examples (with placeholders nfunc, narray, idx): + # * .get("n"))&&(b=nfunc(b) + # * .get("n"))&&(b=narray[idx](b) + # * b=String.fromCharCo...
yt_dlp/extractor/youtube.py
26
Python
0.5
suggestion
111
51
51
false
[ie/youtube] Fix `n` function name extraction for player `20dfca59`
10,611
yt-dlp/yt-dlp
132,642
Python
dirkf
bashonly
requested_clients.append(client) # Force deprioritization of _BROKEN_CLIENTS for format de-duplication requested_clients.extend(broken_clients) if not requested_clients: requested_clients = default if smuggled_data.get('is_music_url') or self.is_music_url(url...
```suggestion ``` The initial response may still work? If it's for a session generated from a browser user should be passing cookies, so the visitor ID will match token that way. In other cases, player_skip=webpage should be passed
"""External PO Token fetch stub""" @staticmethod def _is_agegated(player_response): if traverse_obj(player_response, ('playabilityStatus', 'desktopLegacyAgeGateReason')): return True reasons = traverse_obj(player_response, ('playabilityStatus', ('status', 'reason'))) ...
@@ -3782,7 +3789,9 @@ def _invalid_player_response(self, pr, video_id): def _extract_player_responses(self, clients, video_id, webpage, master_ytcfg, smuggled_data): initial_pr = ignore_initial_response = None if webpage: - if 'web' in clients: + if self.po_token: + ...
yt_dlp/extractor/youtube.py
26
Python
0.857
suggestion
239
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
coletdjnz
seproDev
requested_clients = default if smuggled_data.get('is_music_url') or self.is_music_url(url): for requested_client in requested_clients: _, base_client, variant = _split_innertube_client(requested_client) music_client = f'{base_client}_music' ...
```suggestion if not self.po_token and all(x in experiments for x in self._POTOKEN_EXPERIMENTS): ``` perhaps?
if traverse_obj(player_response, ('playabilityStatus', 'desktopLegacyAgeGateReason')): return True reasons = traverse_obj(player_response, ('playabilityStatus', ('status', 'reason'))) AGE_GATE_REASONS = ( 'confirm your age', 'age-restricted', 'inappropriate', # reason ...
@@ -3782,7 +3789,9 @@ def _invalid_player_response(self, pr, video_id): def _extract_player_responses(self, clients, video_id, webpage, master_ytcfg, smuggled_data): initial_pr = ignore_initial_response = None if webpage: - if 'web' in clients: + if self.po_token: + ...
yt_dlp/extractor/youtube.py
26
Python
0.714
question
130
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
coletdjnz
seproDev
sapisid_cookie = dict_get( yt_cookies, ('__Secure-3PAPISID', 'SAPISID')) if sapisid_cookie and sapisid_cookie.value: self._SAPISID = sapisid_cookie.value self.write_debug('Extracted SAPISID cookie') # SAPISID cookie is required if n...
should be in _extract_player_response imo don't want to add it to every youtube request?
_SAPISID = None def _generate_sapisidhash_header(self, origin='https://www.youtube.com'): time_now = round(time.time()) if self._SAPISID is None: yt_cookies = self._get_cookies('https://www.youtube.com') # Sometimes SAPISID cookie isn't present but __Secure-3PAPISID is. ...
@@ -649,6 +649,8 @@ def _call_api(self, ep, query, video_id, fatal=True, headers=None, data = {'context': context} if context else {'context': self._extract_context(default_client=default_client)} data.update(query) + if self.po_token:
yt_dlp/extractor/youtube.py
26
Python
0.286
refactor
91
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
coletdjnz
seproDev
requested_clients.extend(broken_clients) if not requested_clients: requested_clients = default if smuggled_data.get('is_music_url') or self.is_music_url(url): for requested_client in requested_clients: _, base_client, variant = _split_innertube_client(req...
We can probably remove this initial logic here, since web will always require PO Token now Keep it consistent with android client and mark the formats as broken unless PO token provided
) or None def _get_requested_clients(self, url, smuggled_data): requested_clients = [] excluded_clients = [] allowed_clients = sorted( (client for client in INNERTUBE_CLIENTS if client[:1] != '_'), key=lambda client: INNERTUBE_CLIENTS[client]['priority'], rev...
@@ -3785,7 +3839,11 @@ def _extract_player_responses(self, clients, video_id, webpage, master_ytcfg, sm if 'web' in clients: experiments = traverse_obj(master_ytcfg, ( 'WEB_PLAYER_CONTEXT_CONFIGS', ..., 'serializedExperimentIds', {lambda x: x.split(',')}, ...)) - ...
yt_dlp/extractor/youtube.py
26
Python
0.429
bug
188
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
coletdjnz
seproDev
if 'configs' not in self._configuration_arg('player_skip') and client != 'web': player_ytcfg = self._download_ytcfg(client, video_id) or player_ytcfg player_url = player_url or self._extract_player_url(master_ytcfg, player_ytcfg, webpage=webpage) require_js_player = ...
Add a check that will only enter this branch if the client is not already marked as requires PO Token
for client_name in client_names: actual_client = _split_innertube_client(client_name)[0] if actual_client in INNERTUBE_CLIENTS: if actual_client not in all_clients: clients.append(client_name) all_clients.add...
@@ -3846,8 +3902,12 @@ def append_client(*client_names): experiments = traverse_obj(pr, ( 'responseContext', 'serviceTrackingParams', lambda _, v: v['service'] == 'GFEEDBACK', 'params', lambda _, v: v['key'] == 'e', 'value', {lambda x: x.split(',')}, ...)) - ...
yt_dlp/extractor/youtube.py
26
Python
0.357
suggestion
101
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
coletdjnz
seproDev
return get_first( args, [('VISITOR_DATA', ('INNERTUBE_CONTEXT', 'client', 'visitorData'), ('responseContext', 'visitorData'))], expected_type=str) @functools.cached_property def is_authenticated(self): return bool(self._generate_sapisidhash_header()) _PO_TOKEN_CACHE...
Pass data sync id too Investigate whether session index is used
In the format DELEGATED_SESSION_ID||USER_SESSION_ID or USER_SESSION_ID|| @params response and/or ytcfg """ if data_sync_id := self._configuration_arg('data_sync_id', [None], ie_key=YoutubeIE, casesense=True)[0]: return data_sync_id return traverse_obj( ar...
@@ -721,6 +728,52 @@ def _extract_visitor_data(*args): def is_authenticated(self): return bool(self._generate_sapisidhash_header()) + _PO_TOKEN_CACHE = None + + def _get_cached_po_token(self, client='web', **kwargs): + if not self._PO_TOKEN_CACHE: + self._PO_TOKEN_CACHE = {} + + ...
yt_dlp/extractor/youtube.py
26
Python
0.286
suggestion
66
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
coletdjnz
seproDev
yt_query.update(self._generate_player_context(sts)) return self._extract_response( item_id=video_id, ep='player', query=yt_query, ytcfg=player_ytcfg, headers=headers, fatal=True, default_client=client, note='Downloading {} player API JSON'.format(client.re...
this doesn't do anything anymore; should we check if the client has `REQUIRE_PO_TOKEN` and append it to `broken_clients` if there is no accompanying `po_token` passed? the reason why we need to deprioritize here as well as in the formats extraction is because the de-duplication will ignore "good" formats if they hav...
session_index=self._extract_session_index(master_ytcfg, player_ytcfg), account_syncid=( self._data_sync_id_to_delegated_session_id(data_sync_id) or self._extract_account_syncid(master_ytcfg, initial_pr, player_ytcfg) ), ) yt_query = { ...
@@ -3758,7 +3812,7 @@ def _get_requested_clients(self, url, smuggled_data): excluded_clients.append(client[1:]) elif client not in allowed_clients: self.report_warning(f'Skipping unsupported client "{client}"') - elif client in self._BROKEN_CLIENTS.values(): + ...
yt_dlp/extractor/youtube.py
26
Python
0.643
bug
364
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
See: https://github.com/yt-dlp/yt-dlp/pull/519 """ for ytcfg in data: session_index = int_or_none(try_get(ytcfg, lambda x: x['SESSION_INDEX'])) if session_index is not None: return session_index # Deprecated? def _extract_identity_token(self, ytcf...
```suggestion channel_syncid, _, user_syncid = data_sync_id.partition('||') if user_syncid: return channel_syncid ```
See: https://github.com/yt-dlp/yt-dlp/pull/519 """ for ytcfg in data: session_index = int_or_none(try_get(ytcfg, lambda x: x['SESSION_INDEX'])) if session_index is not None: return session_index # Deprecated? def _extract_identity_token(self, ytcf...
@@ -688,31 +696,51 @@ def _extract_identity_token(self, ytcfg=None, webpage=None): r'\bID_TOKEN["\']\s*:\s*["\'](.+?)["\']', webpage, 'identity token', default=None, fatal=False) - @staticmethod - def _extract_account_syncid(*args): + def _data_sync_id_to_delegated_session_i...
yt_dlp/extractor/youtube.py
26
Python
0.786
suggestion
149
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
token = try_get(ytcfg, lambda x: x['ID_TOKEN'], str) if token: return token if webpage: return self._search_regex( r'\bID_TOKEN["\']\s*:\s*["\'](.+?)["\']', webpage, 'identity token', default=None, fatal=False) def _data_sy...
```suggestion if delegated_sid := traverse_obj(args, (..., 'DELEGATED_SESSION_ID', {str}, any)): ```
token = try_get(ytcfg, lambda x: x['ID_TOKEN'], str) if token: return token if webpage: return self._search_regex( r'\bID_TOKEN["\']\s*:\s*["\'](.+?)["\']', webpage, 'identity token', default=None, fatal=False) def _data_sy...
@@ -688,31 +696,51 @@ def _extract_identity_token(self, ytcfg=None, webpage=None): r'\bID_TOKEN["\']\s*:\s*["\'](.+?)["\']', webpage, 'identity token', default=None, fatal=False) - @staticmethod - def _extract_account_syncid(*args): + def _data_sync_id_to_delegated_session_i...
yt_dlp/extractor/youtube.py
26
Python
0.714
suggestion
110
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
Extract current session ID required to download private playlists of secondary channels @params response and/or ytcfg """ # ytcfg includes channel_syncid if on secondary channel delegated_sid = traverse_obj( args, (..., 'DELEGATED_SESSION_ID'), expected_type=str, get_...
I'm having a hard time following the traversal path with this formatting. Maybe could tighten it up by using `{str}` and `any`?
Extract current session ID required to download private playlists of secondary channels @params response and/or ytcfg """ # ytcfg includes channel_syncid if on secondary channel if delegated_sid := traverse_obj(args, (..., 'DELEGATED_SESSION_ID', {str}, any)): return ...
@@ -688,31 +696,51 @@ def _extract_identity_token(self, ytcfg=None, webpage=None): r'\bID_TOKEN["\']\s*:\s*["\'](.+?)["\']', webpage, 'identity token', default=None, fatal=False) - @staticmethod - def _extract_account_syncid(*args): + def _data_sync_id_to_delegated_session_i...
yt_dlp/extractor/youtube.py
26
Python
0.571
question
127
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
player_url = player_url or self._extract_player_url(master_ytcfg, player_ytcfg, webpage=webpage) require_js_player = self._get_default_ytcfg(client).get('REQUIRE_JS_PLAYER') if 'js' in self._configuration_arg('player_skip'): require_js_player = False ...
```suggestion f'--extractor-args "youtube:po_token={client}+XXX"', ```
po_token = self.fetch_po_token( client=client, visitor_data=visitor_data, data_sync_id=data_sync_id if self.is_authenticated else None, player_url=player_url if require_js_player else None, ) require_po_token = self._get_default_ytcfg(...
@@ -3842,34 +3918,54 @@ def append_client(*client_names): player_url = self._download_player_url(video_id) tried_iframe_fallback = True - pr = initial_pr if client == 'web' and not ignore_initial_response else None - for retry in self.RetryManager(fatal=False): ...
yt_dlp/extractor/youtube.py
26
Python
0.643
refactor
92
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
if 'configs' not in self._configuration_arg('player_skip') and client != 'web': player_ytcfg = self._download_ytcfg(client, video_id) or player_ytcfg player_url = player_url or self._extract_player_url(master_ytcfg, player_ytcfg, webpage=webpage) require_js_player = ...
```suggestion f'No PO Token provided for {client} client, ' f'which is required for working {client} formats. ' ```
visitor_data = visitor_data or self._extract_visitor_data(master_ytcfg, initial_pr, player_ytcfg) data_sync_id = data_sync_id or self._extract_data_sync_id(master_ytcfg, initial_pr, player_ytcfg) po_token = self.fetch_po_token( client=client, visitor_data=visitor_data...
@@ -3842,34 +3918,54 @@ def append_client(*client_names): player_url = self._download_player_url(video_id) tried_iframe_fallback = True - pr = initial_pr if client == 'web' and not ignore_initial_response else None - for retry in self.RetryManager(fatal=False): ...
yt_dlp/extractor/youtube.py
26
Python
0.714
suggestion
158
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
data_sync_id=data_sync_id if self.is_authenticated else None, player_url=player_url if require_js_player else None, ) require_po_token = self._get_default_ytcfg(client).get('REQUIRE_PO_TOKEN') if not po_token and require_po_token: self...
```suggestion po_token=po_token) ```
pr = initial_pr if client == 'web' else None try: pr = pr or self._extract_player_response( client, video_id, master_ytcfg=player_ytcfg or master_ytcfg, player_ytcfg=player_ytcfg, player_url=player_u...
@@ -3842,34 +3918,54 @@ def append_client(*client_names): player_url = self._download_player_url(video_id) tried_iframe_fallback = True - pr = initial_pr if client == 'web' and not ignore_initial_response else None - for retry in self.RetryManager(fatal=False): ...
yt_dlp/extractor/youtube.py
26
Python
0.571
suggestion
58
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
def _get_checkok_params(): return {'contentCheckOk': True, 'racyCheckOk': True} @classmethod def _generate_player_context(cls, sts=None): context = { 'html5Preference': 'HTML5_PREF_WANTS', } if sts is not None: context['signatureTimestamp'] = sts ...
```suggestion po_token_client, sep, po_token = token_str.partition('+') if not sep: self.report_warning('Invalid po_token configuration format. Expected "client+po_token"') continue if not client or po_token_client == client: retu...
'html5Preference': 'HTML5_PREF_WANTS', } if sts is not None: context['signatureTimestamp'] = sts return { 'playbackContext': { 'contentPlaybackContext': context, }, **cls._get_checkok_params(), } def _get_co...
@@ -3701,6 +3725,56 @@ def _generate_player_context(cls, sts=None): **cls._get_checkok_params(), } + def _get_config_po_token(self, client): + po_token_strs = self._configuration_arg('po_token', [], ie_key=YoutubeIE, casesense=True) + for token_str in po_token_strs: + ...
yt_dlp/extractor/youtube.py
26
Python
0.786
question
344
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
if sts is not None: context['signatureTimestamp'] = sts return { 'playbackContext': { 'contentPlaybackContext': context, }, **cls._get_checkok_params(), } def _get_config_po_token(self, client): po_token_strs = self._co...
```suggestion 'You may need to pass Visitor Data with --extractor-args youtube:visitor_data=XXX') ``` and same below?
**cls._get_checkok_params(), } def _get_config_po_token(self, client): po_token_strs = self._configuration_arg('po_token', [], ie_key=YoutubeIE, casesense=True) for token_str in po_token_strs: po_token_client, sep, po_token = token_str.partition('+') if n...
@@ -3701,6 +3725,56 @@ def _generate_player_context(cls, sts=None): **cls._get_checkok_params(), } + def _get_config_po_token(self, client): + po_token_strs = self._configuration_arg('po_token', [], ie_key=YoutubeIE, casesense=True) + for token_str in po_token_strs: + ...
yt_dlp/extractor/youtube.py
26
Python
0.786
refactor
136
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
po_token_strs = self._configuration_arg('po_token', [], ie_key=YoutubeIE, casesense=True) for token_str in po_token_strs: po_token_client, sep, po_token = token_str.partition('+') if not sep: self.report_warning('Invalid po_token configuration format. Expected "cl...
```suggestion f'You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"') ```
po_token_strs = self._configuration_arg('po_token', [], ie_key=YoutubeIE, casesense=True) for token_str in po_token_strs: po_token_client, sep, po_token = token_str.partition('+') if not sep: self.report_warning( f'Invalid po_token configuratio...
@@ -3701,6 +3719,55 @@ def _generate_player_context(cls, sts=None): **cls._get_checkok_params(), } + def _get_config_po_token(self, client): + po_token_strs = self._configuration_arg('po_token', [], ie_key=YoutubeIE, casesense=True) + for token_str in po_token_strs: + ...
yt_dlp/extractor/youtube.py
26
Python
0.786
refactor
128
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
grqz
seproDev
def fetch_po_token(self, client='web', visitor_data=None, data_sync_id=None, player_url=None, **kwargs): # PO Token is bound to visitor_data / Visitor ID when logged out. Must have visitor_data for it to function. if not visitor_data and not self.is_authenticated and player_url: self.rep...
```suggestion f'You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"') ```
def fetch_po_token(self, client='web', visitor_data=None, data_sync_id=None, player_url=None, **kwargs): # PO Token is bound to visitor_data / Visitor ID when logged out. Must have visitor_data for it to function. if not visitor_data and not self.is_authenticated and player_url: self.re...
@@ -3701,6 +3719,55 @@ def _generate_player_context(cls, sts=None): **cls._get_checkok_params(), } + def _get_config_po_token(self, client): + po_token_strs = self._configuration_arg('po_token', [], ie_key=YoutubeIE, casesense=True) + for token_str in po_token_strs: + ...
yt_dlp/extractor/youtube.py
26
Python
0.786
refactor
124
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
grqz
seproDev
if user_syncid: return channel_syncid def _extract_account_syncid(self, *args): """ Extract current session ID required to download private playlists of secondary channels @params response and/or ytcfg """ # ytcfg includes channel_syncid if on secondary c...
need to move the `{str}` out of the branching tuple ```suggestion return traverse_obj( args, (..., ('DATASYNC_ID', ('responseContext', 'mainAppWebResponseContext', 'datasyncId')), {str}, any)) ```
if user_syncid: return channel_syncid def _extract_account_syncid(self, *args): """ Extract current session ID required to download private playlists of secondary channels @params response and/or ytcfg """ # ytcfg includes channel_syncid if on secondary c...
@@ -688,31 +696,46 @@ def _extract_identity_token(self, ytcfg=None, webpage=None): r'\bID_TOKEN["\']\s*:\s*["\'](.+?)["\']', webpage, 'identity token', default=None, fatal=False) - @staticmethod - def _extract_account_syncid(*args): + def _data_sync_id_to_delegated_session_i...
yt_dlp/extractor/youtube.py
26
Python
0.857
suggestion
220
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
return itertools.islice(_real_comment_extract(contents), 0, max_comments) @staticmethod def _get_checkok_params(): return {'contentCheckOk': True, 'racyCheckOk': True} @classmethod def _generate_player_context(cls, sts=None): context = { 'html5Preference': 'HTML5_PR...
Could include the bad arg with an only_once ```suggestion self.report_warning( f'Invalid po_token configuration format. Expected "client+po_token", got "{token_str}"', only_once=True) ```
return itertools.islice(_real_comment_extract(contents), 0, max_comments) @staticmethod def _get_checkok_params(): return {'contentCheckOk': True, 'racyCheckOk': True} @classmethod def _generate_player_context(cls, sts=None): context = { 'html5Preference': 'HTML5_PR...
@@ -3701,6 +3719,53 @@ def _generate_player_context(cls, sts=None): **cls._get_checkok_params(), } + def _get_config_po_token(self, client): + po_token_strs = self._configuration_arg('po_token', [], ie_key=YoutubeIE, casesense=True) + for token_str in po_token_strs: + ...
yt_dlp/extractor/youtube.py
26
Python
0.857
suggestion
227
51
51
false
[ie/youtube] Add `po_token`, `visitor_data` and `data_sync_id` extractor-args
10,648
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
if s['status'] == 'finished': if self.params.get('noprogress'): self.to_screen('[download] Download completed') speed = try_call(lambda: s['total_bytes'] / s['elapsed']) s.update({ 'speed': speed, '_speed_str': self.format_speed...
opted for this to simplify handling, and dedupe calculations. Will have to be implemented for postprocessor progress to be properly used
'_percent_str': self.format_percent(100), }) self._report_progress_status(s, join_nonempty( '100%%', with_fields(('total_bytes', 'of %(_total_bytes_str)s')), with_fields(('elapsed', 'in %(_elapsed_str)s')), with_fiel...
@@ -377,13 +387,15 @@ def with_fields(*tups, default=''): return self._progress_delta_time += update_delta + progress = try_call( + lambda: 100 * s['downloaded_bytes'] / s['total_bytes'], + lambda: 100 * s['downloaded_bytes'] / s['total_bytes_estimate...
yt_dlp/downloader/common.py
26
Python
0.429
refactor
136
51
51
false
[core] Support emitting ConEmu progress codes
10,649
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
if not self._downloader: return progress_dict = s.copy() progress_dict.pop('info_dict') progress_dict = {'info': s['info_dict'], 'progress': progress_dict} progress_template = self.get_param('progress_template', {}) tmpl = progress_template.get('postprocess'...
I don't like that this code is duplicated. Wouldn't it be better to pass `percent` and `state` to `to_console_title` instead?
s['_default_template'] = '%(postprocessor)s %(status)s' % s # noqa: UP031 if not self._downloader: return progress_dict = s.copy() progress_dict.pop('info_dict') progress_dict = {'info': s['info_dict'], 'progress': progress_dict} progress_template = self.ge...
@@ -191,6 +191,16 @@ def report_progress(self, s): progress_template.get('postprocess-title') or 'yt-dlp %(progress._default_template)s', progress_dict)) + percent = s.get('_percent') + if s['status'] not in ('downloading', 'error', 'finished') or percent is None: + ...
yt_dlp/postprocessor/common.py
26
Python
0.571
refactor
125
49
40
false
[core] Support emitting ConEmu progress codes
10,649
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
total_bytes_estimate='', ) def _report_progress_status(self, s, default_template): for name, style in self.ProgressStyles.items_: name = f'_{name}_str' if name not in s: continue s[name] = self._format_progress(s[name], style) s['_defa...
Why this check? Where did you get these states? I don't remember there being an error state...
total_bytes='', total_bytes_estimate='', ) def _report_progress_status(self, s, default_template): for name, style in self.ProgressStyles.items_: name = f'_{name}_str' if name not in s: continue s[name] = self._format_progress(s[name],...
@@ -335,6 +335,16 @@ def _report_progress_status(self, s, default_template): progress_template.get('download-title') or 'yt-dlp %(progress._default_template)s', progress_dict)) + percent = s.get('_percent') + if s['status'] not in ('downloading', 'error', 'finished') or percent...
yt_dlp/downloader/common.py
26
Python
0.357
question
94
51
51
false
[core] Support emitting ConEmu progress codes
10,649
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
s['_default_template'] = '%(postprocessor)s %(status)s' % s # noqa: UP031 if not self._downloader: return progress_dict = s.copy() progress_dict.pop('info_dict') progress_dict = {'info': s['info_dict'], 'progress': progress_dict} progress_template = self.ge...
```suggestion state = 1 if s['status'] == 'started' else 2 ```
def report_progress(self, s): s['_default_template'] = '%(postprocessor)s %(status)s' % s # noqa: UP031 if not self._downloader: return progress_dict = s.copy() progress_dict.pop('info_dict') progress_dict = {'info': s['info_dict'], 'progress': progress_dict} ...
@@ -191,6 +191,16 @@ def report_progress(self, s): progress_template.get('postprocess-title') or 'yt-dlp %(progress._default_template)s', progress_dict)) + percent = s.get('_percent') + if s['status'] not in ('downloading', 'error', 'finished') or percent is None: + ...
yt_dlp/postprocessor/common.py
26
Python
0.571
suggestion
72
50
41
false
[core] Support emitting ConEmu progress codes
10,649
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
for item in iterator: yield False, prev prev = item yield True, prev def apply_path(start_obj, path, test_type): objs = (start_obj,) has_branched = False key = None for last, key in lazy_last(variadic(path, (str, bytes, dict, set))): ...
```suggestion objs = filter(None, objs) ``` At least that works upstream and seems to match the other cases.
for item in iterator: yield False, prev prev = item yield True, prev def apply_path(start_obj, path, test_type): objs = (start_obj,) has_branched = False key = None for last, key in lazy_last(variadic(path, (str, bytes, dict, set))): ...
@@ -247,6 +265,10 @@ def apply_path(start_obj, path, test_type): objs = (list(filtered_objs),) continue + if key is filter: + obj = filter(None, objs)
yt_dlp/utils/traversal.py
26
Python
0.714
suggestion
127
51
51
false
Add extractor helpers
10,653
yt-dlp/yt-dlp
132,642
Python
dirkf
Grub4K
return result def find_element(tag=None, id=None, cls=None, attr=None, value=None, html=False): # deliberately using `id=` and `cls=` for ease of readability assert tag or id or cls or (attr and value), 'One of tag, id, cls or (attr AND value) is required' if not tag: tag = r'[\w:.-]+' i...
Undeniably readable but I think I'm missing the point that this and the similar comment below are making. As opposed to what? `_id=`? Positional-only params? Or should some/all of the params be kw-only?
result = dict(result) for subs in result.values(): subs.sort(key=lambda x: x.pop('quality', 0) or 0) return result @typing.overload def find_element(*, attr: str, value: str, tag: str | None = None, html=False): ... @typing.overload def find_element(*, cls: str, html=False): ... @typing.over...
@@ -277,13 +299,115 @@ def _traverse_obj(obj, path, allow_empty, test_type): return results[0] if results else {} if allow_empty and is_dict else None for index, path in enumerate(paths, 1): - result = _traverse_obj(obj, path, index == len(paths), True) - if result is not None: - ...
yt_dlp/utils/traversal.py
26
Python
0.643
question
205
51
51
false
Add extractor helpers
10,653
yt-dlp/yt-dlp
132,642
Python
dirkf
Grub4K
values['value'] = 'item_value' for key, value in values.items(): assert traverse_obj(morsel, key) == value, \ 'Morsel should provide access to all values' assert traverse_obj(morsel, ...) == list(values.values()), \ '`...` should yield all values' ...
Are these misplaced? ```suggestion class TestTraversalHelpers: def test_traversal_filter(self): data = [None, False, True, 0, 1, 0.0, 1.1, '', 'str', {}, {0: 0}, [], [1]] assert traverse_obj(data, [..., filter]) == [True, 1, 1.1, 'str', {0: 0}, [1]], \ '`filter` should filter f...
values['value'] = 'item_value' for key, value in values.items(): assert traverse_obj(morsel, key) == value, \ 'Morsel should provide access to all values' assert traverse_obj(morsel, ...) == list(values.values()), \ '`...` should yield all values' ...
@@ -420,6 +430,71 @@ def test_traversal_morsel(self): assert traverse_obj(morsel, [(None,), any]) == morsel, \ 'Morsel should not be implicitly changed to dict on usage' + def test_traversal_filter(self): + data = [None, False, True, 0, 1, 0.0, 1.1, '', 'str', {}, {0: 0}, [], [1]] + + ...
test/test_traversal.py
26
Python
1
refactor
638
51
51
false
Add extractor helpers
10,653
yt-dlp/yt-dlp
132,642
Python
dirkf
Grub4K
if member == 'pow': assertion(len(argvals) == 2, 'takes two arguments') return argvals[0] ** argvals[1] raise self.Exception(f'Unsupported Math method {member}', expr) if member == 'split': asser...
Perhaps this? ```suggestion return obj[slice(*argvals, None)] ``` If not, then we should at least `obj[:]` in the first one. `.slice()` is a shallow copy.
if member == 'pow': assertion(len(argvals) == 2, 'takes two arguments') return argvals[0] ** argvals[1] raise self.Exception(f'Unsupported Math method {member}', expr) if member == 'split': asser...
@@ -709,9 +709,14 @@ def eval_method(): obj.reverse() return obj elif member == 'slice': - assertion(isinstance(obj, list), 'must be applied on a list') - assertion(len(argvals) == 1, 'takes exactly one argument') - ...
yt_dlp/jsinterp.py
26
Python
0.786
suggestion
174
51
51
false
[jsinterp] Improve `slice` implementation
10,664
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
'url': 'https://www.huya.com/video/play/556054543.html', 'info_dict': { 'id': '556054543', 'title': '我不挑事 也不怕事', 'thumbnail': r're:https://.*\.jpg*', 'format_id': '1080P', 'url': r're:https?://.*\.mp4*', 'ext': 'mp4', 'w...
Since none of the other extractors use type hints, we should keep this consistent ```suggestion def _real_extract(self, url): ```
'view_count': int, 'comment_count': int, 'like_count': int, }, }] def _real_extract(self, url: str): video_id = self._match_id(url) video_data = self._download_json( 'https://liveapi.huya.com/moment/getMomentContent', video_id, ...
@@ -131,3 +136,120 @@ def encrypt(self, params, stream_info, stream_name): fm = base64.b64decode(params['fm']).decode().split('_', 1)[0] ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']])) return fm, ss + + +class HuyaVideoIE(InfoExtractor): + _VALID_URL = r'https:/...
yt_dlp/extractor/huya.py
26
Python
0.929
refactor
136
51
40
false
[ie/huya:video] Add extractor
10,686
yt-dlp/yt-dlp
132,642
Python
seproDev
hugepower
'format_note': '1080P - 1920x1080', 'duration': 1864, 'uploader': '卡尔', 'uploader_id': '367138632', 'upload_date': '20210811', 'view_count': int, 'comment_count': int, 'like_count': int, }, 'params': { 's...
Why is the first extractor error expected? Also, if all this data is required anyway, we might as well make it fatal: ```suggestion video_data = self._download_json( 'https://liveapi.huya.com/moment/getMomentContent', video_id, query={'videoId': video_id})['data']['moment']['videoIn...
formats = [] for definition in traverse_obj(video_data, ('definitions', lambda _, v: url_or_none(v['url']))): formats.append({ 'url': definition['url'], **traverse_obj(definition, { 'format_id': ('defName', {str}), 'widt...
@@ -131,3 +136,120 @@ def encrypt(self, params, stream_info, stream_name): fm = base64.b64decode(params['fm']).decode().split('_', 1)[0] ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']])) return fm, ss + + +class HuyaVideoIE(InfoExtractor): + _VALID_URL = r'https:/...
yt_dlp/extractor/huya.py
26
Python
1
refactor
329
51
28
false
[ie/huya:video] Add extractor
10,686
yt-dlp/yt-dlp
132,642
Python
seproDev
hugepower
'formats': formats, 'duration': self._parse_duration(video_data.get('videoDuration', '0')), 'uploader': video_data.get('nickName'), 'uploader_id': str_or_none(video_data.get('uid')), 'upload_date': self._parse_date(video_data.get('videoUploadTime', '')), ...
Let's simplify this by using `traverse_obj` from `..utils.traversal` ```suggestion return { 'id': video_id, 'formats': formats, **traverse_obj(video_data, { 'title': ('videoTitle', {str}), 'thumbnail': ('videoCover', {url_or_none}), ...
import base64 import hashlib import random import re import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, parse_duration, str_or_none, try_get, unescapeHTML, unified_strdate, update_url_query, url_or_none, ) from ..utils.traversal ...
@@ -131,3 +136,120 @@ def encrypt(self, params, stream_info, stream_name): fm = base64.b64decode(params['fm']).decode().split('_', 1)[0] ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']])) return fm, ss + + +class HuyaVideoIE(InfoExtractor): + _VALID_URL = r'https:/...
yt_dlp/extractor/huya.py
26
Python
0.857
refactor
788
27
212
false
[ie/huya:video] Add extractor
10,686
yt-dlp/yt-dlp
132,642
Python
seproDev
hugepower
video_id = self._match_id(url) api_url = f'https://liveapi.huya.com/moment/getMomentContent?videoId={video_id}' try: response = self._download_json(api_url, video_id) except Exception as e: raise ExtractorError(f'Failed to download JSON data: {e}', expected=True)...
We don't need to set `ext` and `protocol` since core code will take care of that. As for the `format_note`, I, personally, don't see much use in repeating the info already present with the other fields. ```suggestion for definition in traverse_obj(video_data, ('definitions', lambda _, v: url_or_none(v['url'])...
import base64 import hashlib import random import re import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, parse_duration, str_or_none, try_get, unescapeHTML, unified_strdate, update_url_query, url_or_none, ) from ..utils.traversal ...
@@ -131,3 +136,120 @@ def encrypt(self, params, stream_info, stream_name): fm = base64.b64decode(params['fm']).decode().split('_', 1)[0] ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']])) return fm, ss + + +class HuyaVideoIE(InfoExtractor): + _VALID_URL = r'https:/...
yt_dlp/extractor/huya.py
26
Python
0.857
suggestion
710
51
212
false
[ie/huya:video] Add extractor
10,686
yt-dlp/yt-dlp
132,642
Python
seproDev
hugepower
}) fm = base64.b64decode(params['fm']).decode().split('_', 1)[0] ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']])) return fm, ss class HuyaVideoIE(InfoExtractor): _VALID_URL = r'https://(?:www\.)?huya\.com/video/play/(?P<id>\d+)\.html' IE_NAME = 'huya...
Tests generally don't check the specific formats that are available ```suggestion ```
}) fm = base64.b64decode(params['fm']).decode().split('_', 1)[0] ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']])) return fm, ss class HuyaVideoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?huya\.com/video/play/(?P<id>\d+)\.html' IE_NAME = 'huya...
@@ -131,3 +136,120 @@ def encrypt(self, params, stream_info, stream_name): fm = base64.b64decode(params['fm']).decode().split('_', 1)[0] ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']])) return fm, ss + + +class HuyaVideoIE(InfoExtractor): + _VALID_URL = r'https:/...
yt_dlp/extractor/huya.py
26
Python
0.571
suggestion
87
51
51
false
[ie/huya:video] Add extractor
10,686
yt-dlp/yt-dlp
132,642
Python
seproDev
hugepower
def encrypt(self, params, stream_info, stream_name): ct = int_or_none(params.get('wsTime'), 16) + random.random() presenter_uid = stream_info['lPresenterUid'] if not stream_name.startswith(str(presenter_uid)): uid = presenter_uid else: uid = int_or_none(ct % ...
```suggestion _VALID_URL = r'https?://(?:www\.)?huya\.com/video/play/(?P<id>\d+)\.html' ```
def encrypt(self, params, stream_info, stream_name): ct = int_or_none(params.get('wsTime'), 16) + random.random() presenter_uid = stream_info['lPresenterUid'] if not stream_name.startswith(str(presenter_uid)): uid = presenter_uid else: uid = int_or_none(ct % ...
@@ -131,3 +136,77 @@ def encrypt(self, params, stream_info, stream_name): fm = base64.b64decode(params['fm']).decode().split('_', 1)[0] ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']])) return fm, ss + + +class HuyaVideoIE(InfoExtractor): + _VALID_URL = r'https://...
yt_dlp/extractor/huya.py
26
Python
0.571
suggestion
97
51
51
false
[ie/huya:video] Add extractor
10,686
yt-dlp/yt-dlp
132,642
Python
bashonly
hugepower
ct = int_or_none(params.get('wsTime'), 16) + random.random() presenter_uid = stream_info['lPresenterUid'] if not stream_name.startswith(str(presenter_uid)): uid = presenter_uid else: uid = int_or_none(ct % 1e7 * 1e6 % 0xffffffff) u1 = uid & 0xffffffff00000...
```suggestion IE_NAME = 'huya:video' ```
ct = int_or_none(params.get('wsTime'), 16) + random.random() presenter_uid = stream_info['lPresenterUid'] if not stream_name.startswith(str(presenter_uid)): uid = presenter_uid else: uid = int_or_none(ct % 1e7 * 1e6 % 0xffffffff) u1 = uid & 0xffffffff00000...
@@ -131,3 +136,77 @@ def encrypt(self, params, stream_info, stream_name): fm = base64.b64decode(params['fm']).decode().split('_', 1)[0] ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']])) return fm, ss + + +class HuyaVideoIE(InfoExtractor): + _VALID_URL = r'https?:/...
yt_dlp/extractor/huya.py
26
Python
0.429
suggestion
46
51
51
false
[ie/huya:video] Add extractor
10,686
yt-dlp/yt-dlp
132,642
Python
bashonly
hugepower
formats = [] for format_key, format_url in traverse_obj(video_dict, ( {dict.items}, lambda _, v: v[0] in self._FORMATS_MAP and url_or_none(v[1]), )): formats.append({ 'format_id': self._FORMATS_MAP[format_key][0], 'format_note': self._FORMA...
I can't find any examples that still work with the old regex pattern / traversal path. The old fallback is adding unnecessary complexity, IMO, which can lead to bugs (e.g. `data` can be unbound if `else`). I would like to simplify it like this: ```suggestion post_data = traverse_obj( re.findal...
formats = [] for format_key, format_url in traverse_obj(video_dict, ( {dict.items}, lambda _, v: v[0] in self._FORMATS_MAP and url_or_none(v[1]), )): formats.append({ 'format_id': self._FORMATS_MAP[format_key][0], 'format_note': self._FORMA...
@@ -1017,19 +1034,31 @@ def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - post_data = [self._parse_json(j, video_id, fatal=False) - for j in re.findall(r's\.handle\(({.*})\);requireLazy\(', webpage)] - dat...
yt_dlp/extractor/facebook.py
26
Python
1
bug
605
51
51
false
[ie/facebook:ads] Fix extractor
10,704
yt-dlp/yt-dlp
132,642
Python
bashonly
kclauhk
def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) if post_data := [self._parse_json(j, video_id, fatal=False) for j in re.findall(r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)]: dat...
Let's also simplify this... get rid of the assignment expression and instead just rely on traversal catching the `.startswith(None)` error and returning `None`. (We shouldn't be using `str_or_none` in the `markup_id` traversal path anyways, expecting the type is better). We can also transform with `clean_html` inside t...
def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) post_data = traverse_obj( re.findall(r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage), (..., {json.loads})) data = get_first(post_data, ( '...
@@ -1017,19 +1034,31 @@ def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - post_data = [self._parse_json(j, video_id, fatal=False) - for j in re.findall(r's\.handle\(({.*})\);requireLazy\(', webpage)] - dat...
yt_dlp/extractor/facebook.py
26
Python
1
refactor
725
51
51
false
[ie/facebook:ads] Fix extractor
10,704
yt-dlp/yt-dlp
132,642
Python
bashonly
kclauhk
data = traverse_obj(post_data, ( ..., 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., 'entryPointRoot', 'otherProps', 'deeplinkAdCard', 'snapshot', {dict}), get_all=False) elif post_data := [self._parse_json(j, video_id, fatal=False) ...
I'm not a big fan of overusing transformations (e.g. `lambda x: title`). IMO it would cleaner to leverage `merge_dicts` here: ```py info_dict = merge_dicts({ 'title': title, 'description': markup or None, }, traverse_obj(data, { 'description': ('link_description...
data = get_first(post_data, ( 'require', ..., ..., ..., '__bbox', 'require', ..., ..., ..., 'entryPointRoot', 'otherProps', 'deeplinkAdCard', 'snapshot', {dict})) if not data: raise ExtractorError('Unable to extract ad data') title = data.get('title') ...
@@ -1017,19 +1034,31 @@ def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - post_data = [self._parse_json(j, video_id, fatal=False) - for j in re.findall(r's\.handle\(({.*})\);requireLazy\(', webpage)] - dat...
yt_dlp/extractor/facebook.py
26
Python
0.786
style
692
51
51
false
[ie/facebook:ads] Fix extractor
10,704
yt-dlp/yt-dlp
132,642
Python
bashonly
kclauhk
title = join_nonempty('display_format', 'page_name', delim=' by ', from_dict=data) markup = None if markup_id := traverse_obj(data, ('body', '__m', {str_or_none}), get_all=False): markup = clean_html(traverse_obj(post_data, ( ..., 'require', ..., ..., ..., '__bbox...
```suggestion 'description': traverse_obj(entry, 'body', 'link_description') or info_dict.get('description'), ```
..., '__html', {clean_html}, {lambda x: not x.startswith('{{product.') and x}, any)) info_dict = merge_dicts({ 'title': title, 'description': markup or None, }, traverse_obj(data, { 'description': ('link_description', {lambda x: x if not x.startswith('{{p...
@@ -1039,12 +1068,12 @@ def _real_extract(self, url): entries = [] for idx, entry in enumerate(traverse_obj( - data, (('videos', 'cards'), lambda _, v: any(url_or_none(v[f]) for f in self._FORMATS_MAP))), 1, + data, (('videos', 'cards'), lambda _, v: any(url_or_none(v.get(f)) f...
yt_dlp/extractor/facebook.py
26
Python
0.714
suggestion
131
44
40
false
[ie/facebook:ads] Fix extractor
10,704
yt-dlp/yt-dlp
132,642
Python
bashonly
kclauhk
'duration': int_or_none(video_data.get('duration')), 'chapters': sorted(traverse_obj(config, ( 'embed', 'chapters', lambda _, v: int(v['timecode']) is not None, { 'title': ('title', {str}), 'start_time': ('timecode', {int_or_none}), ...
```suggestion 'release_time', 'stats.plays')), ```
'duration': int_or_none(video_data.get('duration')), 'chapters': sorted(traverse_obj(config, ( 'embed', 'chapters', lambda _, v: int(v['timecode']) is not None, { 'title': ('title', {str}), 'start_time': ('timecode', {int_or_none}), ...
@@ -234,13 +234,30 @@ def _parse_config(self, config, video_id): '_format_sort_fields': ('quality', 'res', 'fps', 'hdr:12', 'source'), } - def _extract_original_format(self, url, video_id, unlisted_hash=None): + def _call_videos_api(self, video_id, jwt_token, unlisted_hash=None, **kwargs):...
yt_dlp/extractor/vimeo.py
26
Python
0.571
suggestion
72
51
51
false
[ie/vimeo] Always try to extract original format
10,721
yt-dlp/yt-dlp
132,642
Python
seproDev
bashonly
prog, station_program, ft, radio_begin, radio_end = self._find_program(video_id, station, vid_int) auth_token, area_id = self._auth_client() return { 'id': video_id, 'title': try_call(lambda: prog.find('title').text), 'cast': self._extract_performers(prog), ...
normally we'd wanna do this, but since these are livestreams I think there is no benefit... it could only cause problems if someone is trying to download two different streams with the same `timestring` (btw it would be `'_old_archive_ids': [make_archive_id(self, timestring)]`) ```suggestion ```
prog, station_program, ft, radio_begin, radio_end = self._find_program(video_id, station, vid_int) auth_token, area_id = self._auth_client() return { 'id': video_id, 'title': try_call(lambda: prog.find('title').text), 'cast': self._extract_performers(prog), ...
@@ -207,9 +209,10 @@ def _real_extract(self, url): 'ft': radio_begin, 'end_at': radio_end, 'to': radio_end, - 'seek': video_id, + 'seek': timestring, }, ), + '_old_archive_ids': ...
yt_dlp/extractor/radiko.py
26
Python
0.857
suggestion
303
51
51
false
[ie/radiko] make video_ids unique by including station ID
10,726
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
return formats def _extract_performers(self, prog): return traverse_obj(prog, ( 'pfm/text()', ..., {lambda x: re.split(r'[//、 ,,]', x)}, ..., {str.strip})) or None class RadikoIE(RadikoBaseIE): _VALID_URL = r'https?://(?:www\.)?radiko\.jp/#!/ts/(?P<station>[A-Z0-9-]+)/(?P<timestr...
```suggestion station, timestring = self._match_valid_url(url).group('station', 'timestring') ```
return formats def _extract_performers(self, prog): return traverse_obj(prog, ( 'pfm/text()', ..., {lambda x: re.split(r'[//、 ,,]', x)}, ..., {str.strip})) or None class RadikoIE(RadikoBaseIE): _VALID_URL = r'https?://(?:www\.)?radiko\.jp/#!/ts/(?P<station>[A-Z0-9-]+)/(?P<timestr...
@@ -183,8 +184,9 @@ class RadikoIE(RadikoBaseIE): }] def _real_extract(self, url): - station, video_id = self._match_valid_url(url).groups() - vid_int = unified_timestamp(video_id, False) + station, timestring = self._match_valid_url(url).groups()
yt_dlp/extractor/radiko.py
26
Python
0.714
suggestion
107
51
51
false
[ie/radiko] make video_ids unique by including station ID
10,726
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
return formats def _extract_performers(self, prog): return traverse_obj(prog, ( 'pfm/text()', ..., {lambda x: re.split(r'[//、 ,,]', x)}, ..., {str.strip})) or None class RadikoIE(RadikoBaseIE): _VALID_URL = r'https?://(?:www\.)?radiko\.jp/#!/ts/(?P<station>[A-Z0-9-]+)/(?P<timestri...
`join_nonempty` isn't really necessary here since neither value could be empty, but it's fine
return formats def _extract_performers(self, prog): return traverse_obj(prog, ( 'pfm/text()', ..., {lambda x: re.split(r'[//、 ,,]', x)}, ..., {str.strip})) or None class RadikoIE(RadikoBaseIE): _VALID_URL = r'https?://(?:www\.)?radiko\.jp/#!/ts/(?P<station>[A-Z0-9-]+)/(?P<timestri...
@@ -183,8 +184,9 @@ class RadikoIE(RadikoBaseIE): }] def _real_extract(self, url): - station, video_id = self._match_valid_url(url).groups() - vid_int = unified_timestamp(video_id, False) + station, timestring = self._match_valid_url(url).groups() + video_id = join_nonempty(stati...
yt_dlp/extractor/radiko.py
26
Python
0.429
suggestion
93
51
51
false
[ie/radiko] make video_ids unique by including station ID
10,726
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'description': 'md5:595c6e7dca76ae615b1d38c298a287a1', 'age_limit': 0, 'channel': 'Not Just Bikes', 'uploader_url': 'https://www.patreon.com/notjustbikes', 'uploader': 'Not Just Bikes', 'uploader_id': '37306634', 'thumbnail': r're:^http...
since this is the same test as above, this can be `only_matching`
'age_limit': 0, 'channel': 'Not Just Bikes', 'uploader_url': 'https://www.patreon.com/notjustbikes', 'uploader': 'Jason', 'uploader_id': '37306634', 'thumbnail': r're:^https?://.*$', }, 'playlist_mincount': 71, }, { 'url...
@@ -455,6 +455,23 @@ class PatreonCampaignIE(PatreonBaseIE): 'thumbnail': r're:^https?://.*$', }, 'playlist_mincount': 71, + }, { + 'url': 'https://www.patreon.com/api/campaigns/4767637/posts', + 'info_dict': { + 'title': 'Not Just Bikes', + 'channel...
yt_dlp/extractor/patreon.py
26
Python
0.357
suggestion
65
51
51
false
[PatreonCampaign] Add api campaign url for patreon
10,734
yt-dlp/yt-dlp
132,642
Python
Grub4K
hibes
'description': 'md5:595c6e7dca76ae615b1d38c298a287a1', 'age_limit': 0, 'channel': 'Not Just Bikes', 'uploader_url': 'https://www.patreon.com/notjustbikes', 'uploader': 'Not Just Bikes', 'uploader_id': '37306634', 'thumbnail': r're:^http...
```suggestion 'playlist_mincount': 201, ```
'age_limit': 0, 'channel': 'Not Just Bikes', 'uploader_url': 'https://www.patreon.com/notjustbikes', 'uploader': 'Jason', 'uploader_id': '37306634', 'thumbnail': r're:^https?://.*$', }, 'playlist_mincount': 71, }, { 'url...
@@ -455,6 +455,23 @@ class PatreonCampaignIE(PatreonBaseIE): 'thumbnail': r're:^https?://.*$', }, 'playlist_mincount': 71, + }, { + 'url': 'https://www.patreon.com/api/campaigns/4243769/posts', + 'info_dict': { + 'title': 'Second Thought', + 'channel...
yt_dlp/extractor/patreon.py
26
Python
0.571
suggestion
53
51
51
false
[PatreonCampaign] Add api campaign url for patreon
10,734
yt-dlp/yt-dlp
132,642
Python
bashonly
hibes
class ADNIE(ADNBaseIE): _VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.com/(?:(?P<lang>de)/)?video/[^/?#]+/(?P<id>\d+)' _TESTS = [{ 'url': 'https://animationdigitalnetwork.com/video/558-fruits-basket/9841-episode-1-a-ce-soir', 'md5': '1c9ef066ceb302c86f80c2b371615261', ...
The old url was testing the match for `animedigitalnetwork.com` rather than `animationdigitalnetwork.com`. Does the `anime` domain still work?
class ADNIE(ADNBaseIE): _VALID_URL = r'https?://(?:www\.)?animationdigitalnetwork\.com/(?:(?P<lang>de)/)?video/[^/?#]+/(?P<id>\d+)' _TESTS = [{ 'url': 'https://animationdigitalnetwork.com/video/558-fruits-basket/9841-episode-1-a-ce-soir', 'md5': '1c9ef066ceb302c86f80c2b371615261', 'inf...
@@ -71,10 +71,10 @@ class ADNIE(ADNBaseIE): }, 'skip': 'Only available in French and German speaking Europe', }, { - 'url': 'http://animedigitalnetwork.com/video/blue-exorcist-kyoto-saga/7778-episode-1-debut-des-hostilites', + 'url': 'https://animationdigitalnetwork.com/video/1188-m...
yt_dlp/extractor/adn.py
26
Python
0.5
question
142
51
51
false
[ie/adn] adjustments for API changes
10,749
yt-dlp/yt-dlp
132,642
Python
bashonly
infanf
'title': ('title'), 'description': ('description'), 'channel': ('channel'), 'channel_id': ('channel_id'), })) else: return {'id': video_id} class PiramideTVChannelURLIE(InfoExtractor): _VALID_URL = r'https?://piramide\...
I don't entirely understand why you added a search extractor for the channel. I'll change this to be just a single extractor.
return self._extract_video(video_id)[1] class PiramideTVChannelIE(InfoExtractor): _VALID_URL = r'https?://piramide\.tv/channel/(?P<id>[\w-]+)' _TESTS = [{ 'url': 'https://piramide.tv/channel/thekalo', 'playlist_mincount': 10, 'info_dict': { 'id': 'thekalo', ...
@@ -0,0 +1,113 @@ +from .common import InfoExtractor, SearchInfoExtractor +from ..utils import ( + traverse_obj, + unified_timestamp, + url_or_none, +) + + +class PiramideTVIE(InfoExtractor): + _VALID_URL = r'https?://piramide\.tv/video/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://piramide.tv/v...
yt_dlp/extractor/piramidetv.py
26
Python
0.429
refactor
125
43
29
false
[ie/piramidetv] Add extractors
10,777
yt-dlp/yt-dlp
132,642
Python
seproDev
kclauhk
formats, subtitles = self._extract_m3u8_formats_and_subtitles( f'https://cdn.piramide.tv/video/{video_id}/manifest.m3u8', video_id, fatal=fatal) video_info = {**traverse_obj(video_data, { 'id': ('video', 'id', {str}), 'title': ('video', 'title', {s...
I'm not a huge fan of this logic. This doesn't work with lazy extraction or `--no-playlist`. Since I can't think of a better way to do this, I would just keep it simple for now and only extract a single video. If someone comes up with a better way to extract a new PR can be opened.
f'https://cdn.piramide.tv/video/{video_id}/manifest.m3u8', video_id, fatal=False) next_video = traverse_obj(video_data, ('video', 'next_video', 'id', {str})) return next_video, { 'id': video_id, 'formats': formats, 'subtitles': subtitles, **tra...
@@ -0,0 +1,113 @@ +from .common import InfoExtractor, SearchInfoExtractor +from ..utils import ( + traverse_obj, + unified_timestamp, + url_or_none, +) + + +class PiramideTVIE(InfoExtractor): + _VALID_URL = r'https?://piramide\.tv/video/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://piramide.tv/v...
yt_dlp/extractor/piramidetv.py
26
Python
0.643
refactor
284
51
51
false
[ie/piramidetv] Add extractors
10,777
yt-dlp/yt-dlp
132,642
Python
seproDev
kclauhk
if self.get_param('noplaylist'): self.to_screen(f'Downloading just video {video_id} because of --no-playlist') else: return self.playlist_result( self._entries(video, next_video_id), **traverse_obj(video, { ...
I don't understand why you are fully extracting the entries here. This breaks `--flat-playlist`.
class PiramideTVChannelIE(InfoExtractor): _VALID_URL = r'https?://piramide\.tv/channel/(?P<id>[\w-]+)' _TESTS = [{ 'url': 'https://piramide.tv/channel/thekalo', 'playlist_mincount': 10, 'info_dict': { 'id': 'thekalo', }, }] def _entries(self, channel_name): ...
@@ -0,0 +1,114 @@ +import re + +from .common import InfoExtractor +from ..utils import parse_iso8601, url_or_none +from ..utils.traversal import traverse_obj + + +class PiramideTVBaseIE(InfoExtractor): + def _extract_video(self, video_id, fatal=True): + video_data = self._download_json( + f'https:/...
yt_dlp/extractor/piramidetv.py
26
Python
0.429
refactor
96
42
27
false
[ie/piramidetv] Add extractors
10,777
yt-dlp/yt-dlp
132,642
Python
seproDev
kclauhk
}, { 'url': 'https://piramide.tv/video/wcYn6li79NgN', 'info_dict': { 'id': 'wcYn6li79NgN', 'title': 'ACEPTO TENER UN BEBE CON MI NOVIA\u2026?', 'description': '', 'channel': 'ARTA GAME', 'channel_id': 'arta_game', }, 'playli...
`self._yes_playlist` should be used.
'description': ('description', {str}), 'thumbnail': ('media', 'thumbnail', {url_or_none}), 'channel': ('channel', 'name', {str}), 'channel_id': ('channel', 'id', {str}), 'timestamp': ('date', {parse_iso8601}), })), } ...
@@ -0,0 +1,114 @@ +import re + +from .common import InfoExtractor +from ..utils import parse_iso8601, url_or_none +from ..utils.traversal import traverse_obj + + +class PiramideTVBaseIE(InfoExtractor): + def _extract_video(self, video_id, fatal=True): + video_data = self._download_json( + f'https:/...
yt_dlp/extractor/piramidetv.py
26
Python
0.286
suggestion
36
51
51
false
[ie/piramidetv] Add extractors
10,777
yt-dlp/yt-dlp
132,642
Python
seproDev
kclauhk
'title': 'md5:79f9c8183ea6a35c836923142cf0abcc', 'description': '', 'thumbnail': 'https://cdn.jwplayer.com/v2/media/W86PgQDn/thumbnails/B9gpIxkH.jpg', 'channel': 'León Picarón', 'channel_id': 'leonpicaron', 'timestamp': 1696460362, 'upl...
Because fatal=False, error will not be raised when download_json fails if the video id does not exist. extract_m3u8_formats_and_subtitles will wait until timeout. This change is made to skip the process if video_data is not available.
'title': 'md5:79f9c8183ea6a35c836923142cf0abcc', 'description': '', 'thumbnail': 'https://cdn.jwplayer.com/v2/media/W86PgQDn/thumbnails/B9gpIxkH.jpg', 'channel': 'León Picarón', 'channel_id': 'leonpicaron', 'timestamp': 1696460362, 'upl...
@@ -34,27 +34,28 @@ class PiramideTVIE(InfoExtractor): }] def _extract_video(self, video_id): - video_data = self._download_json( - f'https://hermes.piramide.tv/video/data/{video_id}', video_id, fatal=False) - formats, subtitles = self._extract_m3u8_formats_and_subtitles( - ...
yt_dlp/extractor/piramidetv.py
26
Python
0.643
bug
238
51
51
false
[ie/piramidetv] Add extractors
10,777
yt-dlp/yt-dlp
132,642
Python
kclauhk
kclauhk
url, smuggled_data = unsmuggle_url(url, {}) video_id = self._match_id(url) if self._yes_playlist(video_id, video_id, smuggled_data): return self.playlist_result(self._entries(video_id), video_id) return self._extract_video(video_id)[1] class PiramideTVChannelIE(InfoExtracto...
This change is made due to [this](https://github.com/yt-dlp/yt-dlp/issues/11577#issuecomment-2483386462)
return self.playlist_result(self._entries(video_id), video_id) return self._extract_video(video_id)[1] class PiramideTVChannelIE(InfoExtractor): _VALID_URL = r'https?://piramide\.tv/channel/(?P<id>[\w-]+)' _TESTS = [{ 'url': 'https://piramide.tv/channel/thekalo', 'playlist_...
@@ -88,9 +88,16 @@ class PiramideTVChannelIE(InfoExtractor): def _entries(self, channel_name): videos = self._download_json( f'https://hermes.piramide.tv/channel/list/{channel_name}/date/100000', channel_name) - for video_id in traverse_obj(videos, ('videos', ..., 'id', {str})): - ...
yt_dlp/extractor/piramidetv.py
26
Python
0.429
suggestion
104
35
30
false
[ie/piramidetv] Add extractors
10,777
yt-dlp/yt-dlp
132,642
Python
kclauhk
kclauhk
'url': 'https://piramide.tv/video/wcYn6li79NgN', 'info_dict': { 'id': 'wcYn6li79NgN', 'ext': 'mp4', 'title': 'ACEPTO TENER UN BEBE CON MI NOVIA\u2026? | Parte 1', 'description': '', 'channel': 'ARTA GAME', 'channel_id': 'arta_game',...
Extractors should not set `original_url`. We also don't want to overwrite `webpage_url` as the info saved in the infodict should be usable to rerun the extraction exactly as during the initial run. ```suggestion ```
'url': 'https://piramide.tv/video/wcYn6li79NgN', 'info_dict': { 'id': 'wcYn6li79NgN', 'ext': 'mp4', 'title': 'ACEPTO TENER UN BEBE CON MI NOVIA\u2026? | Parte 1', 'description': '', 'channel': 'ARTA GAME', 'channel_id': 'arta_game',...
@@ -0,0 +1,104 @@ +from .common import InfoExtractor +from ..utils import parse_iso8601, smuggle_url, unsmuggle_url, url_or_none +from ..utils.traversal import traverse_obj + + +class PiramideTVIE(InfoExtractor): + _VALID_URL = r'https?://piramide\.tv/video/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://p...
yt_dlp/extractor/piramidetv.py
26
Python
0.857
refactor
218
51
51
false
[ie/piramidetv] Add extractors
10,777
yt-dlp/yt-dlp
132,642
Python
seproDev
kclauhk
video_id = next_video def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) video_id = self._match_id(url) if self._yes_playlist(video_id, video_id, smuggled_data): return self.playlist_result(self._entries(video_id), video_id) return self...
```suggestion f'https://piramide.tv/video/{video["id"]}', {'force_noplaylist': True}), ```
video_id = next_video def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) video_id = self._match_id(url) if self._yes_playlist(video_id, video_id, smuggled_data): return self.playlist_result(self._entries(video_id), video_id) return self...
@@ -0,0 +1,99 @@ +from .common import InfoExtractor +from ..utils import parse_iso8601, smuggle_url, unsmuggle_url, url_or_none +from ..utils.traversal import traverse_obj + + +class PiramideTVIE(InfoExtractor): + _VALID_URL = r'https?://piramide\.tv/video/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://pi...
yt_dlp/extractor/piramidetv.py
26
Python
0.714
suggestion
108
36
36
false
[ie/piramidetv] Add extractors
10,777
yt-dlp/yt-dlp
132,642
Python
bashonly
kclauhk
formats, subtitles = self._extract_m3u8_formats_and_subtitles( f'https://cdn.piramide.tv/video/{video_id}/manifest.m3u8', video_id, fatal=False) next_video = traverse_obj(video_data, ('video', 'next_video', 'id', {str})) return next_video, { 'id': video_id, 'f...
this seems clearer to me...and don't we want to add the original `video_id` to the `visited` set anyways? ```suggestion visited.add(video_id) next_video, info = self._extract_video(video_id) yield info if not next_video or next_video in visited: brea...
formats, subtitles = self._extract_m3u8_formats_and_subtitles( f'https://cdn.piramide.tv/video/{video_id}/manifest.m3u8', video_id, fatal=False) next_video = traverse_obj(video_data, ('video', 'next_video', 'id', {str})) return next_video, { 'id': video_id, 'f...
@@ -0,0 +1,99 @@ +from .common import InfoExtractor +from ..utils import parse_iso8601, smuggle_url, unsmuggle_url, url_or_none +from ..utils.traversal import traverse_obj + + +class PiramideTVIE(InfoExtractor): + _VALID_URL = r'https?://piramide\.tv/video/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://pi...
yt_dlp/extractor/piramidetv.py
26
Python
0.857
refactor
326
51
51
false
[ie/piramidetv] Add extractors
10,777
yt-dlp/yt-dlp
132,642
Python
bashonly
kclauhk
'subtitles': subtitles, **traverse_obj(video_data, ('video', { 'id': ('id', {str}), 'title': ('title', {str}), 'description': ('description', {str}), 'thumbnail': ('media', 'thumbnail', {url_or_none}), 'channel': ('c...
unless there is `smuggled_data`, this will always trigger the `--no-playlist` message even if `_entries()` only yields a single entry, which is not ideal... but I don't see a better way to handle it
'subtitles': subtitles, **traverse_obj(video_data, ('video', { 'id': ('id', {str}), 'title': ('title', {str}), 'description': ('description', {str}), 'thumbnail': ('media', 'thumbnail', {url_or_none}), 'channel': ('c...
@@ -0,0 +1,99 @@ +from .common import InfoExtractor +from ..utils import parse_iso8601, smuggle_url, unsmuggle_url, url_or_none +from ..utils.traversal import traverse_obj + + +class PiramideTVIE(InfoExtractor): + _VALID_URL = r'https?://piramide\.tv/video/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://pi...
yt_dlp/extractor/piramidetv.py
26
Python
0.714
suggestion
198
51
51
false
[ie/piramidetv] Add extractors
10,777
yt-dlp/yt-dlp
132,642
Python
bashonly
kclauhk
from .common import InfoExtractor from ..utils import traverse_obj class EurosportIE(InfoExtractor): _VALID_URL = r'https?://(?:(?:www\.)?eurosport\.(?:com(?:\.tr)?|de|dk|es|fr|hu|it|nl|no|ro)|eurosport.tvn24.pl)/[\w-]+/(?:[\w-]+/[\d-]+/)?[\w.-]+_(?P<id>vid\d+)' _TESTS = [{ 'url': 'https://www.eurospo...
Also: ~~`https://www.tntsports.co.uk/`~~ seems like this domain name has no videos on it and I'm redirected to eurosport.com, or am I geo-blocked? `https://espanol.eurosport.com/` Just found out that these domain names can be retrieved from the 'CHANGE VERSION' list at the bottom of the page. ![image](https://githu...
from .common import InfoExtractor from ..utils import traverse_obj class EurosportIE(InfoExtractor): _VALID_URL = r'''(?x) https?://(?: (?:(?:www|espanol)\.)?eurosport\.(?:com(?:\.tr)?|de|dk|es|fr|hu|it|nl|no|ro)| eurosport\.tvn24\.pl )/[\w-]+/(?:[\w-]+/[\d-]+/)?[\w.-]+_(?P...
@@ -3,7 +3,7 @@ class EurosportIE(InfoExtractor): - _VALID_URL = r'https?://www\.eurosport\.com/\w+/(?:[\w-]+/[\d-]+/)?[\w-]+_(?P<id>vid\d+)' + _VALID_URL = r'https?://(?:(?:www\.)?eurosport\.(?:com(?:\.tr)?|de|dk|es|fr|hu|it|nl|no|ro)|eurosport.tvn24.pl)/[\w-]+/(?:[\w-]+/[\d-]+/)?[\w.-]+_(?P<id>vid\d+)'
yt_dlp/extractor/eurosport.py
6
Python
0.643
suggestion
389
31
31
false
[ie/Eurosport] Support local variants
10,785
yt-dlp/yt-dlp
132,642
Python
grqz
seproDev
from .common import InfoExtractor from ..utils import ( NO_DEFAULT, int_or_none, unescapeHTML, ) class TVN24IE(InfoExtractor): _WORKING = False _VALID_URL = r'https?://(?:(?!eurosport)(?:[^/]+)\.)?tvn24(?:bis)?\.pl/(?:[^/]+/)*(?P<id>[^/]+)' _TESTS = [{ 'url': 'http://www.tvn24.pl/wiado...
```suggestion _VALID_URL = r'https?://(?:(?!eurosport)[^/]+\.)?tvn24(?:bis)?\.pl/(?:[^/?#]+/)*(?P<id>[^/?#]+)' ```
from .common import InfoExtractor from ..utils import ( NO_DEFAULT, int_or_none, unescapeHTML, ) class TVN24IE(InfoExtractor): _WORKING = False _VALID_URL = r'https?://(?:(?!eurosport)[^/]+\.)?tvn24(?:bis)?\.pl/(?:[^/?#]+/)*(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'http://www.tvn24.pl/wiado...
@@ -8,7 +8,7 @@ class TVN24IE(InfoExtractor): _WORKING = False - _VALID_URL = r'https?://(?:(?:[^/]+)\.)?tvn24(?:bis)?\.pl/(?:[^/]+/)*(?P<id>[^/]+)' + _VALID_URL = r'https?://(?:(?!eurosport)(?:[^/]+)\.)?tvn24(?:bis)?\.pl/(?:[^/]+/)*(?P<id>[^/]+)'
yt_dlp/extractor/tvn24.py
11
Python
0.714
suggestion
120
36
36
false
[ie/Eurosport] Support local variants
10,785
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
for href, resolution in re.findall( r'<a[^>]+data-quality="[^"]+"[^>]+href="([^"]+)"[^>]+class="quality-btn"[^>]*>([0-9]+p)', webpage): if need_confirm_age: handler = self._download_age_confirm_page else: handler = self._do...
Do you have any example URLs where the ID contains letters? If no, we can use: ```suggestion _VALID_URL = r'https?://(?:www\.)?cda\.pl/\w+/folder/(?P<id>\d+)' ```
extract_format(webpage, 'default') for href, resolution in re.findall( r'<a[^>]+data-quality="[^"]+"[^>]+href="([^"]+)"[^>]+class="quality-btn"[^>]*>([0-9]+p)', webpage): if need_confirm_age: handler = self._download_age_confirm_page ...
@@ -351,3 +351,63 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/[0-9a-zA-Z_]+/folder/(?P<id>[0-9a-z]+)(/vfilm)?'
yt_dlp/extractor/cda.py
26
Python
0.786
suggestion
170
51
51
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
f'Downloading {resolution} version information', fatal=False) if not webpage: # Manually report warning because empty page is returned when # invalid version is requested. self.report_warning(f'Unable to download {resolution} version informatio...
Do we expect new videos to be added here? If yes use `playlist_mincount`
urljoin(self._BASE_URL, href), video_id, f'Downloading {resolution} version information', fatal=False) if not webpage: # Manually report warning because empty page is returned when # invalid version is requested. self.report_war...
@@ -351,3 +351,63 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/[0-9a-zA-Z_]+/folder/(?P<id>[0-9a-z]+)(/vfilm)?' + ...
yt_dlp/extractor/cda.py
26
Python
0.429
question
72
51
51
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
}, 'playlist_count': 13, }, { 'url': 'https://www.cda.pl/smiechawaTV/folder/2664592/vfilm', 'info_dict': { 'id': '2664592', 'title': 'VideoDowcipy - wszystkie odcinki', }, 'playlist_count': 71, ...
```suggestion title = self._og_search_title(webpage) ```
'title': 'SERIA DRUGA', }, 'playlist_mincount': 13, }, { 'url': 'https://www.cda.pl/smiechawaTV/folder/2664592/vfilm', 'info_dict': { 'id': '2664592', 'title': 'VideoDowcipy - wszystkie odcinki', ...
@@ -351,3 +351,63 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/[0-9a-zA-Z_]+/folder/(?P<id>[0-9a-z]+)(/vfilm)?' + ...
yt_dlp/extractor/cda.py
26
Python
0.571
suggestion
66
50
38
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
}] def _real_extract(self, url): folder_id = self._match_id(url) webpage = self._download_webpage(url, folder_id) title = self._html_search_meta('og:title', webpage, 'title') def extract_page_entries(url): webpage = self._download_webpage(url, folder_id, f'Ext...
This is problematic if the url is something like `https://www.cda.pl/smiechawaTV/folder/2664592/vfilm?sortby=created&order=asc` I would construct the url myself based on the folder_id
import base64 import codecs import datetime as dt import hashlib import hmac import json import random import re import urllib.parse from .common import InfoExtractor from ..compat import compat_ord from ..utils import ( ExtractorError, OnDemandPagedList, float_or_none, int_or_none, merge_dicts, ...
@@ -351,3 +351,63 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/[0-9a-zA-Z_]+/folder/(?P<id>[0-9a-z]+)(/vfilm)?' + ...
yt_dlp/extractor/cda.py
26
Python
0.5
style
184
32
402
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
'id': '19129979', 'title': 'TESTY KOSMETYKÓW', }, 'playlist_count': 139, }] def _real_extract(self, url): folder_id = self._match_id(url) webpage = self._download_webpage(url, folder_id) title = self._html_search_meta('og:tit...
In general, I think I would rewrite this using `OnDemandPagedList`. Should simplify the code and also make it work lazily instead of having to extract all pages in advance.
import base64 import codecs import datetime as dt import hashlib import hmac import json import random import re import urllib.parse from .common import InfoExtractor from ..compat import compat_ord from ..utils import ( ExtractorError, OnDemandPagedList, float_or_none, int_or_none, merge_dicts, ...
@@ -351,3 +351,63 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/[0-9a-zA-Z_]+/folder/(?P<id>[0-9a-z]+)(/vfilm)?' + ...
yt_dlp/extractor/cda.py
26
Python
0.571
refactor
172
36
402
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
for href, resolution in re.findall( r'<a[^>]+data-quality="[^"]+"[^>]+href="([^"]+)"[^>]+class="quality-btn"[^>]*>([0-9]+p)', webpage): if need_confirm_age: handler = self._download_age_confirm_page else: handler = self._dow...
You can add another capturing group ```suggestion _VALID_URL = r'https?://(?:www\.)?cda\.pl/(?P<channel>\w+)/folder/(?P<id>\d+)' ```
r'<a[^>]+data-quality="[^"]+"[^>]+href="([^"]+)"[^>]+class="quality-btn"[^>]*>([0-9]+p)', webpage): if need_confirm_age: handler = self._download_age_confirm_page else: handler = self._download_webpage webpage = handler...
@@ -351,3 +353,56 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _MAX_PAGE_SIZE = 36 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/\w+/folder/(?P<id>\d+)'
yt_dlp/extractor/cda.py
26
Python
0.714
suggestion
139
51
51
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
'id': '31188385', 'title': 'SERIA DRUGA', }, 'playlist_count': 13, }, { 'url': 'https://www.cda.pl/smiechawaTV/folder/2664592/vfilm', 'info_dict': { 'id': '2664592', 'title': 'VideoDowcipy - w...
```suggestion folder_id, channel = self._match_valid_url(url).group('id', 'channel') ```
}, 'playlist_mincount': 13, }, { 'url': 'https://www.cda.pl/smiechawaTV/folder/2664592/vfilm', 'info_dict': { 'id': '2664592', 'title': 'VideoDowcipy - wszystkie odcinki', }, 'playlist_mincount': 71, ...
@@ -351,3 +353,56 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _MAX_PAGE_SIZE = 36 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/\w+/folder/(?P<id>\d+)' + ...
yt_dlp/extractor/cda.py
26
Python
0.571
suggestion
98
44
37
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
}, { 'url': 'https://www.cda.pl/smiechawaTV/folder/2664592/vfilm', 'info_dict': { 'id': '2664592', 'title': 'VideoDowcipy - wszystkie odcinki', }, 'playlist_count': 71, }, { 'url': 'https://www.cd...
Lets inline this ```suggestion ```
'url': 'https://www.cda.pl/smiechawaTV/folder/2664592/vfilm', 'info_dict': { 'id': '2664592', 'title': 'VideoDowcipy - wszystkie odcinki', }, 'playlist_mincount': 71, }, { 'url': 'https://www.cda.pl/DeliciousBeau...
@@ -351,3 +353,56 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _MAX_PAGE_SIZE = 36 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/\w+/folder/(?P<id>\d+)' + ...
yt_dlp/extractor/cda.py
26
Python
0.429
suggestion
36
40
33
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
'title': 'TESTY KOSMETYKÓW', }, 'playlist_count': 139, }] def _real_extract(self, url): folder_id = self._match_id(url) channel_name = self._search_regex( r'cda\.pl/([^/]+)', url, 'channel name') webpage = self._download_webpage(u...
```suggestion return self.playlist_result(entries, folder_id, playlist_title=self._og_search_title(webpage)) ```
import base64 import codecs import datetime as dt import hashlib import hmac import json import random import re import urllib.parse from .common import InfoExtractor from ..compat import compat_ord from ..utils import ( ExtractorError, OnDemandPagedList, float_or_none, int_or_none, merge_dicts, ...
@@ -351,3 +353,56 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _MAX_PAGE_SIZE = 36 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/\w+/folder/(?P<id>\d+)' + ...
yt_dlp/extractor/cda.py
26
Python
0.714
suggestion
122
27
402
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
'playlist_count': 71, }, { 'url': 'https://www.cda.pl/DeliciousBeauty/folder/19129979/vfilm', 'info_dict': { 'id': '19129979', 'title': 'TESTY KOSMETYKÓW', }, 'playlist_count': 139, }] def _real_extr...
```suggestion yield self.url_result(f'https://www.cda.pl/video/{video_id}', CDAIE, video_id) ```
{ 'url': 'https://www.cda.pl/DeliciousBeauty/folder/19129979/vfilm', 'info_dict': { 'id': '19129979', 'title': 'TESTY KOSMETYKÓW', }, 'playlist_mincount': 139, }] def _real_extract(self, url): folder_id, channel...
@@ -351,3 +353,56 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _MAX_PAGE_SIZE = 36 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/\w+/folder/(?P<id>\d+)' + ...
yt_dlp/extractor/cda.py
26
Python
0.714
suggestion
114
33
26
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
'url': 'https://www.cda.pl/DeliciousBeauty/folder/19129979/vfilm', 'info_dict': { 'id': '19129979', 'title': 'TESTY KOSMETYKÓW', }, 'playlist_count': 139, }] def _real_extract(self, url): folder_id = self._match_id(url)...
```suggestion functools.partial(extract_page_entries, channel, folder_id), ```
import base64 import codecs import datetime as dt import hashlib import hmac import json import random import re import urllib.parse from .common import InfoExtractor from ..compat import compat_ord from ..utils import ( ExtractorError, OnDemandPagedList, float_or_none, int_or_none, merge_dicts, ...
@@ -351,3 +353,56 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _MAX_PAGE_SIZE = 36 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/\w+/folder/(?P<id>\d+)' + ...
yt_dlp/extractor/cda.py
26
Python
0.643
refactor
92
30
402
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
'id': '2664592', 'title': 'VideoDowcipy - wszystkie odcinki', }, 'playlist_count': 71, }, { 'url': 'https://www.cda.pl/DeliciousBeauty/folder/19129979/vfilm', 'info_dict': { 'id': '19129979', ...
Need to catch 404s, in case the last page contains 36 videos. ```suggestion webpage = self._download_webpage( f'https://www.cda.pl/{channel_name}/folder/{folder_id}/vfilm/{page + 1}', folder_id, f'Downloading page {page + 1}', expected_status=404) ```
}, 'playlist_mincount': 71, }, { 'url': 'https://www.cda.pl/DeliciousBeauty/folder/19129979/vfilm', 'info_dict': { 'id': '19129979', 'title': 'TESTY KOSMETYKÓW', }, 'playlist_mincount': 139, }...
@@ -351,3 +353,56 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_NUMBER = 200 + _MAX_PAGE_SIZE = 36 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/\w+/folder/(?P<id>\d+)' + ...
yt_dlp/extractor/cda.py
26
Python
0.786
suggestion
300
36
29
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
seproDev
pktiuk
{ 'url': 'https://www.cda.pl/DeliciousBeauty/folder/19129979/vfilm', 'info_dict': { 'id': '19129979', 'title': 'TESTY KOSMETYKÓW', }, 'playlist_count': 139, }] def _real_extract(self, url): folder_id, channel = ...
The variables can be captured so we can use them directly instead. That way we also do not need `functools` anymore: ```suggestion def extract_page_entries(page): webpage = self._download_webpage( f'https://www.cda.pl/{channel}/folder/{folder_id}/vfilm/{page + 1}', folder_id, ...
import base64 import codecs import datetime as dt import hashlib import hmac import json import random import re import urllib.parse from .common import InfoExtractor from ..compat import compat_ord from ..utils import ( ExtractorError, OnDemandPagedList, float_or_none, int_or_none, merge_dicts, ...
@@ -351,3 +353,52 @@ def extract_format(page, version): extract_format(webpage, resolution) return merge_dicts(info_dict, info) + + +class CDAFolderIE(InfoExtractor): + _MAX_PAGE_SIZE = 36 + _VALID_URL = r'https?://(?:www\.)?cda\.pl/(?P<channel>\w+)/folder/(?P<id>\d+)' + _TESTS = [ + ...
yt_dlp/extractor/cda.py
26
Python
0.857
refactor
690
28
402
false
[ie/cda] Support folders
10,786
yt-dlp/yt-dlp
132,642
Python
Grub4K
pktiuk
data) return js_to_json(data) def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) title = self._html_search_meta( 'twitter:title', webpage, display_name='title', fatal=True) f, config = se...
if we flip-flop the order of JSON parsing we can simplify this ```suggestion config = self._parse_json( config, video_id, lambda data: self.__unobfuscate(data, video_id=video_id)) f = config.get('file') if not f else self._parse_json( f, video_id, l...
if data.startswith('{'): data = self._RX_OBFUSCATION.sub( lambda m: json.dumps( base64.b64decode(urllib.parse.unquote( ''.join(self._parse_json(m.group(1), video_id)), )).decode('iso-8859-1')), data) ...
@@ -49,18 +59,21 @@ def _real_extract(self, url): f, config = self._search_regex( r'''(?sx) - var\s+f\s*=\s*(?P<f>".*?"|{[^;]+?});\s* + (var\s+f\s*=\s*(?P<f>".*?"|{[^;]+?});\s*)? var\s+player1\s+=\s+new\s+RTPPlayer\s*\((?P<config>{(?:(?!\*/).)+?})\)...
yt_dlp/extractor/rtp.py
26
Python
0.857
refactor
381
51
51
false
[ie/RTP] Support more subpages
10,787
yt-dlp/yt-dlp
132,642
Python
bashonly
Demon000
_RX_OBFUSCATION = re.compile(r'''(?xs) atob\s*\(\s*decodeURIComponent\s*\(\s* (\[[0-9A-Za-z%,'"]*\]) \s*\.\s*join\(\s*(?:""|'')\s*\)\s*\)\s*\) ''') def __unobfuscate(self, data, *, video_id): if data.startswith('{'): data = self._RX_OBFUSCATION.sub( ...
non-capturing group ```suggestion (?:var\s+f\s*=\s*(?P<f>".*?"|{[^;]+?});\s*)? ```
'only_matching': True, }, { 'url': 'https://www.rtp.pt/play/palco/p13785/l7nnon', 'only_matching': True, }] _RX_OBFUSCATION = re.compile(r'''(?xs) atob\s*\(\s*decodeURIComponent\s*\(\s* (\[[0-9A-Za-z%,'"]*\]) \s*\.\s*join\(\s*(?:""|'')\s*\)\s*\)\s*\) ...
@@ -49,18 +59,21 @@ def _real_extract(self, url): f, config = self._search_regex( r'''(?sx) - var\s+f\s*=\s*(?P<f>".*?"|{[^;]+?});\s* + (var\s+f\s*=\s*(?P<f>".*?"|{[^;]+?});\s*)?
yt_dlp/extractor/rtp.py
26
Python
0.714
suggestion
101
51
51
false
[ie/RTP] Support more subpages
10,787
yt-dlp/yt-dlp
132,642
Python
bashonly
Demon000
import base64 import json import re import urllib.parse from .common import InfoExtractor from ..utils import js_to_json class RTPIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?rtp\.pt/play(/zigzag)?/p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)/?' _TESTS = [{ 'url': 'http://www.rtp.pt/play/p405/e174...
```suggestion _VALID_URL = r'https?://(?:www\.)?rtp\.pt/play/(?:zigzag/)?p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)/?' ```
import base64 import json import re import urllib.parse from .common import InfoExtractor from ..utils import js_to_json class RTPIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?rtp\.pt/play/(?:(?:estudoemcasa|palco|zigzag)/)?p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'http://ww...
@@ -8,7 +8,7 @@ class RTPIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?rtp\.pt/play/p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)/?' + _VALID_URL = r'https?://(?:www\.)?rtp\.pt/play(/zigzag)?/p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)/?'
yt_dlp/extractor/rtp.py
11
Python
0.714
suggestion
125
36
36
false
[ie/RTP] Support more subpages
10,787
yt-dlp/yt-dlp
132,642
Python
bashonly
Demon000
import base64 import json import re import urllib.parse from .common import InfoExtractor from ..utils import js_to_json class RTPIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?rtp\.pt/play/(?:zigzag/)?p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)/?' _TESTS = [{ 'url': 'http://www.rtp.pt/play/p405/e1...
Can you add `estudoemcasa` and `palco` as well? ```suggestion _VALID_URL = r'https?://(?:www\.)?rtp\.pt/play/(?:(?:estudoemcasa|palco|zigzag)/)?p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)' ``` Please also add appropriate tests. match_only is fine. - https://www.rtp.pt/play/estudoemcasa/p7776/portugues-1-ano - h...
import base64 import json import re import urllib.parse from .common import InfoExtractor from ..utils import js_to_json class RTPIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?rtp\.pt/play/(?:(?:estudoemcasa|palco|zigzag)/)?p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'http://ww...
@@ -8,7 +8,7 @@ class RTPIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?rtp\.pt/play/p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)/?' + _VALID_URL = r'https?://(?:www\.)?rtp\.pt/play/(?:zigzag/)?p(?P<program_id>[0-9]+)/(?P<id>[^/?#]+)/?'
yt_dlp/extractor/rtp.py
11
Python
0.786
suggestion
362
36
36
false
[ie/RTP] Support more subpages
10,787
yt-dlp/yt-dlp
132,642
Python
seproDev
Demon000
data = self._RX_OBFUSCATION.sub( lambda m: json.dumps( base64.b64decode(urllib.parse.unquote( ''.join(self._parse_json(m.group(1), video_id)), )).decode('iso-8859-1')), data) return js_to_json(data) ...
```suggestion f = config['file'] if not f else self._parse_json( ```
data = self._RX_OBFUSCATION.sub( lambda m: json.dumps( base64.b64decode(urllib.parse.unquote( ''.join(self._parse_json(m.group(1), video_id)), )).decode('iso-8859-1')), data) return js_to_json(data) ...
@@ -49,17 +65,17 @@ def _real_extract(self, url): f, config = self._search_regex( r'''(?sx) - var\s+f\s*=\s*(?P<f>".*?"|{[^;]+?});\s* + (?:var\s+f\s*=\s*(?P<f>".*?"|{[^;]+?});\s*)? var\s+player1\s+=\s+new\s+RTPPlayer\s*\((?P<config>{(?:(?!\*/).)+?})...
yt_dlp/extractor/rtp.py
26
Python
0.571
suggestion
78
51
51
false
[ie/RTP] Support more subpages
10,787
yt-dlp/yt-dlp
132,642
Python
bashonly
Demon000
'live_status': 'was_live', }, 'params': { 'skip_download': True, 'ignore_no_formats_error': True, }, }, { 'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_hK9aXHKf3k3F3bY5eoHFQxu68TC6krJdu0GVBVbVy01IwpJ...
```suggestion if player_data_url.startswith(PIAULIZAPortalAPIIE.BASE_URL): ```
_VALID_URL = r'https?://player\.pia-live\.jp/stream/(?P<id>[\w-]+)' _PLAYER_ROOT_URL = 'https://player.pia-live.jp/' _PIA_LIVE_API_URL = 'https://api.pia-live.jp' _API_KEY = 'kfds)FKFps-dms9e' _TESTS = [{ 'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_hK9aXHKf3k3F3bY5eoHFQxu68TC6krUD...
@@ -0,0 +1,86 @@ +from .common import InfoExtractor +from .piaulizaportal import PIAULIZAPortalAPIIE +from ..utils import ExtractorError, multipart_encode, smuggle_url + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_U...
yt_dlp/extractor/pialive.py
26
Python
0.571
suggestion
88
51
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
ChocoLZS
def handle_embed_player(self, player_tag, video_id, info_dict={}): player_data_url = self._search_regex([PIAULIZAPortalAPIIE.TAG_REGEX_PATTERN], player_tag, 'player data url', fatal=False) if PIAULIZAPortalAPIIE.BASE_URL in player_data_url: r...
Compat lines: ```suggestion prod_configure = self._download_webpage( self.PLAYER_ROOT_URL + self._search_regex(r'<script [^>]*\bsrc="(/statics/js/s_prod[^"]+)"', webpage, 'prod configure page'), program_code, headers={'Referer': self.PLAYER_ROOT_URL}, note='Fetching pr...
'info_dict': { 'id': '9ce8b8ba-f6d1-4d1f-83a0-18c3148ded93', 'display_id': '2431867_002', 'title': 'こながめでたい日2024の視聴ページ | PIA LIVE STREAM(ぴあライブストリーム)', 'live_status': 'was_live', 'comment_count': int, }, 'params': { 'getcomme...
@@ -0,0 +1,86 @@ +from .common import InfoExtractor +from .piaulizaportal import PIAULIZAPortalAPIIE +from ..utils import ExtractorError, multipart_encode, smuggle_url + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_U...
yt_dlp/extractor/pialive.py
26
Python
0.786
suggestion
402
50
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
ChocoLZS
def _real_extract(self, url): video_key = self._match_id(url) webpage = self._download_webpage(url, video_key) program_code = self._search_regex(r"const programCode = '(.*?)';", webpage, 'program code') prod_configure = self._download_webpage( self.PLAYER_ROOT_URL + sel...
Ditto. ```suggestion player_tag_list = self._download_json( f'{self.PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}', program_code, data=payload, headers={'Content-Type': content_type}, ) ```
def _extract_var(self, variable, html): return self._search_regex( rf'(?:var|const|let)\s+{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1', html, f'variable {variable}', group='value') def _real_extract(self, url): video_key = self._match_id(url) webpage = sel...
@@ -0,0 +1,86 @@ +from .common import InfoExtractor +from .piaulizaportal import PIAULIZAPortalAPIIE +from ..utils import ExtractorError, multipart_encode, smuggle_url + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_U...
yt_dlp/extractor/pialive.py
26
Python
0.929
suggestion
245
36
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
ChocoLZS
'title': 'こながめでたい日2024の視聴ページ | PIA LIVE STREAM(ぴあライブストリーム)', 'live_status': 'was_live', 'comment_count': 1000, }, 'params': { 'skip_download': True, 'ignore_no_formats_error': True, }, }, ...
The embed players on these five platforms are either scripts or iframes, and they all have a `src` attribute.
class PiaLiveIE(InfoExtractor): _VALID_URL = r'https?://player\.pia-live\.jp/stream/(?P<id>[\w-]+)' _PLAYER_ROOT_URL = 'https://player.pia-live.jp/' _PIA_LIVE_API_URL = 'https://api.pia-live.jp' _API_KEY = 'kfds)FKFps-dms9e' _TESTS = [{ 'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_...
@@ -36,8 +38,7 @@ class PiaLiveIE(InfoExtractor): ] def handle_embed_player(self, player_tag, video_id, info_dict={}): - player_data_url = self._search_regex([PIAULIZAPortalAPIIE.TAG_REGEX], - player_tag, 'player data url', fatal=False) + player_data...
yt_dlp/extractor/pialive.py
26
Python
0.5
suggestion
109
51
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
ChocoLZS
ChocoLZS
program_code = self._search_regex(r"const programCode = '(.*?)';", webpage, 'program code') prod_configure = self._download_webpage( self.PLAYER_ROOT_URL + self._search_regex(r'<script [^>]*\bsrc="(/statics/js/s_prod[^"]+)"', webpage, 'prod configure page'), program_code, header...
`f'{self.PLAYER_ROOT_URL}/'}` , The trailing slash at the end is to ensure the correct Referer and prevent a 403 error.
def _real_extract(self, url): video_key = self._match_id(url) webpage = self._download_webpage(url, video_key) program_code = self._extract_var('programCode', webpage) article_code = self._extract_var('articleCode', webpage) title = self._html_extract_title(webpage) ...
@@ -71,11 +72,32 @@ def _real_extract(self, url): program_code, data=payload, headers={'Content-Type': content_type, 'Referer': self.PLAYER_ROOT_URL}, ) + article_code = self._search_regex(r"const articleCode = '(.*?)';", webpage, 'article code') + chat_info = self._download_json( ...
yt_dlp/extractor/pialive.py
26
Python
0.643
suggestion
119
48
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
ChocoLZS
ChocoLZS
from .common import InfoExtractor from ..utils import extract_attributes, multipart_encode, traverse_obj, url_or_none class PiaLiveIE(InfoExtractor): PLAYER_ROOT_URL = 'https://player.pia-live.jp/' PIA_LIVE_API_URL = 'https://api.pia-live.jp' _VALID_URL = r'https?://player\.pia-live\.jp/stream/(?P<id>[\w-...
```suggestion from ..utils import extract_attributes, multipart_encode, url_or_none from ..utils.traversal import traverse_obj ```
from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, extract_attributes, get_element_by_class, get_element_html_by_class, multipart_encode, str_or_none, unified_timestamp, url_or_none, ) from ..utils.traversal import traverse_obj class PiaLiveIE(InfoE...
@@ -0,0 +1,96 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, multipart_encode, traverse_obj, url_or_none
yt_dlp/extractor/pialive.py
2
Python
0.786
refactor
133
27
27
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
ChocoLZS
chat_room_url = traverse_obj(self._download_json( f'{self.PIA_LIVE_API_URL}/perf/chat-tag-list/{program_code}/{article_code}', program_code, data=payload, headers={'Content-Type': content_type, 'Referer': self.PLAYER_ROOT_URL}, note='Fetching chat info', errnote='Unable to fe...
```suggestion yield from traverse_obj(self._search_json( r'var\s+_history\s*=', comment_page, 'comment list', video_id, contains_pattern=r'\[(?s:.+)\]', fatal=False), (..., { 'timestamp': 0, 'author_is_uploader': (1, {lambda x: x =...
r'(?P<date>\d{4}/\d{1,2}/\d{1,2})\([月火水木金土日]\)(?P<time>\d{2}:\d{2})', start_info, 'start_info', fatal=False, group=('date', 'time')) if date and time: release_timestamp_str = f'{date} {time} +09:00' release_timestamp = unified_timestamp(release...
@@ -0,0 +1,96 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, multipart_encode, traverse_obj, url_or_none + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp/' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_URL = r'https?://player\.pia-li...
yt_dlp/extractor/pialive.py
26
Python
0.786
security
448
27
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
ChocoLZS
from .pearvideo import PearVideoIE from .peekvids import ( PeekVidsIE, PlayVidsIE, ) from .peertube import ( PeerTubeIE, PeerTubePlaylistIE, ) from .peertv import PeerTVIE from .peloton import ( PelotonIE, PelotonLiveIE, ) from .performgroup import PerformGroupIE from .periscope import ( Per...
```suggestion from .piaulizaportal import ( PIAULIZAPortalAPIIE, PIAULIZAPortalIE, ) ```
from .parler import ParlerIE from .parlview import ParlviewIE from .patreon import ( PatreonCampaignIE, PatreonIE, ) from .pbs import ( PBSIE, PBSKidsIE, ) from .pearvideo import PearVideoIE from .peekvids import ( PeekVidsIE, PlayVidsIE, ) from .peertube import ( PeerTubeIE, PeerTubePla...
@@ -1510,8 +1510,9 @@ from .philharmoniedeparis import PhilharmonieDeParisIE from .phoenix import PhoenixIE from .photobucket import PhotobucketIE +from .pialive import PiaLiveIE from .piapro import PiaproIE -from .piaulizaportal import PIAULIZAPortalIE +from .piaulizaportal import PIAULIZAPortalAPIIE, PIAULIZAPort...
yt_dlp/extractor/_extractors.py
26
Python
0.714
suggestion
101
51
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
ChocoLZS
'getcomments': True, 'skip_download': True, 'ignore_no_formats_error': True, }, }, { 'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_hK9aXHKf3k3F3bY5eoHFQxu68TC6krJdu0GVBVbVy01IwpJ6J3qBEm3d9TCTt1d0eWpsZGj7DrOjVOmS7GAWGwyscMgi...
We want this to be fatal, no? ```suggestion html, f'variable {variable}', group='value') ```
'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_hK9aXHKf3k3F3bY5eoHFQxu68TC6krUDqGOwN4d61dCWQYOd6CTxl4hjya9dsfEZGsM4uGOUdax60lEI4twsXGXf7crmz8Gk__GhupTrWxA7RFRVt76', 'info_dict': { 'id': '88f3109a-f503-4d0f-a9f7-9f39ac745d84', 'display_id': '2431867_001', 'titl...
@@ -0,0 +1,97 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, multipart_encode, url_or_none +from ..utils.traversal import traverse_obj + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp/' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_U...
yt_dlp/extractor/pialive.py
26
Python
0.714
suggestion
107
51
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
seproDev
ChocoLZS
'params': { 'getcomments': True, 'skip_download': True, 'ignore_no_formats_error': True, }, }, { 'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_hK9aXHKf3k3F3bY5eoHFQxu68TC6krJdu0GVBVbVy01IwpJ6J3qBEm3d9TCTt1d0eWps...
Just in case they start using `let` in the future ```suggestion rf'(?:var|const|let)\s+{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1', ```
_TESTS = [{ 'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_hK9aXHKf3k3F3bY5eoHFQxu68TC6krUDqGOwN4d61dCWQYOd6CTxl4hjya9dsfEZGsM4uGOUdax60lEI4twsXGXf7crmz8Gk__GhupTrWxA7RFRVt76', 'info_dict': { 'id': '88f3109a-f503-4d0f-a9f7-9f39ac745d84', 'display_id': '2431867_001', ...
@@ -0,0 +1,97 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, multipart_encode, url_or_none +from ..utils.traversal import traverse_obj + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp/' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_U...
yt_dlp/extractor/pialive.py
26
Python
0.714
suggestion
157
51
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
seproDev
ChocoLZS
'getcomments': True, 'skip_download': True, 'ignore_no_formats_error': True, }, }, ] def _extract_vars(self, variable, html): return self._search_regex( rf'(?:var|const)\s+{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1',...
That appended date is just for cache busting. Imo. we don't need to extract the exact date the website uses from the HTML. Actually, since the APIKEY has been unchanged [since 2022](https://web.archive.org/web/20221208024332id_/https://player.pia-live.jp/statics/js/s_prod?202211082), I'd just hardcode the api key an...
'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_hK9aXHKf3k3F3bY5eoHFQxu68TC6krJdu0GVBVbVy01IwpJ6J3qBEm3d9TCTt1d0eWpsZGj7DrOjVOmS7GAWGwyscMgiThopJvzgWC4H5b-7XQjAfRZ', 'info_dict': { 'id': '9ce8b8ba-f6d1-4d1f-83a0-18c3148ded93', 'display_id': '2431867_002', 'titl...
@@ -0,0 +1,97 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, multipart_encode, url_or_none +from ..utils.traversal import traverse_obj + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp/' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_U...
yt_dlp/extractor/pialive.py
26
Python
0.857
performance
431
51
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
seproDev
ChocoLZS
}, }, ] def _extract_vars(self, variable, html): return self._search_regex( rf'(?:var|const)\s+{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1', html, 'variable', group='value', default=None) def _real_extract(self, url): video_key = self._matc...
```suggestion 'api_key': 'kfds)FKFps-dms9e') ```
'display_id': '2431867_002', 'title': 'こながめでたい日2024の視聴ページ | PIA LIVE STREAM(ぴあライブストリーム)', 'live_status': 'was_live', 'comment_count': int, }, 'params': { 'getcomments': True, 'skip_download': True, 'ignore_no_formats_err...
@@ -0,0 +1,97 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, multipart_encode, url_or_none +from ..utils.traversal import traverse_obj + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp/' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_U...
yt_dlp/extractor/pialive.py
26
Python
0.571
suggestion
62
51
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
seproDev
ChocoLZS
webpage = self._download_webpage(url, video_key) program_code = self._extract_vars('programCode', webpage) article_code = self._extract_vars('articleCode', webpage) prod_configure = self._download_webpage( self.PLAYER_ROOT_URL + self._search_regex( r'<script...
Maybe bar this behind a check to not always make the additional request? ```py if self.get_param('getcomments'): ``` I am not sure if there is a cleaner way to do this without passing all vars to `_get_comments`.
}] def _extract_var(self, variable, html): return self._search_regex( rf'(?:var|const|let)\s+{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1', html, f'variable {variable}', group='value') def _real_extract(self, url): video_key = self._match_id(url) webpag...
@@ -0,0 +1,97 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, multipart_encode, url_or_none +from ..utils.traversal import traverse_obj + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp/' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_U...
yt_dlp/extractor/pialive.py
26
Python
0.786
suggestion
216
48
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
seproDev
ChocoLZS
return self._search_regex( rf'(?:var|const)\s+{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1', html, 'variable', group='value', default=None) def _real_extract(self, url): video_key = self._match_id(url) webpage = self._download_webpage(url, video_key) pr...
Should we catch 404s for expired URLs/URLs that require login and give a better warning?
'params': { 'getcomments': True, 'skip_download': True, 'ignore_no_formats_error': True, }, 'skip': 'The video is no longer available', }] def _extract_var(self, variable, html): return self._search_regex( rf'(?:var|const|let)\s+{v...
@@ -0,0 +1,97 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, multipart_encode, url_or_none +from ..utils.traversal import traverse_obj + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp/' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + _VALID_U...
yt_dlp/extractor/pialive.py
26
Python
0.286
question
88
51
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
seproDev
ChocoLZS
'live_status': 'was_live', 'comment_count': int, }, 'params': { 'getcomments': True, 'skip_download': True, 'ignore_no_formats_error': True, }, }, ] def _extract_vars(self, variable, html...
I think this is a wrong style change by 04f1bfde504f16d266681d8f39d58cf96b7450e6. ```suggestion payload, content_type = multipart_encode({ 'play_url': video_key, 'api_key': self.API_KEY, }) ``` ` 'foo': bar})` looks awkward.
}, 'skip': 'The video is no longer available', }, { 'url': 'https://player.pia-live.jp/stream/4JagFBEIM14s_hK9aXHKf3k3F3bY5eoHFQxu68TC6krJdu0GVBVbVy01IwpJ6J3qBEm3d9TCTt1d0eWpsZGj7DrOjVOmS7GAWGwyscMgiThopJvzgWC4H5b-7XQjAfRZ', 'info_dict': { 'id': '9ce8b8ba-f6d1-4d1f-83a0-1...
@@ -0,0 +1,91 @@ +from .common import InfoExtractor +from ..utils import extract_attributes, multipart_encode, url_or_none +from ..utils.traversal import traverse_obj + + +class PiaLiveIE(InfoExtractor): + PLAYER_ROOT_URL = 'https://player.pia-live.jp/' + PIA_LIVE_API_URL = 'https://api.pia-live.jp' + API_KEY ...
yt_dlp/extractor/pialive.py
26
Python
1
bug
280
51
51
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
ChocoLZS
'video_id': program_code, 'data': payload, 'headers': {'Content-Type': content_type, 'Referer': self.PLAYER_ROOT_URL}, } player_tag_list = self._download_json( f'{self.PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}', **api_kwargs, note=...
```suggestion chat_room_url, video_id, headers={'Referer': self.PLAYER_ROOT_URL}, ```
player_tag_list = self._download_json( f'{self._PIA_LIVE_API_URL}/perf/player-tag-list/{program_code}', program_code, 'Fetching player tag list', 'Unable to fetch player tag list', **api_data_and_headers) return self.url_result( extract_attributes(player_tag_list['d...
@@ -0,0 +1,127 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + extract_attributes, + get_element_by_class, + get_element_html_by_class, + multipart_encode, + unified_timestamp, + url_or_none, +) +from ..utils.traversal import traverse_obj + + +class...
yt_dlp/extractor/pialive.py
26
Python
0.714
suggestion
103
37
32
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
seproDev
ChocoLZS
start_info, 'start_info', fatal=False, group=('date', 'time')) if all((date, time)): release_timestamp_str = f'{date} {time} +09:00' release_timestamp = unified_timestamp(release_timestamp_str) self.raise_no_formats(f'The video will be availabl...
I'd move the initialization in front instead of having the else statement. ```suggestion chat_room_url = None if self.get_param('getcomments'): ```
release_timestamp = unified_timestamp(release_timestamp_str) self.raise_no_formats(f'The video will be available after {release_timestamp_str}', expected=True) return { 'id': program_code, 'title': title, 'live_s...
@@ -0,0 +1,127 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + extract_attributes, + get_element_by_class, + get_element_html_by_class, + multipart_encode, + unified_timestamp, + url_or_none, +) +from ..utils.traversal import traverse_obj + + +class...
yt_dlp/extractor/pialive.py
26
Python
0.786
suggestion
167
51
49
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
seproDev
ChocoLZS
'release_timestamp': release_timestamp, } payload, content_type = multipart_encode({ 'play_url': video_key, 'api_key': self.API_KEY, }) api_kwargs = { 'video_id': program_code, 'data': payload, 'head...
Can the returned URL be for different sites, or is this also always `PIAULIZAPortalAPIIE`?
payload, content_type = multipart_encode({ 'play_url': video_key, 'api_key': self._API_KEY, }) api_data_and_headers = { 'data': payload, 'headers': {'Content-Type': content_type, 'Referer': self._PLAYER_ROOT_URL}, } player_tag_list...
@@ -0,0 +1,127 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + clean_html, + extract_attributes, + get_element_by_class, + get_element_html_by_class, + multipart_encode, + unified_timestamp, + url_or_none, +) +from ..utils.traversal import traverse_obj + + +class...
yt_dlp/extractor/pialive.py
26
Python
0.357
question
90
45
40
false
[ie/PiaLive] Add extractor
10,811
yt-dlp/yt-dlp
132,642
Python
seproDev
ChocoLZS