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
'formats': formats, } teams = orderedSet(traverse_obj(json_data, ('teams', ..., 'shortcut', {str}))) if len(teams) > 2 and 'FIN' in teams: teams.remove('FIN') data['title'] = join_nonempty(join_nonempty(*teams, delim='-'), f"(...
just formatting ```suggestion return self._call_api( f'match/by-team-id-paginated/{playlist_id}', playlist_id, query={'page': page + 1, 'take': self._PAGE_SIZE, 'order': 'DESC'}) ```
})) data = { 'id': video_id, **traverse_obj(json_data, { 'series': ('competition_name', {str}), 'season': ('season', {str}), 'timestamp': ('match_time', {unified_timestamp}), 'categories': ('category', ('title')...
@@ -1,40 +1,148 @@ +import functools + from .common import InfoExtractor +from ..utils import ( + InAdvancePagedList, + int_or_none, + join_nonempty, + orderedSet, + str_or_none, + strftime_or_none, + traverse_obj, + unified_timestamp, + url_or_none, +) + + +class VolejTVBaseIE(InfoExtractor...
yt_dlp/extractor/volejtv.py
26
Python
0.786
suggestion
219
51
51
false
[ie/volejtv] Fix and add extractors
13,226
yt-dlp/yt-dlp
132,642
Python
bashonly
subrat-lima
teams.remove('FIN') data['title'] = join_nonempty(join_nonempty(*teams, delim='-'), f"({strftime_or_none(data['timestamp'], '%Y-%m-%d')})", delim=' ') return data class VolejTVClubPlaylistIE(VolejTVBaseIE): IE_NAME = 'volejtv:club' _VALID_URL =...
```suggestion for entry in traverse_obj(entries, ('data', lambda _, v: v['id'])): ```
**traverse_obj(json_data, { 'series': ('competition_name', {str}), 'season': ('season', {str}), 'timestamp': ('match_time', {unified_timestamp}), 'categories': ('category', ('title'), {str}, filter, all, filter), 'thumbnail': ('...
@@ -1,40 +1,148 @@ +import functools + from .common import InfoExtractor +from ..utils import ( + InAdvancePagedList, + int_or_none, + join_nonempty, + orderedSet, + str_or_none, + strftime_or_none, + traverse_obj, + unified_timestamp, + url_or_none, +) + + +class VolejTVBaseIE(InfoExtractor...
yt_dlp/extractor/volejtv.py
26
Python
0.571
suggestion
95
51
51
false
[ie/volejtv] Fix and add extractors
13,226
yt-dlp/yt-dlp
132,642
Python
bashonly
subrat-lima
def _real_extract(self, url): playlist_id = self._match_id(url) title = self._call_api(f'team/show/{playlist_id}', playlist_id)['title'] first_page_data = self._get_page(playlist_id, 0) total_pages = traverse_obj(first_page_data, ('meta', 'pageCount', {int})) return self.play...
```suggestion return self._call_api( f'match/by-category-id-paginated/{playlist_id}', playlist_id, query={'page': page + 1, 'take': self._PAGE_SIZE, 'order': 'DESC'}) ```
query={'page': page + 1, 'take': self._PAGE_SIZE, 'order': 'DESC'}) def _entries(self, playlist_id, first_page_data, page): entries = first_page_data if page == 0 else self._get_page(playlist_id, page) for match_id in traverse_obj(entries, ('data', ..., 'id')): yield self.ur...
@@ -1,40 +1,148 @@ +import functools + from .common import InfoExtractor +from ..utils import ( + InAdvancePagedList, + int_or_none, + join_nonempty, + orderedSet, + str_or_none, + strftime_or_none, + traverse_obj, + unified_timestamp, + url_or_none, +) + + +class VolejTVBaseIE(InfoExtractor...
yt_dlp/extractor/volejtv.py
26
Python
0.786
suggestion
206
42
51
false
[ie/volejtv] Fix and add extractors
13,226
yt-dlp/yt-dlp
132,642
Python
bashonly
subrat-lima
import functools from .common import InfoExtractor from ..utils import ( InAdvancePagedList, int_or_none, join_nonempty, orderedSet, str_or_none, strftime_or_none, traverse_obj, unified_timestamp, url_or_none, ) class VolejTVBaseIE(InfoExtractor): TBR_HEIGHT_MAPPING = {'6000':...
we can filter for the necessary keys, and we already know `playlist_Id` is a string ```suggestion def _get_category(self, playlist_id): categories = self._call_api('category', playlist_id) for category in traverse_obj(categories, lambda _, v: v['slug'] and v['id'] and v['title']): i...
first_page_data = self._get_page(playlist_id, 0) total_pages = traverse_obj(first_page_data, ('meta', 'pageCount', {int}, {require('page count')})) return self.playlist_result(InAdvancePagedList( functools.partial(self._entries, playlist_id, first_page_data), total_pages,...
@@ -1,40 +1,148 @@ +import functools + from .common import InfoExtractor +from ..utils import ( + InAdvancePagedList, + int_or_none, + join_nonempty, + orderedSet, + str_or_none, + strftime_or_none, + traverse_obj, + unified_timestamp, + url_or_none, +) + + +class VolejTVBaseIE(InfoExtractor...
yt_dlp/extractor/volejtv.py
26
Python
0.786
suggestion
417
149
36
false
[ie/volejtv] Fix and add extractors
13,226
yt-dlp/yt-dlp
132,642
Python
bashonly
subrat-lima
_TESTS = [{ 'url': 'https://volej.tv/kategorie/chance-cesky-pohar', 'info_dict': { 'id': 'chance-cesky-pohar', 'title': 'Chance Český pohár', }, 'playlist_mincount': 30, }] _PAGE_SIZE = 10 def _get_page(self, playlist_id, page): return sel...
let's `require` the page count (import `require` from `..utils.traversal`) ```suggestion total_pages = traverse_obj(first_page_data, ('meta', 'pageCount', {int}, {require('page count')})) return self.playlist_result(InAdvancePagedList( ```
'info_dict': { 'id': '1173', 'title': 'VK Jihostroj České Budějovice', }, 'playlist_mincount': 30, }] _API_FILTER = 'by-team-id-paginated' _PAGE_SIZE = 6 def _real_extract(self, url): playlist_id = self._match_id(url) title = self._call_ap...
@@ -1,40 +1,148 @@ +import functools + from .common import InfoExtractor +from ..utils import ( + InAdvancePagedList, + int_or_none, + join_nonempty, + orderedSet, + str_or_none, + strftime_or_none, + traverse_obj, + unified_timestamp, + url_or_none, +) + + +class VolejTVBaseIE(InfoExtractor...
yt_dlp/extractor/volejtv.py
26
Python
0.786
suggestion
261
29
48
false
[ie/volejtv] Fix and add extractors
13,226
yt-dlp/yt-dlp
132,642
Python
bashonly
subrat-lima
import functools from .common import InfoExtractor from ..utils import ( InAdvancePagedList, int_or_none, join_nonempty, orderedSet, str_or_none, strftime_or_none, traverse_obj, unified_timestamp, url_or_none, ) class VolejTVBaseIE(InfoExtractor): TBR_HEIGHT_MAPPING = {'6000':...
```suggestion str_or_none, strftime_or_none, unified_timestamp, url_or_none, ) from ..utils.traversal import require, traverse_obj ```
import functools from .common import InfoExtractor from ..utils import ( InAdvancePagedList, int_or_none, join_nonempty, orderedSet, str_or_none, strftime_or_none, unified_timestamp, url_or_none, ) from ..utils.traversal import ( require, traverse_obj, ) class VolejTVBaseIE(In...
@@ -1,40 +1,148 @@ +import functools + from .common import InfoExtractor +from ..utils import ( + InAdvancePagedList, + int_or_none, + join_nonempty, + orderedSet, + str_or_none, + strftime_or_none, + traverse_obj, + unified_timestamp, + url_or_none, +)
yt_dlp/extractor/volejtv.py
13
Python
0.714
suggestion
157
38
38
false
[ie/volejtv] Fix and add extractors
13,226
yt-dlp/yt-dlp
132,642
Python
bashonly
subrat-lima
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, str_or_none, traverse_obj, update_url, ) class PicartoIE(InfoExtractor): IE_NAME = 'picarto:base' _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[^/#?]+)$' _TEST = { 'url': 'https://pi...
"base" could be misinterpreted to mean a baseclass ```suggestion IE_NAME = 'picarto' ```
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, str_or_none, traverse_obj, update_url, ) class PicartoIE(InfoExtractor): IE_NAME = 'picarto' _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[^/#?]+)/?(?:$|[?#])' _TEST = { 'url': 'http...
@@ -10,7 +10,8 @@ class PicartoIE(InfoExtractor): - _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[a-zA-Z0-9]+)' + IE_NAME = 'picarto:base'
yt_dlp/extractor/picarto.py
13
Python
0.643
suggestion
95
38
38
false
[ie/picarto:vod] Support `/profile/` video URLs
13,227
yt-dlp/yt-dlp
132,642
Python
bashonly
subrat-lima
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, str_or_none, traverse_obj, update_url, ) class PicartoIE(InfoExtractor): IE_NAME = 'picarto:base' _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[^/#?]+)$' _TEST = { 'url': 'https://pi...
```suggestion _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[^/#?]+)/?(?:$|[?#])' ``` any specific reason for changing `[a-zA-Z0-9]+` to `[^/#?]+` ? if you have evidence that the former is insufficent please add an `only_matching` test
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, str_or_none, traverse_obj, update_url, ) class PicartoIE(InfoExtractor): IE_NAME = 'picarto' _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[^/#?]+)/?(?:$|[?#])' _TEST = { 'url': 'http...
@@ -10,7 +10,8 @@ class PicartoIE(InfoExtractor): - _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[a-zA-Z0-9]+)' + IE_NAME = 'picarto:base' + _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[^/#?]+)$'
yt_dlp/extractor/picarto.py
14
Python
0.786
suggestion
248
39
39
false
[ie/picarto:vod] Support `/profile/` video URLs
13,227
yt-dlp/yt-dlp
132,642
Python
bashonly
subrat-lima
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, str_or_none, traverse_obj, update_url, ) class PicartoIE(InfoExtractor): IE_NAME = 'picarto' _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[a-zA-Z0-9]+)/?(?:$|[?#])' _TEST = { 'url': ...
you didn't have to revert to `[a-zA-Z0-9]+`, I was just curious ```suggestion _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[^/#?]+)/?(?:$|[?#])' ```
import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, str_or_none, traverse_obj, update_url, ) class PicartoIE(InfoExtractor): IE_NAME = 'picarto' _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[^/#?]+)/?(?:$|[?#])' _TEST = { 'url': 'http...
@@ -10,8 +10,8 @@ class PicartoIE(InfoExtractor): - IE_NAME = 'picarto:base' - _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[^/#?]+)$' + IE_NAME = 'picarto' + _VALID_URL = r'https?://(?:www.)?picarto\.tv/(?P<id>[a-zA-Z0-9]+)/?(?:$|[?#])'
yt_dlp/extractor/picarto.py
14
Python
0.714
suggestion
162
39
39
false
[ie/picarto:vod] Support `/profile/` video URLs
13,227
yt-dlp/yt-dlp
132,642
Python
bashonly
subrat-lima
from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, parse_resolution, qualities, url_or_none, ) from ..utils.traversal import traverse_obj class AppleConnectIE(InfoExtractor): IE_NAME = 'apple:music:connect' IE_DESC = 'Apple Music Connect' _HEADERS =...
This expires in 2 months. Can't we extract it?
import time from .common import InfoExtractor from ..utils import ( ExtractorError, extract_attributes, float_or_none, jwt_decode_hs256, jwt_encode, parse_resolution, qualities, unified_strdate, update_url, url_or_none, urljoin, ) from ..utils.traversal import ( find_ele...
@@ -1,47 +1,92 @@ from .common import InfoExtractor -from ..utils import ExtractorError, str_to_int +from ..utils import ( + ExtractorError, + float_or_none, + parse_resolution, + qualities, + url_or_none, +) +from ..utils.traversal import traverse_obj class AppleConnectIE(InfoExtractor): - _VAL...
yt_dlp/extractor/appleconnect.py
17
Python
0.143
refactor
46
42
42
false
[ie/appleconnect] Rework extractor
13,229
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'duration': 177.911, 'thumbnail': r're:https?://.+\.png', 'upload_date': '20150710', 'uploader': 'Drake', }, }, { 'url': 'https://music.apple.com/us/post/1016746627', 'info_dict': { 'id': '1016746627', 'ext': 'm4v', ...
don't abuse assignment expressions (sorry I don't mean to sound stern; just being terse since I've explained why in other code review comments recently)
'1080pHdVideo': 1080, } _VALID_URL = r'https?://music\.apple\.com/[\w-]+/post/(?P<id>\d+)' _TESTS = [{ 'url': 'https://music.apple.com/us/post/1018290019', 'info_dict': { 'id': '1018290019', 'ext': 'm4v', 'title': 'Energy', 'duration': ...
@@ -1,47 +1,92 @@ from .common import InfoExtractor -from ..utils import ExtractorError, str_to_int +from ..utils import ( + ExtractorError, + float_or_none, + parse_resolution, + qualities, + url_or_none, +) +from ..utils.traversal import traverse_obj class AppleConnectIE(InfoExtractor): - _VAL...
yt_dlp/extractor/appleconnect.py
26
Python
0.429
suggestion
155
51
51
false
[ie/appleconnect] Rework extractor
13,229
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
extract_attributes, float_or_none, parse_resolution, qualities, url_or_none, urljoin, ) from ..utils.traversal import ( find_element, require, traverse_obj, ) class AppleConnectIE(InfoExtractor): IE_NAME = 'apple:music:connect' IE_DESC = 'Apple Music Connect' _BASE_URL...
I would only set the height here. Not all 1080p videos on the site are anamorphic https://music.apple.com/us/post/1826884640
extract_attributes, float_or_none, jwt_decode_hs256, jwt_encode, parse_resolution, qualities, unified_strdate, update_url, url_or_none, urljoin, ) from ..utils.traversal import ( find_element, require, traverse_obj, ) class AppleConnectIE(InfoExtractor): IE_NAME...
@@ -1,47 +1,115 @@ +import base64 +import json + from .common import InfoExtractor -from ..utils import ExtractorError, str_to_int +from ..utils import ( + extract_attributes, + float_or_none, + parse_resolution, + qualities, + url_or_none, + urljoin, +) +from ..utils.traversal import ( + find_ele...
yt_dlp/extractor/appleconnect.py
26
Python
0.357
suggestion
124
51
51
false
[ie/appleconnect] Rework extractor
13,229
yt-dlp/yt-dlp
132,642
Python
seproDev
doe1080
videos = self._download_json( 'https://amp-api.music.apple.com/v1/catalog/us/uploaded-videos', video_id, headers={ 'Authorization': f'Bearer {jwt}', 'Origin': self._BASE_URL, }, query={'ids': video_id, 'l': 'en-US'}) attributes = traver...
So we don't need to remove the `width` ```suggestion }) ```
self._jwt = self._search_regex( fr'(["\'])(?P<jwt>{header}(?:\.[\w-]+){{2}})\1', js, 'JSON Web Token', group='jwt') if self._jwt_is_expired(self._jwt): raise ExtractorError('The fetched token is already expired') return self._jwt def _real_extract(self, url): ...
@@ -1,47 +1,118 @@ +import base64 +import json + from .common import InfoExtractor -from ..utils import ExtractorError, str_to_int +from ..utils import ( + extract_attributes, + float_or_none, + parse_resolution, + qualities, + unified_strdate, + update_url, + url_or_none, + urljoin, +) +from ....
yt_dlp/extractor/appleconnect.py
26
Python
0.643
suggestion
74
41
48
false
[ie/appleconnect] Rework extractor
13,229
yt-dlp/yt-dlp
132,642
Python
seproDev
doe1080
header = base64.urlsafe_b64encode( json.dumps({ 'alg': 'ES256', 'typ': 'JWT', 'kid': 'WebPlayKid', }, separators=(',', ':')).encode(), ).decode().rstrip('=') jwt = self._search_regex( fr'(["\'])(?P<jwt>{header}(?...
```suggestion formats.append({ ```
if self._jwt and not self._jwt_is_expired(self._jwt): return self._jwt js_url = traverse_obj(webpage, ( {find_element(tag='script', attr='crossorigin', value='', html=True)}, {extract_attributes}, 'src', {urljoin(self._BASE_URL)}, {require('JS URL')})) js = s...
@@ -1,47 +1,118 @@ +import base64 +import json + from .common import InfoExtractor -from ..utils import ExtractorError, str_to_int +from ..utils import ( + extract_attributes, + float_or_none, + parse_resolution, + qualities, + unified_strdate, + update_url, + url_or_none, + urljoin, +) +from ....
yt_dlp/extractor/appleconnect.py
26
Python
0.429
suggestion
48
51
51
false
[ie/appleconnect] Rework extractor
13,229
yt-dlp/yt-dlp
132,642
Python
seproDev
doe1080
header = base64.urlsafe_b64encode( json.dumps({ 'alg': 'ES256', 'typ': 'JWT', 'kid': 'WebPlayKid', }, separators=(',', ':')).encode(), ).decode().rstrip('=') jwt = self._search_regex( fr'(["\'])(?P<jwt>{header}(...
Could even inline this ```suggestion ```
def _get_token(self, webpage, video_id): if self._jwt and not self._jwt_is_expired(self._jwt): return self._jwt js_url = traverse_obj(webpage, ( {find_element(tag='script', attr='crossorigin', value='', html=True)}, {extract_attributes}, 'src', {urljoin(self._BAS...
@@ -1,47 +1,118 @@ +import base64 +import json + from .common import InfoExtractor -from ..utils import ExtractorError, str_to_int +from ..utils import ( + extract_attributes, + float_or_none, + parse_resolution, + qualities, + unified_strdate, + update_url, + url_or_none, + urljoin, +) +from ....
yt_dlp/extractor/appleconnect.py
26
Python
0.5
suggestion
42
51
51
false
[ie/appleconnect] Rework extractor
13,229
yt-dlp/yt-dlp
132,642
Python
seproDev
doe1080
'typ': 'JWT', 'kid': 'WebPlayKid', }, separators=(',', ':')).encode(), ).decode().rstrip('=') jwt = self._search_regex( fr'(["\'])(?P<jwt>{header}(?:\.[\w-]+){{2}})\1', js, 'JSON Web Token', group='jwt') videos = self._download_json( ...
```suggestion 'height': self._QUALITIES.get(format_id), ```
js_url = traverse_obj(webpage, ( {find_element(tag='script', attr='crossorigin', value='', html=True)}, {extract_attributes}, 'src', {urljoin(self._BASE_URL)}, {require('JS URL')})) js = self._download_webpage( js_url, video_id, 'Downloading token JS', 'Unable to down...
@@ -1,47 +1,118 @@ +import base64 +import json + from .common import InfoExtractor -from ..utils import ExtractorError, str_to_int +from ..utils import ( + extract_attributes, + float_or_none, + parse_resolution, + qualities, + unified_strdate, + update_url, + url_or_none, + urljoin, +) +from ....
yt_dlp/extractor/appleconnect.py
26
Python
0.571
suggestion
77
48
51
false
[ie/appleconnect] Rework extractor
13,229
yt-dlp/yt-dlp
132,642
Python
seproDev
doe1080
'id': '1016746627', 'ext': 'm4v', 'title': 'Body Shop (Madonna) - Chellous Lima (Acoustic Cover)', 'duration': 210.278, 'thumbnail': r're:https?://.+\.png', 'upload_date': '20150706', 'uploader': 'Chellous Lima', }, }] ...
I have a patch that I will PR soon to improve `jwt_encode_hs256` such that it could easily be used here
'url': 'https://music.apple.com/us/post/1016746627', 'info_dict': { 'id': '1016746627', 'ext': 'm4v', 'title': 'Body Shop (Madonna) - Chellous Lima (Acoustic Cover)', 'duration': 210.278, 'thumbnail': r're:https?://.+\.png', 'upload...
@@ -1,47 +1,114 @@ +import base64 +import json + from .common import InfoExtractor -from ..utils import ExtractorError, str_to_int +from ..utils import ( + extract_attributes, + float_or_none, + parse_resolution, + qualities, + unified_strdate, + update_url, + url_or_none, + urljoin, +) +from ....
yt_dlp/extractor/appleconnect.py
26
Python
0.571
suggestion
103
51
51
false
[ie/appleconnect] Rework extractor
13,229
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
videos = self._download_json( 'https://amp-api.music.apple.com/v1/catalog/us/uploaded-videos', video_id, headers={ 'Authorization': f'Bearer {jwt}', 'Origin': self._BASE_URL, }, query={'ids': video_id, 'l': 'en-US'}) attributes = trave...
Since the token is long-lasting IIRC (at least a few weeks, right?), I think we should cache it (to disk, even). What do you think about: ```py _CACHE_SECTION = 'appleconnect' _JWT_CACHE_KEY = 'jwt' _jwt = None @staticmethod def _jwt_is_expired(token): return jwt_decode_hs256(tok...
return self._jwt js_url = traverse_obj(webpage, ( {find_element(tag='script', attr='crossorigin', value='', html=True)}, {extract_attributes}, 'src', {urljoin(self._BASE_URL)}, {require('JS URL')})) js = self._download_webpage( js_url, video_id, 'Download...
@@ -1,47 +1,106 @@ from .common import InfoExtractor -from ..utils import ExtractorError, str_to_int +from ..utils import ( + extract_attributes, + float_or_none, + jwt_encode, + parse_resolution, + qualities, + unified_strdate, + update_url, + url_or_none, + urljoin, +) +from ..utils.traver...
yt_dlp/extractor/appleconnect.py
26
Python
1
security
1,784
38
51
false
[ie/appleconnect] Rework extractor
13,229
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
subtitles = {} skipped_subs_clients = set() prs = traverse_obj(player_responses, ( # Filter out initial_pr which does not have streamingData (smuggled client context) lambda _, v: v['streamingData'] and v['captions']['playerCaptionsTracklistRenderer'])) pctrs = ...
can we be bold here ```suggestion innertube_client_name = pr['streamingData'][STREAMING_DATA_INNERTUBE_CONTEXT]['client']['clientName'] ```
for fmt in self._SUBTITLE_FORMATS: query = {**query, 'fmt': fmt} lang_subs.append({ 'ext': fmt, 'url': urljoin('https://www.youtube.com', update_url_query(base_url, query)), 'name': sub_name, STRE...
@@ -3890,47 +3925,79 @@ def is_bad_format(fmt): 'quality', 'res', 'fps', 'hdr:12', 'source', 'vcodec', 'channels', 'acodec', 'lang', 'proto'), } + def get_lang_code(track): + return (remove_start(track.get('vssId') or '', '.').replace('.', '-') + or track...
yt_dlp/extractor/youtube/_video.py
26
Python
0.714
suggestion
154
51
51
false
[ie/youtube] Add PO token support for subtitles
13,234
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
continue for trans_code, trans_name in translation_languages.items(): if not trans_code: continue orig_trans_code = trans_code if caption_track.get('kind') != 'asr' and trans_code != 'und': ...
```suggestion # Avoid duplication if we've already got everything we need ```
break orig_lang = qs.get('lang', [None])[-1] lang_name = self._get_text(caption_track, 'name', max_runs=1) if caption_track.get('kind') != 'asr': if not lang_code: continue process_langua...
@@ -3950,10 +4017,30 @@ def process_language(container, base_url, lang_code, sub_name, query): # Add an "-orig" label to the original language so that it can be distinguished. # The subs are returned without "-orig" as well for compatibility pro...
yt_dlp/extractor/youtube/_video.py
26
Python
0.643
suggestion
91
51
51
false
[ie/youtube] Add PO token support for subtitles
13,234
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
trans_name += format_field(lang_name, None, ' from %s') if lang_code == f'a-{orig_trans_code}': # Set audio language based on original subtitles for f in formats: if f.get('acodec') != 'none' and not ...
we could move this up and pass it to `_report_pot_subtitle_skipped` so that it's always reported as debug unless the user actually cares about subs
if not caption_track.get('isTranslatable'): continue for trans_code, trans_name in translation_languages.items(): if not trans_code: continue orig_trans_code = trans_code if ca...
@@ -3950,10 +4017,30 @@ def process_language(container, base_url, lang_code, sub_name, query): # Add an "-orig" label to the original language so that it can be distinguished. # The subs are returned without "-orig" as well for compatibility pro...
yt_dlp/extractor/youtube/_video.py
26
Python
0.714
bug
147
51
51
false
[ie/youtube] Add PO token support for subtitles
13,234
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
# The subs are returned without "-orig" as well for compatibility process_language( automatic_captions, base_url, f'{trans_code}-orig', f'{trans_name} (Original)', client_name, pot_params) # Setti...
Originally I liked the idea of showing the user what exactly they're missing, but now I realize that if **all** clients are skipped, then the automatic captions list could be like a full page warning. We could keep the sub langs list, but for captions just say "Some automatic captions are missing" ?
if not get_translated_subs: continue trans_code += f'-{lang_code}' trans_name += format_field(lang_name, None, ' from %s') if lang_code == f'a-{orig_trans_code}': # Set audio l...
@@ -3950,10 +4017,30 @@ def process_language(container, base_url, lang_code, sub_name, query): # Add an "-orig" label to the original language so that it can be distinguished. # The subs are returned without "-orig" as well for compatibility pro...
yt_dlp/extractor/youtube/_video.py
26
Python
0.5
question
300
51
51
false
[ie/youtube] Add PO token support for subtitles
13,234
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
for pr in prs: pctr = pr['captions']['playerCaptionsTracklistRenderer'] client_name = pr['streamingData'][STREAMING_DATA_CLIENT_NAME] innertube_client_name = traverse_obj( pr, ('streamingData', STREAMING_DATA_INNERTUBE_CONTEXT, 'client', 'clientName')) ...
```suggestion if subs_po_token and not pot_params: ```
get_translated_subs = 'translated_subs' not in self._configuration_arg('skip') and ( self.get_param('writeautomaticsub', False) or self.get_param('listsubtitles')) all_captions = traverse_obj(pctrs, (..., 'captionTracks', ..., {dict})) need_subs_langs = {get_lang_code(sub) for sub i...
@@ -3890,47 +3925,79 @@ def is_bad_format(fmt): 'quality', 'res', 'fps', 'hdr:12', 'source', 'vcodec', 'channels', 'acodec', 'lang', 'proto'), } + def get_lang_code(track): + return (remove_start(track.get('vssId') or '', '.').replace('.', '-') + or track...
yt_dlp/extractor/youtube/_video.py
26
Python
0.571
suggestion
72
51
51
false
[ie/youtube] Add PO token support for subtitles
13,234
yt-dlp/yt-dlp
132,642
Python
coletdjnz
bashonly
all_captions = traverse_obj(pctrs, (..., 'captionTracks', ..., {dict})) need_subs_langs = {get_lang_code(sub) for sub in all_captions if sub.get('kind') != 'asr'} need_caps_langs = { remove_start(get_lang_code(sub), 'a-') for sub in all_captions if sub.get('kind') == 'as...
save this outside the loop, only fetch once for the client
pctrs = traverse_obj(prs, (..., 'captions', 'playerCaptionsTracklistRenderer', {dict})) translation_languages = { lang.get('languageCode'): self._get_text(lang.get('languageName'), max_runs=1) for lang in traverse_obj(pctrs, (..., 'translationLanguages', ..., {dict}))} #...
@@ -3890,47 +3925,79 @@ def is_bad_format(fmt): 'quality', 'res', 'fps', 'hdr:12', 'source', 'vcodec', 'channels', 'acodec', 'lang', 'proto'), } + def get_lang_code(track): + return (remove_start(track.get('vssId') or '', '.').replace('.', '-') + or track...
yt_dlp/extractor/youtube/_video.py
26
Python
0.214
suggestion
58
51
51
false
[ie/youtube] Add PO token support for subtitles
13,234
yt-dlp/yt-dlp
132,642
Python
coletdjnz
bashonly
DATASYNC_ID = 'datasync_id' VIDEO_ID = 'video_id' VISITOR_ID = 'visitor_id' def get_webpo_content_binding( request: PoTokenRequest, webpo_clients=WEBPO_CLIENTS, bind_to_visitor_id=False, ) -> tuple[str | None, ContentBindingType | None]: client_name = traverse_obj(request.innertube_contex...
I think the OR clause can be removed here, just need a check for context
DATASYNC_ID = 'datasync_id' VIDEO_ID = 'video_id' VISITOR_ID = 'visitor_id' def get_webpo_content_binding( request: PoTokenRequest, webpo_clients=WEBPO_CLIENTS, bind_to_visitor_id=False, ) -> tuple[str | None, ContentBindingType | None]: client_name = traverse_obj(request.innertube_contex...
@@ -51,7 +51,7 @@ def get_webpo_content_binding( return visitor_id, ContentBindingType.VISITOR_ID return request.visitor_data, ContentBindingType.VISITOR_DATA - elif request.context == PoTokenContext.PLAYER or client_name != 'WEB_REMIX': + elif request.context in (PoTokenContex...
yt_dlp/extractor/youtube/pot/utils.py
26
Python
0.286
suggestion
72
46
46
false
[ie/youtube] Add PO token support for subtitles
13,234
yt-dlp/yt-dlp
132,642
Python
coletdjnz
bashonly
msg = ( f'{video_id}: {client_name} client {proto} formats require a GVS PO Token which was not provided. ' 'They will be skipped as they may yield HTTP Error 403. ' f'You can manually pass a GVS PO Token for this client with --extractor-args "youtube:po_token={client_name}.g...
add "some" because there may still be subs from m3u8 formats (ios, web_safari) ```suggestion def _report_pot_subtitle_skipped(self, video_id, client_name): msg = ( f'{video_id}: Some {client_name} client subtitles require a PO Token which was not provided. ' 'They will be disc...
msg = ( f'{video_id}: {client_name} client {proto} formats require a GVS PO Token which was not provided. ' 'They will be skipped as they may yield HTTP Error 403. ' f'You can manually pass a GVS PO Token for this client with --extractor-args "youtube:po_token={client_name}.g...
@@ -3262,6 +3280,19 @@ def _report_pot_format_skipped(self, video_id, client_name, proto): else: self.report_warning(msg, only_once=True) + def _report_pot_subtitle_skipped(self, video_id, client_name): + msg = ( + f'{video_id}: {client_name} client subtitles require a PO To...
yt_dlp/extractor/youtube/_video.py
26
Python
1
bug
1,062
51
51
false
[ie/youtube] Add PO token support for subtitles
13,234
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
import json import urllib.parse from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, str_or_none, url_or_none, ) from ..utils.traversal import find_element, traverse_obj class ToutiaoIE(InfoExtractor): IE_NAME = 'toutiao' IE_DESC = '今日头条' _VALID_URL = r'htt...
Any group in a `_VALID_URL` pattern must be either a named capture group or non-capturing And I'd imagine we don't want the url path to continue beyond the optional trailing slash ```suggestion _VALID_URL = r'https?://www\.toutiao\.com/video/(?P<id>\d+)/?(?:[?#]|$)' ```
import json import urllib.parse from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, str_or_none, try_call, url_or_none, ) from ..utils.traversal import find_element, traverse_obj class ToutiaoIE(InfoExtractor): IE_NAME = 'toutiao' IE_DESC = '今日头条' _VAL...
@@ -0,0 +1,120 @@ +import json +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + float_or_none, + int_or_none, + str_or_none, + url_or_none, +) +from ..utils.traversal import find_element, traverse_obj + + +class ToutiaoIE(InfoExtractor): + IE_NAME = 'toutiao' + IE_DES...
yt_dlp/extractor/toutiao.py
18
Python
0.786
suggestion
280
43
43
false
[ie/toutiao] Add Extractor
13,246
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'uploader_id': 'MS4wLjABAAAAeateBb9Su8I3MJOZozmvyzWktmba5LMlliRDz1KffnM', 'view_count': int, }, }, { 'url': 'https://www.toutiao.com/video/7479446610359878153/', 'info_dict': { 'id': '7479446610359878153', 'ext': 'mp4', 'title': '小伙...
use `_request_webpage` if you don't want/need to read the content ```suggestion urlh = self._request_webpage( ```
'uploader': '极目新闻', 'uploader_id': 'MS4wLjABAAAAeateBb9Su8I3MJOZozmvyzWktmba5LMlliRDz1KffnM', 'view_count': int, }, }, { 'url': 'https://www.toutiao.com/video/7479446610359878153/', 'info_dict': { 'id': '7479446610359878153', 'ext':...
@@ -0,0 +1,120 @@ +import json +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + float_or_none, + int_or_none, + str_or_none, + url_or_none, +) +from ..utils.traversal import find_element, traverse_obj + + +class ToutiaoIE(InfoExtractor): + IE_NAME = 'toutiao' + IE_DES...
yt_dlp/extractor/toutiao.py
26
Python
0.786
suggestion
124
51
51
false
[ie/toutiao] Add Extractor
13,246
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'view_count': int, }, }] def _real_initialize(self): if self._get_cookies('https://www.toutiao.com').get('ttwid'): return _, urlh = self._download_json_handle( 'https://ttwid.bytedance.com/ttwid/union/register/', None, 'Fetching ttwid', '...
`['ttwid'].value` is doubly fatal. If the idea is to `raise_login_required` when the cookie hasn't been set (instead of throwing a `KeyError`/`AttributeError`), then we need to check this safely: ```suggestion if ttwid := try_call(lambda: self._get_cookies(urlh.url)['ttwid'].value): self._set_coo...
'uploader_id': 'MS4wLjABAAAA4f7d4mwtApALtHIiq-QM20dwXqe32NUz0DeWF7wbHKw', 'view_count': int, }, }] def _real_initialize(self): if self._get_cookies('https://www.toutiao.com').get('ttwid'): return urlh = self._request_webpage( 'https://ttw...
@@ -0,0 +1,120 @@ +import json +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + float_or_none, + int_or_none, + str_or_none, + url_or_none, +) +from ..utils.traversal import find_element, traverse_obj + + +class ToutiaoIE(InfoExtractor): + IE_NAME = 'toutiao' + IE_DES...
yt_dlp/extractor/toutiao.py
26
Python
1
refactor
521
51
51
false
[ie/toutiao] Add Extractor
13,246
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'https://ttwid.bytedance.com/ttwid/union/register/', None, 'Fetching ttwid', 'Unable to fetch ttwid', headers={ 'Content-Type': 'application/json', }, data=json.dumps({ 'aid': 24, 'needFid': False, 'region': 'cn', ...
I would only use `find_element` (or any of the HTML helpers) when looking for JSON if you're certain that the unescaping of HTML special characters is necessary (e.g. if the JSON is an attribute value). Otherwise it can be potentially harmful (e.g. `&quot;` being unescaped to `"` inside a string value and breaking our ...
urlh = self._request_webpage( 'https://ttwid.bytedance.com/ttwid/union/register/', None, 'Fetching ttwid', 'Unable to fetch ttwid', headers={ 'Content-Type': 'application/json', }, data=json.dumps({ 'aid': 24, 'needFid': False, ...
@@ -0,0 +1,120 @@ +import json +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + float_or_none, + int_or_none, + str_or_none, + url_or_none, +) +from ..utils.traversal import find_element, traverse_obj + + +class ToutiaoIE(InfoExtractor): + IE_NAME = 'toutiao' + IE_DES...
yt_dlp/extractor/toutiao.py
26
Python
0.643
security
482
51
51
false
[ie/toutiao] Add Extractor
13,246
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'union': True, }).encode(), ) if ttwid := self._get_cookies(urlh.url)['ttwid'].value: self._set_cookie('.toutiao.com', 'ttwid', ttwid) return self.raise_login_required(method='cookies') def _real_extract(self, url): video_id = se...
Why `str_or_none` instead of `str` here? (I am actually curious; not necessarily saying you should change it)
'service': 'www.toutiao.com', 'union': True, }).encode(), ) if ttwid := try_call(lambda: self._get_cookies(urlh.url)['ttwid'].value): self._set_cookie('.toutiao.com', 'ttwid', ttwid) return self.raise_login_required() def...
@@ -0,0 +1,120 @@ +import json +import urllib.parse + +from .common import InfoExtractor +from ..utils import ( + float_or_none, + int_or_none, + str_or_none, + url_or_none, +) +from ..utils.traversal import find_element, traverse_obj + + +class ToutiaoIE(InfoExtractor): + IE_NAME = 'toutiao' + IE_DES...
yt_dlp/extractor/toutiao.py
26
Python
0.571
question
109
51
51
false
[ie/toutiao] Add Extractor
13,246
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'timestamp': 1614812942, 'upload_date': '20210303', 'thumbnail': r're:^https?://[^?#]+\.jpg\?token=', 'view_count': int, 'concurrent_view_count': int, 'live_status': 'was_live', }, }, { 'url': 'https://twitter.com/i/broadcasts/1...
For how long do these links keep working after the event ends? Can we add an actual test instead of just an `only_matching` test (since the extraction is actually different for events)?
'uploader_id': 'SpaceX', 'uploader_url': 'https://twitter.com/SpaceX', 'timestamp': 1614812942, 'upload_date': '20210303', 'thumbnail': r're:^https?://[^?#]+\.jpg\?token=', 'view_count': int, 'concurrent_view_count': int, 'l...
@@ -1640,11 +1644,25 @@ class TwitterBroadcastIE(TwitterBaseIE, PeriscopeBaseIE): 'upload_date': '20230420', 'thumbnail': r're:^https?://[^?#]+\.jpg\?token=', 'view_count': int, + 'concurrent_view_count': int, + 'live_status': 'was_live', }, + }, ...
yt_dlp/extractor/twitter.py
26
Python
0.571
refactor
185
51
51
false
[ie/twitter:broadcast] Support /events/ URLs
13,248
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'title': 'Starship Flight Test', 'uploader': 'SpaceX', 'uploader_id': 'SpaceX', 'uploader_url': 'https://twitter.com/SpaceX', 'timestamp': 1681993964, 'upload_date': '20230420', 'thumbnail': r're:^https?://[^?#]+\.jpg\?token=', ...
- IMO the assignment expression + API call + traversal done all together is hard to read. I would break this up - Why return a url result if we can just assign the new/correct value to `broadcast_id`? (rhetorical question; suggestion below) - In the traversal, we are just branching after `broadcasts` and grabbing the...
'id': '1OyKAVQrgzwGb', 'ext': 'mp4', 'title': 'Starship Flight Test', 'display_id': '1OyKAVQrgzwGb', 'uploader': 'SpaceX', 'uploader_id': 'SpaceX', 'uploader_url': 'https://twitter.com/SpaceX', 'timestamp': 1681993964, ...
@@ -1640,11 +1644,25 @@ class TwitterBroadcastIE(TwitterBaseIE, PeriscopeBaseIE): 'upload_date': '20230420', 'thumbnail': r're:^https?://[^?#]+\.jpg\?token=', 'view_count': int, + 'concurrent_view_count': int, + 'live_status': 'was_live', }, + }, ...
yt_dlp/extractor/twitter.py
26
Python
1
bug
867
51
51
false
[ie/twitter:broadcast] Support /events/ URLs
13,248
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'view_count': int, }, }] def _real_extract(self, url): broadcast_type, display_id = self._match_valid_url(url).groups() if broadcast_type == 'events': timeline = self._call_api( f'live_event/1/{display_id}/timeline.json', display_id) ...
if adding this can you update the other tests too please
'uploader': 'ディズニープラス公式', 'uploader_id': 'DisneyPlusJP', 'uploader_url': 'https://twitter.com/DisneyPlusJP', 'view_count': int, }, }] def _real_extract(self, url): broadcast_type, display_id = self._match_valid_url(url).group('type', 'id') ...
@@ -1654,6 +1690,7 @@ def _real_extract(self, url): info['title'] = broadcast.get('status') or info.get('title') info['uploader_id'] = broadcast.get('twitter_username') or info.get('uploader_id') info['uploader_url'] = format_field(broadcast, 'twitter_username', 'https://twitter.com/%s', defa...
yt_dlp/extractor/twitter.py
26
Python
0.214
suggestion
56
51
51
false
[ie/twitter:broadcast] Support /events/ URLs
13,248
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'title': '#ガンニバル ウォッチパーティー', 'concurrent_view_count': int, 'display_id': '1910629646300762112', 'live_status': 'was_live', 'release_date': '20250423', 'release_timestamp': 1745409000, 'tags': ['ガンニバル'], 'thumbnail': r're:htt...
```suggestion {str}, any, {require('broadcast ID')})) ```
'title': '#ガンニバル ウォッチパーティー', 'concurrent_view_count': int, 'display_id': '1910629646300762112', 'live_status': 'was_live', 'release_date': '20250423', 'release_timestamp': 1745409000, 'tags': ['ガンニバル'], 'thumbnail': r're:htt...
@@ -1596,55 +1596,94 @@ def _find_dimension(target): class TwitterBroadcastIE(TwitterBaseIE, PeriscopeBaseIE): IE_NAME = 'twitter:broadcast' - _VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/broadcasts/(?P<id>[0-9a-zA-Z]{13})' + _VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/(?P<type>broadcasts|events)/(?P<i...
yt_dlp/extractor/twitter.py
26
Python
0.714
suggestion
75
51
51
false
[ie/twitter:broadcast] Support /events/ URLs
13,248
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
}] def _real_extract(self, url): broadcast_type, display_id = self._match_valid_url(url).groups() if broadcast_type == 'events': timeline = self._call_api( f'live_event/1/{display_id}/timeline.json', display_id) broadcast_id = traverse_obj(timeline, ( ...
Kinda unrelated, can we do this too? I forgot to add this a while ago and it's been bothering me ```suggestion if info['live_status'] == 'is_upcoming': self.raise_no_formats('This live broadcast has not yet started', expected=True) return info ```
}] def _real_extract(self, url): broadcast_type, display_id = self._match_valid_url(url).group('type', 'id') if broadcast_type == 'events': timeline = self._call_api( f'live_event/1/{display_id}/timeline.json', display_id) broadcast_id = traverse_obj(tim...
@@ -1654,6 +1693,7 @@ def _real_extract(self, url): info['title'] = broadcast.get('status') or info.get('title') info['uploader_id'] = broadcast.get('twitter_username') or info.get('uploader_id') info['uploader_url'] = format_field(broadcast, 'twitter_username', 'https://twitter.com/%s', defa...
yt_dlp/extractor/twitter.py
26
Python
0.929
suggestion
284
51
51
false
[ie/twitter:broadcast] Support /events/ URLs
13,248
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'timestamp': 1745403328, 'upload_date': '20250423', 'uploader': 'ディズニープラス公式', 'uploader_id': 'DisneyPlusJP', 'uploader_url': 'https://twitter.com/DisneyPlusJP', 'view_count': int, }, }] def _real_extract(self, url): broadca...
I find it very harmful to readability and maintainability to use an assignment expression when the variable you're assigning to is going to be used outside of the conditional path. e.g. ```py if foo := bar(): print(f'bashonly approves of using {foo} in this code path') # bashonly hates using `foo` out here...
'timestamp': 1745403328, 'upload_date': '20250423', 'uploader': 'ディズニープラス公式', 'uploader_id': 'DisneyPlusJP', 'uploader_url': 'https://twitter.com/DisneyPlusJP', 'view_count': int, }, }] def _real_extract(self, url): broadca...
@@ -1596,65 +1596,109 @@ def _find_dimension(target): class TwitterBroadcastIE(TwitterBaseIE, PeriscopeBaseIE): IE_NAME = 'twitter:broadcast' - _VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/broadcasts/(?P<id>[0-9a-zA-Z]{13})' + _VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/(?P<type>broadcasts|events)/(?P<...
yt_dlp/extractor/twitter.py
26
Python
1
refactor
609
51
51
false
[ie/twitter:broadcast] Support /events/ URLs
13,248
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'live_status': 'was_live', }, }, { 'url': 'https://x.com/i/events/1910629646300762112', 'info_dict': { 'id': '1LyxBWDRNqyKN', 'ext': 'mp4', 'title': '#ガンニバル ウォッチパーティー', 'concurrent_view_count': int, 'display_id': '191062...
```suggestion broadcast_type, display_id = self._match_valid_url(url).group('type', 'id') ```
'live_status': 'was_live', }, }, { 'url': 'https://x.com/i/events/1910629646300762112', 'info_dict': { 'id': '1LyxBWDRNqyKN', 'ext': 'mp4', 'title': '#ガンニバル ウォッチパーティー', 'concurrent_view_count': int, 'display_id': '191062...
@@ -1596,65 +1596,109 @@ def _find_dimension(target): class TwitterBroadcastIE(TwitterBaseIE, PeriscopeBaseIE): IE_NAME = 'twitter:broadcast' - _VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/broadcasts/(?P<id>[0-9a-zA-Z]{13})' + _VALID_URL = TwitterBaseIE._BASE_REGEX + r'i/(?P<type>broadcasts|events)/(?P<...
yt_dlp/extractor/twitter.py
26
Python
0.857
suggestion
103
51
51
false
[ie/twitter:broadcast] Support /events/ URLs
13,248
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
if not self._device_id: self._device_id = traverse_obj(cookies, (self._DEVICE_ID_KEY, 'value')) or str(uuid.uuid4()) if self._is_logged_in: return self._oauth_tokens.update(traverse_obj(cookies, { self._ACCESS_TOKEN_KEY: (self._ACCESS_TOKEN_KEY, 'value'), ...
```suggestion for is_retry in (False, True): ```
if not self._device_id: self._device_id = traverse_obj(cookies, (self._DEVICE_ID_KEY, 'value')) or str(uuid.uuid4()) if self._is_logged_in: return self._oauth_tokens.update(traverse_obj(cookies, { self._ACCESS_TOKEN_KEY: (self._ACCESS_TOKEN_KEY, 'value'), ...
@@ -17,99 +18,227 @@ UserNotLive, float_or_none, int_or_none, + join_nonempty, + jwt_decode_hs256, str_or_none, - traverse_obj, try_call, update_url_query, url_or_none, ) +from ..utils.traversal import require, traverse_obj class WeverseBaseIE(InfoExtractor): _NETR...
yt_dlp/extractor/weverse.py
26
Python
0.571
suggestion
58
51
51
false
[ie/weverse] Support login with oauth refresh tokens
13,284
yt-dlp/yt-dlp
132,642
Python
seproDev
bashonly
'appId': 'be4d79eb8fc7bd008ee82c8ec4ff6fd4', 'language': 'en', 'os': self._CLIENT_PLATFORM, 'platform': self._CLIENT_PLATFORM, 'wpf': 'pc', }) for retry in (False, True): wmsgpad = int(time.time() * 1000) wmd = base64.b6...
```suggestion if is_retry or not isinstance(e.cause, HTTPError): ```
'appId': 'be4d79eb8fc7bd008ee82c8ec4ff6fd4', 'language': 'en', 'os': self._CLIENT_PLATFORM, 'platform': self._CLIENT_PLATFORM, 'wpf': 'pc', }) for is_retry in (False, True): wmsgpad = int(time.time() * 1000) wmd = base64...
@@ -17,99 +18,227 @@ UserNotLive, float_or_none, int_or_none, + join_nonempty, + jwt_decode_hs256, str_or_none, - traverse_obj, try_call, update_url_query, url_or_none, ) +from ..utils.traversal import require, traverse_obj class WeverseBaseIE(InfoExtractor): _NETR...
yt_dlp/extractor/weverse.py
26
Python
0.786
suggestion
86
51
51
false
[ie/weverse] Support login with oauth refresh tokens
13,284
yt-dlp/yt-dlp
132,642
Python
seproDev
bashonly
'id': '31406', 'ext': 'mp3', 'title': 'Das Leben schwer nehmen, ist einfach zu anstrengend', 'channel': 'SR 1', 'description': 'md5:3e03fd556af831ad984d0add7175fb0c', 'duration': 1769.0, 'release_date': '20230717', 'series':...
- the `lambda` in the `_proto_relative_url` transformation is redundant - might as well `require` here since `_extract_media_info` is fatal later ```suggestion player_url = traverse_obj(webpage, ( {find_element(tag='div', id=f'player{video_id}', html=True)}, {extract_attributes}, ...
'thumbnail': r're:https?://.+\.jpg', }, }, { 'url': 'https://www.sr-mediathek.de/index.php?seite=7&id=31406&pnr=&tbl=pf', 'info_dict': { 'id': '31406', 'ext': 'mp3', 'title': 'Das Leben schwer nehmen, ist einfach zu anstrengend', 'c...
@@ -1,57 +1,100 @@ from .ard import ARDMediathekBaseIE from ..utils import ( ExtractorError, - get_element_by_attribute, + clean_html, + extract_attributes, + parse_duration, + parse_qs, + unified_strdate, ) +from ..utils.traversal import find_element, traverse_obj class SRMediathekIE(ARD...
yt_dlp/extractor/srmediathek.py
26
Python
0.857
refactor
425
51
51
false
[ie/sr:mediathek] Improve metadata extraction
13,294
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'description': 'md5:3e03fd556af831ad984d0add7175fb0c', 'duration': 1769.0, 'release_date': '20230717', 'series': 'Abendrot', 'series_id': 'SR1_AB_P', 'thumbnail': r're:https?://.+\.jpg', }, }] def _real_extract(self, url): ...
"No hanging parentheses" is a code formatting convention per the contributing guide. (Talking only about `)`, **not** `]` or `}`). Sometimes I prefer to use them when they're at the end of a parenthesized `if` or `for` statement, but otherwise try to avoid ```suggestion {find_element(tag='p')}, {clean_htm...
'info_dict': { 'id': '31406', 'ext': 'mp3', 'title': 'Das Leben schwer nehmen, ist einfach zu anstrengend', 'channel': 'SR 1', 'description': 'md5:3e03fd556af831ad984d0add7175fb0c', 'duration': 1769.0, 'release_date': '20230717'...
@@ -1,57 +1,100 @@ from .ard import ARDMediathekBaseIE from ..utils import ( ExtractorError, - get_element_by_attribute, + clean_html, + extract_attributes, + parse_duration, + parse_qs, + unified_strdate, ) +from ..utils.traversal import find_element, traverse_obj class SRMediathekIE(ARD...
yt_dlp/extractor/srmediathek.py
26
Python
0.857
suggestion
329
49
51
false
[ie/sr:mediathek] Improve metadata extraction
13,294
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'duration': 1769.0, 'release_date': '20230717', 'series': 'Abendrot', 'series_id': 'SR1_AB_P', 'thumbnail': r're:https?://.+\.jpg', }, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_web...
make `cls_common` a class constant
'id': '31406', 'ext': 'mp3', 'title': 'Das Leben schwer nehmen, ist einfach zu anstrengend', 'channel': 'SR 1', 'description': 'md5:3e03fd556af831ad984d0add7175fb0c', 'duration': 1769.0, 'release_date': '20230717', 'series':...
@@ -1,57 +1,100 @@ from .ard import ARDMediathekBaseIE from ..utils import ( ExtractorError, - get_element_by_attribute, + clean_html, + extract_attributes, + parse_duration, + parse_qs, + unified_strdate, ) +from ..utils.traversal import find_element, traverse_obj class SRMediathekIE(ARD...
yt_dlp/extractor/srmediathek.py
26
Python
0.214
suggestion
34
48
50
false
[ie/sr:mediathek] Improve metadata extraction
13,294
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) description = self._og_search_description(webpage) if description == 'Der gewünschte Beitrag ist leider nicht mehr vorhanden.': raise ExtractorError(f'Video {video_id} is no longer available', exp...
I'd just use `clean_html` in these traversals to be safe (it will take care of the whitespace too). Instead of `lambda x: x.split('|')[0]` could we use `trim_str` here (e.g. if there's a fixed string after the `|`)? ```suggestion 'title': traverse_obj(webpage, ( {find_element(cls='ardp...
'thumbnail': r're:https?://.+\.jpg', }, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) description = self._og_search_description(webpage) if description == 'Der gewünschte Beitrag ist leider ni...
@@ -1,57 +1,100 @@ from .ard import ARDMediathekBaseIE from ..utils import ( ExtractorError, - get_element_by_attribute, + clean_html, + extract_attributes, + parse_duration, + parse_qs, + unified_strdate, ) +from ..utils.traversal import find_element, traverse_obj class SRMediathekIE(ARD...
yt_dlp/extractor/srmediathek.py
26
Python
0.857
suggestion
531
39
41
false
[ie/sr:mediathek] Improve metadata extraction
13,294
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
player_url = traverse_obj(webpage, ( {find_element(tag='div', id=f'player{video_id}', html=True)}, {extract_attributes}, 'data-mediacollection-ardplayer', {lambda x: self._proto_relative_url(x)}, )) article = traverse_obj(webpage, ( {find_element(c...
```suggestion 'series': traverse_obj(webpage, ( {find_element(cls=f'{cls_common}headline')}, {clean_html})), ```
description = self._og_search_description(webpage) if description == 'Der gewünschte Beitrag ist leider nicht mehr vorhanden.': raise ExtractorError(f'Video {video_id} is no longer available', expected=True) player_url = traverse_obj(webpage, ( {find_element(tag='div', ...
@@ -1,57 +1,100 @@ from .ard import ARDMediathekBaseIE from ..utils import ( ExtractorError, - get_element_by_attribute, + clean_html, + extract_attributes, + parse_duration, + parse_qs, + unified_strdate, ) +from ..utils.traversal import find_element, traverse_obj class SRMediathekIE(ARD...
yt_dlp/extractor/srmediathek.py
26
Python
0.714
suggestion
143
32
34
false
[ie/sr:mediathek] Improve metadata extraction
13,294
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
from .ard import ARDMediathekBaseIE from ..utils import ( ExtractorError, clean_html, extract_attributes, parse_duration, parse_qs, unified_strdate, ) from ..utils.traversal import ( find_element, require, traverse_obj, ) class SRMediathekIE(ARDMediathekBaseIE): IE_NAME = 'sr:m...
```suggestion _CLS_COMMON = 'teaser__image__caption__text teaser__image__caption__text--' ```
from .ard import ARDMediathekBaseIE from ..utils import ( ExtractorError, clean_html, extract_attributes, parse_duration, parse_qs, unified_strdate, ) from ..utils.traversal import ( find_element, require, traverse_obj, ) class SRMediathekIE(ARDMediathekBaseIE): IE_NAME = 'sr:m...
@@ -1,57 +1,102 @@ from .ard import ARDMediathekBaseIE from ..utils import ( ExtractorError, - get_element_by_attribute, + clean_html, + extract_attributes, + parse_duration, + parse_qs, + unified_strdate, +) +from ..utils.traversal import ( + find_element, + require, + traverse_obj, ...
yt_dlp/extractor/srmediathek.py
20
Python
0.571
suggestion
99
45
45
false
[ie/sr:mediathek] Improve metadata extraction
13,294
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
}, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) description = self._og_search_description(webpage) if description == 'Der gewünschte Beitrag ist leider nicht mehr vorhanden.': raise Extractor...
```suggestion {find_element(cls=f'{self._CLS_COMMON}subheadline')}, ```
}, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) description = self._og_search_description(webpage) if description == 'Der gewünschte Beitrag ist leider nicht mehr vorhanden.': raise Extractor...
@@ -1,57 +1,102 @@ from .ard import ARDMediathekBaseIE from ..utils import ( ExtractorError, - get_element_by_attribute, + clean_html, + extract_attributes, + parse_duration, + parse_qs, + unified_strdate, +) +from ..utils.traversal import ( + find_element, + require, + traverse_obj, ...
yt_dlp/extractor/srmediathek.py
26
Python
0.571
suggestion
89
40
40
false
[ie/sr:mediathek] Improve metadata extraction
13,294
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
if description == 'Der gewünschte Beitrag ist leider nicht mehr vorhanden.': raise ExtractorError(f'Video {video_id} is no longer available', expected=True) player_url = traverse_obj(webpage, ( {find_element(tag='div', id=f'player{video_id}', html=True)}, {extract_at...
```suggestion {find_element(cls=f'{self._CLS_COMMON}headline')}, {clean_html})), ```
if description == 'Der gewünschte Beitrag ist leider nicht mehr vorhanden.': raise ExtractorError(f'Video {video_id} is no longer available', expected=True) player_url = traverse_obj(webpage, ( {find_element(tag='div', id=f'player{video_id}', html=True)}, {extract_at...
@@ -1,57 +1,102 @@ from .ard import ARDMediathekBaseIE from ..utils import ( ExtractorError, - get_element_by_attribute, + clean_html, + extract_attributes, + parse_duration, + parse_qs, + unified_strdate, +) +from ..utils.traversal import ( + find_element, + require, + traverse_obj, ...
yt_dlp/extractor/srmediathek.py
26
Python
0.714
suggestion
102
32
32
false
[ie/sr:mediathek] Improve metadata extraction
13,294
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'episode_id': '000000010172808', 'episode_number': 255, 'genres': ['variety'], 'live_status': 'not_live', 'modified_date': '20250525', 'modified_timestamp': 1748145537, 'release_date': '20250525', 'release_timestamp': 174814...
```suggestion info = traverse_obj(self._search_json( r'window\.app\s*=', webpage, 'video info', display_id, ), ('falcorCache', 'catalog', 'episode', display_id, 'value', {dict}), default={}) media_id = traverse_obj(info, ( 'streaks_data', 'mediaid', {str_or_none}, {r...
'episode_number': 255, 'genres': ['variety'], 'live_status': 'not_live', 'modified_date': '20250525', 'modified_timestamp': 1748145537, 'release_date': '20250525', 'release_timestamp': 1748145539, 'series': 'ダウンタウンのガキの使いやあらへ...
@@ -1,55 +1,82 @@ -from .common import InfoExtractor +from .streaks import StreaksBaseIE from ..utils import ( - ExtractorError, - smuggle_url, - traverse_obj, + int_or_none, + parse_iso8601, + str_or_none, + url_or_none, ) +from ..utils.traversal import require, traverse_obj -class NTVCoJpCU...
yt_dlp/extractor/ntvcojp.py
26
Python
0.786
performance
357
51
51
false
[ie/cu.ntv.co.jp] Fix extractor
13,302
yt-dlp/yt-dlp
132,642
Python
doe1080
nullpos
from .streaks import StreaksBaseIE from ..utils import ( int_or_none, parse_iso8601, str_or_none, url_or_none, ) from ..utils.traversal import require, traverse_obj class NTVJpCuIE(StreaksBaseIE): IE_NAME = 'ntvjp:cu' IE_DESC = '日テレ無料TADA!' _VALID_URL = r'https?://cu\.ntv\.co\.jp/(?!progr...
don't rename the class, only change `IE_NAME` and `IE_DESC`
from .streaks import StreaksBaseIE from ..utils import ( int_or_none, parse_iso8601, str_or_none, url_or_none, ) from ..utils.traversal import require, traverse_obj class NTVCoJpCUIE(StreaksBaseIE): IE_NAME = 'cu.ntv.co.jp' IE_DESC = '日テレ無料TADA!' _VALID_URL = r'https?://cu\.ntv\.co\.jp/(?!...
@@ -1,55 +1,83 @@ -from .common import InfoExtractor +from .streaks import StreaksBaseIE from ..utils import ( - ExtractorError, - smuggle_url, - traverse_obj, + int_or_none, + parse_iso8601, + str_or_none, + url_or_none, ) +from ..utils.traversal import require, traverse_obj -class NTVCoJpCU...
yt_dlp/extractor/ntvcojp.py
13
Python
0.429
suggestion
59
38
38
false
[ie/cu.ntv.co.jp] Fix extractor
13,302
yt-dlp/yt-dlp
132,642
Python
bashonly
nullpos
from .streaks import StreaksBaseIE from ..utils import ( int_or_none, parse_iso8601, str_or_none, url_or_none, ) from ..utils.traversal import require, traverse_obj class NTVJpCuIE(StreaksBaseIE): IE_NAME = 'ntvjp:cu' IE_DESC = '日テレ無料TADA!' _VALID_URL = r'https?://cu\.ntv\.co\.jp/(?!progr...
why the `/?$` ?? ```suggestion _VALID_URL = r'https?://cu\.ntv\.co\.jp/(?!program-list)(?P<id>[\w-]+)' ```
from .streaks import StreaksBaseIE from ..utils import ( int_or_none, parse_iso8601, str_or_none, url_or_none, ) from ..utils.traversal import require, traverse_obj class NTVCoJpCUIE(StreaksBaseIE): IE_NAME = 'cu.ntv.co.jp' IE_DESC = '日テレ無料TADA!' _VALID_URL = r'https?://cu\.ntv\.co\.jp/(?!...
@@ -1,55 +1,83 @@ -from .common import InfoExtractor +from .streaks import StreaksBaseIE from ..utils import ( - ExtractorError, - smuggle_url, - traverse_obj, + int_or_none, + parse_iso8601, + str_or_none, + url_or_none, ) +from ..utils.traversal import require, traverse_obj -class NTVCoJpCU...
yt_dlp/extractor/ntvcojp.py
15
Python
0.714
question
113
40
40
false
[ie/cu.ntv.co.jp] Fix extractor
13,302
yt-dlp/yt-dlp
132,642
Python
bashonly
nullpos
'episode_number': 255, 'genres': ['variety'], 'live_status': 'not_live', 'modified_date': '20250525', 'modified_timestamp': 1748145537, 'release_date': '20250525', 'release_timestamp': 1748145539, 'series': 'ダウンタウンのガキの使いやあらへ...
IMO don't bother with `traverse_obj` if the rest of the extractor is broken without the data you are traversing for (e.g. `info`) Use `traverse_obj` when you *need* to *safely* traverse an object, or when you need its filtering/transformations/versatility ```suggestion info = self._search_json( ...
'genres': ['variety'], 'live_status': 'not_live', 'modified_date': '20250525', 'modified_timestamp': 1748145537, 'release_date': '20250525', 'release_timestamp': 1748145539, 'series': 'ダウンタウンのガキの使いやあらへんで!', 'series_id': 'gak...
@@ -1,55 +1,83 @@ -from .common import InfoExtractor +from .streaks import StreaksBaseIE from ..utils import ( - ExtractorError, - smuggle_url, - traverse_obj, + int_or_none, + parse_iso8601, + str_or_none, + url_or_none, ) +from ..utils.traversal import require, traverse_obj -class NTVCoJpCU...
yt_dlp/extractor/ntvcojp.py
26
Python
0.857
bug
582
51
51
false
[ie/cu.ntv.co.jp] Fix extractor
13,302
yt-dlp/yt-dlp
132,642
Python
bashonly
nullpos
'display_id': 'ref:gaki_20250525', 'duration': 1450, 'episode': '放送開始36年!方正ココリコが選ぶ神回&地獄回!', 'episode_id': '000000010172808', 'episode_number': 255, 'genres': ['variety'], 'live_status': 'not_live', 'modified_date': '20250525...
is there any way for us to return the old `video_id` as `_old_archive_ids`?
'duration': 1450, 'episode': '放送開始36年!方正ココリコが選ぶ神回&地獄回!', 'episode_id': '000000010172808', 'episode_number': 255, 'genres': ['variety'], 'live_status': 'not_live', 'modified_date': '20250525', 'modified_timestamp': 1748145537...
@@ -1,55 +1,83 @@ -from .common import InfoExtractor +from .streaks import StreaksBaseIE from ..utils import ( - ExtractorError, - smuggle_url, - traverse_obj, + int_or_none, + parse_iso8601, + str_or_none, + url_or_none, ) +from ..utils.traversal import require, traverse_obj -class NTVCoJpCU...
yt_dlp/extractor/ntvcojp.py
26
Python
0.357
question
75
51
51
false
[ie/cu.ntv.co.jp] Fix extractor
13,302
yt-dlp/yt-dlp
132,642
Python
bashonly
nullpos
NPOIE, VPROIE, WNLIE, AndereTijdenIE, HetKlokhuisIE, NPOLiveIE, NPORadioFragmentIE, NPORadioIE, SchoolTVIE, ) from .npr import NprIE from .nrk import ( NRKIE, NRKTVIE, NRKPlaylistIE, NRKRadioPodkastIE, NRKSkoleIE, NRKTVDirekteIE, NRKTVEpisodeIE, NRKTVE...
sorry for causing unnecessary confusion ```suggestion from .ntvcojp import NTVCoJpCUIE ```
NPOIE, VPROIE, WNLIE, AndereTijdenIE, HetKlokhuisIE, NPOLiveIE, NPORadioFragmentIE, NPORadioIE, SchoolTVIE, ) from .npr import NprIE from .nrk import ( NRKIE, NRKTVIE, NRKPlaylistIE, NRKRadioPodkastIE, NRKSkoleIE, NRKTVDirekteIE, NRKTVEpisodeIE, NRKTVE...
@@ -1420,7 +1420,7 @@ ) from .nrl import NRLTVIE from .nts import NTSLiveIE -from .ntvcojp import NTVCoJpCUIE +from .ntvcojp import NTVJpCuIE
yt_dlp/extractor/_extractors.py
26
Python
0.571
suggestion
93
51
51
false
[ie/cu.ntv.co.jp] Fix extractor
13,302
yt-dlp/yt-dlp
132,642
Python
doe1080
nullpos
src_captions += traverse_obj(ptmd, ('captions', ..., {dict})) for stream in traverse_obj(ptmd, ('priorityList', ..., 'formitaeten', ..., {dict})): for quality in traverse_obj(stream, ('qualities', ..., {dict})): for variant in traverse_obj(quality, ('audio', ...
make this a warning ```suggestion self.report_warning(f'Skipping unsupported extension "{ext}"', video_id=video_id) ```
src_captions += traverse_obj(ptmd, ('captions', ..., {dict})) for stream in traverse_obj(ptmd, ('priorityList', ..., 'formitaeten', ..., {dict})): for quality in traverse_obj(stream, ('qualities', ..., {dict})): for variant in traverse_obj(quality, ('audio', ...
@@ -132,16 +130,31 @@ def _extract_ptmd(self, ptmd_urls, video_id, api_token=None, aspect_ratio=None): 'format_id': join_nonempty('http', stream.get('type')), 'tbr': int_or_none(self._search_regex(r'_(\d+)k_', format_url, 'tbr', default=None)), ...
yt_dlp/extractor/zdf.py
26
Python
0.714
suggestion
150
51
51
false
[ie/zdf] Fix language extraction and format sorting
13,313
yt-dlp/yt-dlp
132,642
Python
bashonly
InvalidUsernameException
continue seen_urls.add(format_url) ext = determine_ext(format_url) if ext == 'm3u8': fmts = self._extract_m3u8_formats( format_url, video_id, 'mp4', m3u8_id='hl...
wouldn't `has_audio` be more to the point? I don't like defaulting to `'none'` ```suggestion has_audio = f.get('acodec') != 'none' ```
continue seen_urls.add(format_url) ext = determine_ext(format_url) if ext == 'm3u8': fmts = self._extract_m3u8_formats( format_url, video_id, 'mp4', m3u8_id='hl...
@@ -132,16 +130,31 @@ def _extract_ptmd(self, ptmd_urls, video_id, api_token=None, aspect_ratio=None): 'format_id': join_nonempty('http', stream.get('type')), 'tbr': int_or_none(self._search_regex(r'_(\d+)k_', format_url, 'tbr', default=None)), ...
yt_dlp/extractor/zdf.py
26
Python
0.714
suggestion
165
51
51
false
[ie/zdf] Fix language extraction and format sorting
13,313
yt-dlp/yt-dlp
132,642
Python
bashonly
InvalidUsernameException
svt_id = try_get( data, lambda x: x['statistics']['dataLake']['content']['id'], str) if not svt_id: nextjs_data = self._search_nextjs_data(webpage, video_id, fatal=False) svt_id = traverse_obj(nextjs_data, ( 'props', 'urqlStat...
`description` is unbound unless the `if not svt_id: ..; if not svt_id: ...` code path is followed above. And since the tests were both updated with a description, I think it's safe to assume that we can shed all the other code paths. I am all for simplifying this extractor, since right now it looks to be 1 path of w...
series = self._download_json( 'https://api.svt.se/contento/graphql', series_slug, 'Downloading series page', query={ 'query': '''{ listablesBySlug(slugs: ["%s"]) { associatedContent(include: [productionPeriod, season]) { items { item { ... o...
@@ -295,6 +304,7 @@ def _real_extract(self, url): webpage, 'video id') info_dict = self._extract_by_video_id(svt_id, webpage) + info_dict['description'] = description
yt_dlp/extractor/svt.py
26
Python
0.857
refactor
1,799
51
51
false
[ie/svt:play] Fix extractor
13,329
yt-dlp/yt-dlp
132,642
Python
bashonly
barsnick
info_dict = self._extract_video(data, video_id) if not info_dict.get('title'): title = dict_get(info_dict, ('episode', 'series')) if not title and webpage: title = re.sub( r'\s*\|\s*.+?$', '', self._og_search_title(webpage)) if not ...
as pointed out by dirkf, the `{dict}` check is redundant ```suggestion 'modules', lambda _, v: v['details']['smartStart']['item']['videos'], 'details', any)) ```
if not info_dict.get('title'): info_dict['title'] = re.sub(r'\s*\|\s*.+?$', '', self._og_search_title(webpage)) if not info_dict.get('thumbnail'): info_dict['thumbnail'] = self._og_search_thumbnail(webpage) if not info_dict.get('description'): info_dict['descr...
@@ -252,50 +257,29 @@ def _real_extract(self, url): mobj = self._match_valid_url(url) video_id = mobj.group('id') svt_id = mobj.group('svt_id') or mobj.group('modal_id') - if svt_id: return self._extract_by_video_id(svt_id) webpage = self._download_webpage(url...
yt_dlp/extractor/svt.py
26
Python
0.714
suggestion
176
51
51
false
[ie/svt:play] Fix extractor
13,329
yt-dlp/yt-dlp
132,642
Python
bashonly
barsnick
mvpd_confirm_page_res = post_form( provider_login_page_res, 'Logging in', { mso_info['username_field']: username, mso_info['password_field']: password, }, validate_url=True) ...
- inline the payload since it's only used once - `utf-8` is the default - since we don't need to read the content of the response, just use `_request_webpage` ```suggestion self._request_webpage( 'https://idp.philo.com/auth/init/login_code', video_id, ...
mvpd_confirm_page_res = post_form( provider_login_page_res, 'Logging in', { mso_info['username_field']: username, mso_info['password_field']: password, }, validate_url=True) ...
@@ -1574,18 +1574,34 @@ def extract_redirect_url(html, url=None, fatal=False): post_form(mvpd_confirm_page_res, 'Confirming Login') elif mso_id == 'Philo': # Philo has very unique authentication method - self._download_webpage( - ...
yt_dlp/extractor/adobepass.py
26
Python
1
security
907
51
51
false
[ie/adobepass] Fix Philo MSO authentication
13,335
yt-dlp/yt-dlp
132,642
Python
bashonly
Sipherdrakon
'ident': username, 'device': 'web', 'send_confirm_link': False, 'send_token': True, 'device_ident': f'web-{uuid.uuid4().hex}', 'include_login_link': True, }...
same as above ```suggestion self._request_webpage( 'https://idp.philo.com/auth/update/login_code', video_id, 'Submitting token', data=json.dumps({'token': philo_code}).encode(), headers={ 'Conte...
'https://idp.philo.com/auth/init/login_code', video_id, 'Requesting Philo auth code', data=json.dumps({ 'ident': username, 'device': 'web', 'send_confirm_link': False, ...
@@ -1574,18 +1574,34 @@ def extract_redirect_url(html, url=None, fatal=False): post_form(mvpd_confirm_page_res, 'Confirming Login') elif mso_id == 'Philo': # Philo has very unique authentication method - self._download_webpage( - ...
yt_dlp/extractor/adobepass.py
26
Python
0.929
security
441
51
51
false
[ie/adobepass] Fix Philo MSO authentication
13,335
yt-dlp/yt-dlp
132,642
Python
bashonly
Sipherdrakon
from .common import InfoExtractor from .vimeo import VimeoIE class ShieyIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/]+)' _TESTS = [{ 'url': 'https://www.shiey.com/videos/v/train-journey-to-edge-of-serbia-ep-2', 'info_dict': { 'id': 'train-jou...
Need to exclude query args or the fragment identifier ```suggestion _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/?#]+)' ```
import json from .common import InfoExtractor from .vimeo import VimeoIE from ..utils import extract_attributes from ..utils.traversal import find_element, traverse_obj class ShieyIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'https://ww...
@@ -0,0 +1,24 @@ +from .common import InfoExtractor +from .vimeo import VimeoIE + + +class ShieyIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/]+)'
yt_dlp/extractor/shiey.py
6
Python
0.714
suggestion
149
25
31
false
[ie/shiey] Add extractor
13,354
yt-dlp/yt-dlp
132,642
Python
seproDev
iribeirocampos
from .common import InfoExtractor from .vimeo import VimeoIE class ShieyIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/]+)' _TESTS = [{ 'url': 'https://www.shiey.com/videos/v/train-journey-to-edge-of-serbia-ep-2', 'info_dict': { 'id': 'train-jou...
It seems like you never ran the tests... ```suggestion 'url': 'https://www.shiey.com/videos/v/train-journey-to-edge-of-serbia-ep-2', 'info_dict': { 'id': '1103409448', 'ext': 'mp4', 'title': 'Train Journey To Edge of Serbia (Ep. 2)', 'uploader': 'sh...
import json from .common import InfoExtractor from .vimeo import VimeoIE from ..utils import extract_attributes from ..utils.traversal import find_element, traverse_obj class ShieyIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'https://ww...
@@ -0,0 +1,24 @@ +from .common import InfoExtractor +from .vimeo import VimeoIE + + +class ShieyIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/]+)' + + _TESTS = [{ + 'url': 'https://www.shiey.com/videos/v/train-journey-to-edge-of-serbia-ep-2', + 'info_dict': { +...
yt_dlp/extractor/shiey.py
17
Python
0.786
bug
568
25
35
false
[ie/shiey] Add extractor
13,354
yt-dlp/yt-dlp
132,642
Python
seproDev
iribeirocampos
from .common import InfoExtractor from .vimeo import VimeoIE class ShieyIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/]+)' _TESTS = [{ 'url': 'https://www.shiey.com/videos/v/train-journey-to-edge-of-serbia-ep-2', 'info_dict': { 'id': 'train-jou...
This should be more robust ```suggestion oembed_html = traverse_obj(webpage, ( {find_element(attr='data-controller', value='VideoEmbed', html=True)}, {extract_attributes}, 'data-config-embed-video', {json.loads}, 'oembedHtml', {str})) return self.url_result(VimeoIE._extrac...
import json from .common import InfoExtractor from .vimeo import VimeoIE from ..utils import extract_attributes from ..utils.traversal import find_element, traverse_obj class ShieyIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'https://ww...
@@ -0,0 +1,24 @@ +from .common import InfoExtractor +from .vimeo import VimeoIE + + +class ShieyIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/]+)' + + _TESTS = [{ + 'url': 'https://www.shiey.com/videos/v/train-journey-to-edge-of-serbia-ep-2', + 'info_dict': { +...
yt_dlp/extractor/shiey.py
24
Python
0.857
refactor
358
25
35
false
[ie/shiey] Add extractor
13,354
yt-dlp/yt-dlp
132,642
Python
seproDev
iribeirocampos
from .common import InfoExtractor from .vimeo import VimeoIE class ShieyIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/]+)' _TESTS = [{ 'url': 'https://www.shiey.com/videos/v/train-journey-to-edge-of-serbia-ep-2', 'info_dict': { 'id': 'train-jou...
Needed for the other changes ```suggestion import json from .common import InfoExtractor from .vimeo import VimeoIE from ..utils import extract_attributes from ..utils.traversal import find_element, traverse_obj ```
import json from .common import InfoExtractor from .vimeo import VimeoIE from ..utils import extract_attributes from ..utils.traversal import find_element, traverse_obj class ShieyIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?shiey\.com/videos/v/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'https://ww...
@@ -0,0 +1,24 @@ +from .common import InfoExtractor +from .vimeo import VimeoIE
yt_dlp/extractor/shiey.py
4
Python
0.857
refactor
224
25
29
false
[ie/shiey] Add extractor
13,354
yt-dlp/yt-dlp
132,642
Python
seproDev
iribeirocampos
'id': '43216-outdoor-films-s-mudr-tomasem-kempnym-pomahat-potrebnym-nejen-u-nas', 'ext': 'mp4', 'title': 'Pomáhat potřebným nejen u nás', 'description': 'md5:78b538ee32f7e881ec23b9c278a0ff3a', 'release_date': '20250531', 'series': 'Outdoor Films s ...
`_search_json` matches the trailing space characters already ```suggestion r'var\s+INIT_PLAYER\s*=', webpage, 'init player', ```
'info_dict': { 'id': '43216-outdoor-films-s-mudr-tomasem-kempnym-pomahat-potrebnym-nejen-u-nas', 'ext': 'mp4', 'title': 'Pomáhat potřebným nejen u nás', 'description': 'md5:78b538ee32f7e881ec23b9c278a0ff3a', 'release_date': '20250531', 'ser...
@@ -1,46 +1,80 @@ +import re + from .common import InfoExtractor from ..utils import ( clean_html, - get_element_by_class, + extract_attributes, js_to_json, + mimetype2ext, + unified_strdate, + urljoin, ) +from ..utils.traversal import find_element, traverse_obj class TVNoeIE(InfoExtrac...
yt_dlp/extractor/tvnoe.py
26
Python
0.714
suggestion
143
51
51
false
[ie/tvnoe] Rework Extractor
13,369
yt-dlp/yt-dlp
132,642
Python
seproDev
doe1080
'release_date': '20250531', 'series': 'Outdoor Films s MUDr. Tomášem Kempným', 'thumbnail': r're:https?://www\.tvnoe\.cz/.+\.jpg', }, }, { 'url': 'https://www.tvnoe.cz/porad/43205-zamysleni-tomase-halika-7-nedele-velikonocni', 'info_dict': { 'i...
Lets also validate that src is a valid URL ```suggestion for source in traverse_obj(player, ('tracks', ..., lambda _, v: url_or_none(v['src']))): ```
'description': 'md5:78b538ee32f7e881ec23b9c278a0ff3a', 'release_date': '20250531', 'series': 'Outdoor Films s MUDr. Tomášem Kempným', 'thumbnail': r're:https?://www\.tvnoe\.cz/.+\.jpg', }, }, { 'url': 'https://www.tvnoe.cz/porad/43205-zamysleni-tomase-...
@@ -1,46 +1,80 @@ +import re + from .common import InfoExtractor from ..utils import ( clean_html, - get_element_by_class, + extract_attributes, js_to_json, + mimetype2ext, + unified_strdate, + urljoin, ) +from ..utils.traversal import find_element, traverse_obj class TVNoeIE(InfoExtrac...
yt_dlp/extractor/tvnoe.py
26
Python
0.714
suggestion
160
51
51
false
[ie/tvnoe] Rework Extractor
13,369
yt-dlp/yt-dlp
132,642
Python
seproDev
doe1080
video_id, transform_source=js_to_json, fatal=True) formats = [] for source in traverse_obj(player, ('tracks', ..., lambda _, v: v['src'])): src_url = source['src'] ext = mimetype2ext(source.get('type')) if ext == 'm3u8': fmts = self._extra...
This seems a bit risky. If the description were to contain a date we would potentially match that.
r'var\s+INIT_PLAYER\s*=', webpage, 'init player', video_id, transform_source=js_to_json) formats = [] for source in traverse_obj(player, ('tracks', ..., lambda _, v: url_or_none(v['src']))): src_url = source['src'] ext = mimetype2ext(source.get('type')) ...
@@ -1,46 +1,80 @@ +import re + from .common import InfoExtractor from ..utils import ( clean_html, - get_element_by_class, + extract_attributes, js_to_json, + mimetype2ext, + unified_strdate, + urljoin, ) +from ..utils.traversal import find_element, traverse_obj class TVNoeIE(InfoExtrac...
yt_dlp/extractor/tvnoe.py
26
Python
0.214
suggestion
98
33
35
false
[ie/tvnoe] Rework Extractor
13,369
yt-dlp/yt-dlp
132,642
Python
seproDev
doe1080
formats = [] for source in traverse_obj(player, ('tracks', ..., lambda _, v: url_or_none(v['src']))): src_url = source['src'] ext = mimetype2ext(source.get('type')) if ext == 'm3u8': fmts = self._extract_m3u8_formats( src_url, video...
`filter` is unnecessary here, right? and hanging parentheses are typically avoided per convention (with the common exceptions being tuple vars and `if`/`for` clauses) ```suggestion 'release_date': ( {clean_html}, {re.compile(r'Premiéra:\s*(\d{1,2}\.\d{1,2}\.\d{4})').findall}, ...
formats = [] for source in traverse_obj(player, ('tracks', ..., lambda _, v: url_or_none(v['src']))): src_url = source['src'] ext = mimetype2ext(source.get('type')) if ext == 'm3u8': fmts = self._extract_m3u8_formats( src_url, video...
@@ -1,46 +1,83 @@ +import re + from .common import InfoExtractor from ..utils import ( clean_html, - get_element_by_class, + extract_attributes, js_to_json, + mimetype2ext, + unified_strdate, + url_or_none, + urljoin, ) +from ..utils.traversal import find_element, traverse_obj class ...
yt_dlp/extractor/tvnoe.py
26
Python
1
suggestion
378
33
32
false
[ie/tvnoe] Rework Extractor
13,369
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'ext': 'mp4', 'title': 'Pomáhat potřebným nejen u nás', 'description': 'md5:78b538ee32f7e881ec23b9c278a0ff3a', 'release_date': '20250531', 'series': 'Outdoor Films s MUDr. Tomášem Kempným', 'thumbnail': r're:https?://www\.tvnoe\.cz/.+\.jpg', ...
```suggestion player = self._search_json( r'var\s+INIT_PLAYER\s*=', webpage, 'init player', video_id, transform_source=js_to_json) ```
'ext': 'mp4', 'title': 'Pomáhat potřebným nejen u nás', 'description': 'md5:78b538ee32f7e881ec23b9c278a0ff3a', 'release_date': '20250531', 'series': 'Outdoor Films s MUDr. Tomášem Kempným', 'thumbnail': r're:https?://www\.tvnoe\.cz/.+\.jpg', ...
@@ -1,46 +1,82 @@ +import re + from .common import InfoExtractor from ..utils import ( clean_html, - get_element_by_class, + extract_attributes, js_to_json, + mimetype2ext, + unified_strdate, + url_or_none, + urljoin, ) +from ..utils.traversal import find_element, traverse_obj class ...
yt_dlp/extractor/tvnoe.py
26
Python
0.714
suggestion
170
51
51
false
[ie/tvnoe] Rework Extractor
13,369
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'duration': 210.0, 'thumbnail': r're:https?://images\.universal-music\.de/img/assets/.+\.jpg', 'timestamp': 1513591800, 'upload_date': '20171218', 'view_count': int, }, }, { 'url': 'https://www.universal-music.de/alexander-eder/videos/der-d...
Instead of requesting the url here then later using `urlh.url`, should you not use `yt_dlp.utils.update_url_query()` and just let the extract formats call handle the request?
'thumbnail': r're:https?://images\.universal-music\.de/img/assets/.+\.jpg', 'timestamp': 1513591800, 'upload_date': '20171218', 'view_count': int, }, }, { 'url': 'https://www.universal-music.de/alexander-eder/videos/der-doktor-hat-gesagt-609533', ...
@@ -1,98 +1,56 @@ from .common import InfoExtractor -from ..utils import ( - int_or_none, - parse_filesize, - parse_iso8601, -) +from ..utils import clean_html +from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): - _WORKING = False IE_NAME = 'umg:de' IE_DES...
yt_dlp/extractor/umg.py
26
Python
0.714
refactor
174
38
35
false
[ie/umg:de] Rework extractor
13,373
yt-dlp/yt-dlp
132,642
Python
Grub4K
doe1080
from .common import InfoExtractor from ..utils import clean_html from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): IE_NAME = 'umg:de' IE_DESC = 'Universal Music Deutschland' _VALID_URL = r'https?://(?:www\.)?universal-music\.de/[^/]+/videos/(?P<id>[^/?#]+)' _TESTS...
It's better to match the video `id` directly from the URL when possible, since this makes download archive functionality more efficient (extraction can be skipped altogether if the `id` is already recorded in the archive) ```suggestion _VALID_URL = r'https?://(?:www\.)?universal-music\.de/[^/?#]+/videos/(?P<slu...
from .common import InfoExtractor from ..utils import clean_html from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): IE_NAME = 'umg:de' IE_DESC = 'Universal Music Deutschland' _VALID_URL = r'https?://(?:www\.)?universal-music\.de/[^/?#]+/videos/(?P<slug>[^/?#]+-(?P<id>\d...
@@ -1,98 +1,55 @@ from .common import InfoExtractor -from ..utils import ( - int_or_none, - parse_filesize, - parse_iso8601, -) +from ..utils import clean_html +from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): - _WORKING = False IE_NAME = 'umg:de' IE_DES...
yt_dlp/extractor/umg.py
10
Python
0.857
performance
348
35
35
false
[ie/umg:de] Rework extractor
13,373
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'description': 'md5:df2dbffcff1a74e0a7c9bef4b497aeec', 'display_id': 'jedes-wort-ist-gold-wert-457803', 'duration': 210.0, 'thumbnail': r're:https?://images\.universal-music\.de/img/assets/.+\.jpg', 'timestamp': 1513591800, 'upload_date': '20171218...
to be applied with the `_VALID_URL` suggestion above ```suggestion display_id, video_id = self._match_valid_url(url).group('slug', 'id') ```
'display_id': 'jedes-wort-ist-gold-wert-457803', 'duration': 210.0, 'thumbnail': r're:https?://images\.universal-music\.de/img/assets/.+\.jpg', 'timestamp': 1513591800, 'upload_date': '20171218', 'view_count': int, }, }, { 'url'...
@@ -1,98 +1,55 @@ from .common import InfoExtractor -from ..utils import ( - int_or_none, - parse_filesize, - parse_iso8601, -) +from ..utils import clean_html +from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): - _WORKING = False IE_NAME = 'umg:de' IE_DES...
yt_dlp/extractor/umg.py
26
Python
0.714
suggestion
151
39
37
false
[ie/umg:de] Rework extractor
13,373
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'view_count': int, }, }, { 'url': 'https://www.universal-music.de/alexander-eder/videos/der-doktor-hat-gesagt-609533', 'info_dict': { 'id': '609533', 'ext': 'mp4', 'title': 'Der Doktor hat gesagt', 'artists': ['Alexander Eder'], ...
I'd just return `artists` here since `artist` is technically deprecated ```suggestion 'artists': list(filter(None, self._html_search_meta('umg-artist-screenname', webpage))), ```
}, }, { 'url': 'https://www.universal-music.de/alexander-eder/videos/der-doktor-hat-gesagt-609533', 'info_dict': { 'id': '609533', 'ext': 'mp4', 'title': 'Der Doktor hat gesagt', 'artists': ['Alexander Eder'], 'display_id': 'der-dok...
@@ -1,98 +1,55 @@ from .common import InfoExtractor -from ..utils import ( - int_or_none, - parse_filesize, - parse_iso8601, -) +from ..utils import clean_html +from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): - _WORKING = False IE_NAME = 'umg:de' IE_DES...
yt_dlp/extractor/umg.py
26
Python
0.714
suggestion
193
33
31
false
[ie/umg:de] Rework extractor
13,373
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
}, { 'url': 'https://www.universal-music.de/alexander-eder/videos/der-doktor-hat-gesagt-609533', 'info_dict': { 'id': '609533', 'ext': 'mp4', 'title': 'Der Doktor hat gesagt', 'artists': ['Alexander Eder'], 'display_id': 'der-doktor-hat-ges...
per Grub's suggestion ```suggestion # The JSON LD description duplicates the title 'description': traverse_obj(webpage, ({find_element(cls='_3Y0Lj')}, {clean_html})), ```
'url': 'https://www.universal-music.de/alexander-eder/videos/der-doktor-hat-gesagt-609533', 'info_dict': { 'id': '609533', 'ext': 'mp4', 'title': 'Der Doktor hat gesagt', 'artists': ['Alexander Eder'], 'display_id': 'der-doktor-hat-gesagt-60953...
@@ -1,98 +1,55 @@ from .common import InfoExtractor -from ..utils import ( - int_or_none, - parse_filesize, - parse_iso8601, -) +from ..utils import clean_html +from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): - _WORKING = False IE_NAME = 'umg:de' IE_DES...
yt_dlp/extractor/umg.py
26
Python
0.714
refactor
198
31
29
false
[ie/umg:de] Rework extractor
13,373
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'upload_date': '20171218', 'view_count': int, }, }, { 'url': 'https://www.universal-music.de/alexander-eder/videos/der-doktor-hat-gesagt-609533', 'info_dict': { 'id': '609533', 'ext': 'mp4', 'title': 'Der Doktor hat gesagt', ...
to guard against empty strings (as my original suggestion would've if I hadn't made that typo) ```suggestion 'artists': traverse_obj(self._html_search_meta('umg-artist-screenname', webpage), (filter, all)), ```
'view_count': int, }, }, { 'url': 'https://www.universal-music.de/alexander-eder/videos/der-doktor-hat-gesagt-609533', 'info_dict': { 'id': '609533', 'ext': 'mp4', 'title': 'Der Doktor hat gesagt', 'artists': ['Alexander Eder'], ...
@@ -1,98 +1,54 @@ from .common import InfoExtractor -from ..utils import ( - int_or_none, - parse_filesize, - parse_iso8601, -) +from ..utils import clean_html +from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): - _WORKING = False IE_NAME = 'umg:de' IE_DES...
yt_dlp/extractor/umg.py
26
Python
0.786
suggestion
225
33
32
false
[ie/umg:de] Rework extractor
13,373
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
from .common import InfoExtractor from ..utils import clean_html from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): IE_NAME = 'umg:de' IE_DESC = 'Universal Music Deutschland' _VALID_URL = r'https?://(?:www\.)?universal-music\.de/[^/?#]+/videos/(?P<slug>[^/?#]+-(?P<id>\...
unnecessary whitespace change ```suggestion ```
from .common import InfoExtractor from ..utils import clean_html from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): IE_NAME = 'umg:de' IE_DESC = 'Universal Music Deutschland' _VALID_URL = r'https?://(?:www\.)?universal-music\.de/[^/?#]+/videos/(?P<slug>[^/?#]+-(?P<id>\d...
@@ -1,98 +1,54 @@ from .common import InfoExtractor -from ..utils import ( - int_or_none, - parse_filesize, - parse_iso8601, -) +from ..utils import clean_html +from ..utils.traversal import find_element, traverse_obj class UMGDeIE(InfoExtractor): - _WORKING = False IE_NAME = 'umg:de' IE_DES...
yt_dlp/extractor/umg.py
9
Python
0.5
suggestion
49
34
34
false
[ie/umg:de] Rework extractor
13,373
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
import json import re from .common import InfoExtractor from ..utils import ( ExtractorError, get_element_by_id, ) class MaveIE(InfoExtractor): _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)' _TESTS = [ { 'url': 'https://ochenlichnoe.mave.dig...
IMO we should relax the subdomain character class and capture the whole slug ```suggestion _VALID_URL = r'https?://(?P<channel>[\w-]+)\.mave\.digital/(?P<id>ep-\d+)' ```
import re from .common import InfoExtractor from ..utils import ( clean_html, int_or_none, parse_iso8601, urljoin, ) from ..utils.traversal import require, traverse_obj class MaveIE(InfoExtractor): _VALID_URL = r'https?://(?P<channel>[\w-]+)\.mave\.digital/(?P<id>ep-\d+)' _TESTS = [{ ...
@@ -0,0 +1,84 @@ +import json +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + get_element_by_id, +) + + +class MaveIE(InfoExtractor): + _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)'
yt_dlp/extractor/mave.py
12
Python
0.786
suggestion
176
37
37
false
[ie/mave] Add extractor for Mave Digital
13,380
yt-dlp/yt-dlp
132,642
Python
bashonly
anlar
import json import re from .common import InfoExtractor from ..utils import ( ExtractorError, get_element_by_id, ) class MaveIE(InfoExtractor): _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)' _TESTS = [ { 'url': 'https://ochenlichnoe.mave.dig...
you'll have an easier time generating & adding the test data if you format the `_TESTS` like this and unindent below: ```suggestion _TESTS = [{ ```
import re from .common import InfoExtractor from ..utils import ( clean_html, int_or_none, parse_iso8601, urljoin, ) from ..utils.traversal import require, traverse_obj class MaveIE(InfoExtractor): _VALID_URL = r'https?://(?P<channel>[\w-]+)\.mave\.digital/(?P<id>ep-\d+)' _TESTS = [{ ...
@@ -0,0 +1,84 @@ +import json +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + get_element_by_id, +) + + +class MaveIE(InfoExtractor): + _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)' + _TESTS = [ + {
yt_dlp/extractor/mave.py
14
Python
0.714
suggestion
154
39
39
false
[ie/mave] Add extractor for Mave Digital
13,380
yt-dlp/yt-dlp
132,642
Python
bashonly
anlar
from .common import InfoExtractor from ..utils import ( ExtractorError, get_element_by_id, ) class MaveIE(InfoExtractor): _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)' _TESTS = [ { 'url': 'https://ochenlichnoe.mave.digital/ep-25', ...
to go with the formatting suggestion above: ```suggestion }, { ``` and so forth
from .common import InfoExtractor from ..utils import ( clean_html, int_or_none, parse_iso8601, urljoin, ) from ..utils.traversal import require, traverse_obj class MaveIE(InfoExtractor): _VALID_URL = r'https?://(?P<channel>[\w-]+)\.mave\.digital/(?P<id>ep-\d+)' _TESTS = [{ 'url': 'htt...
@@ -0,0 +1,84 @@ +import json +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + get_element_by_id, +) + + +class MaveIE(InfoExtractor): + _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)' + _TESTS = [ + { + 'url'...
yt_dlp/extractor/mave.py
26
Python
0.571
suggestion
87
51
51
false
[ie/mave] Add extractor for Mave Digital
13,380
yt-dlp/yt-dlp
132,642
Python
bashonly
anlar
'id': 'budem-12', 'title': 'Екатерина Михайлова: "Горе от ума" не про женщин написана', 'description': 'md5:d9ce1fc1fb5fc7b7a4e7a0b84a7861c3', 'thumbnail': r're:https?://.*\.jpg$', 'ext': 'mp3', 'channel': 'Все там будем', ...
Thanks to 51887484e46ab6015c041cb1ab626a55f25a03bd, we are now able to easily parse the JSON embedded in these webpages with `_search_nuxt_json`. I've gone ahead and merged master into your PR branch, so we can do this: ```suggestion channel_id, slug = self._match_valid_url(url).group('channel', 'id') ...
'thumbnail': r're:https://.+/storage/podcasts/.+\.jpg', 'series': 'Очень личное', 'series_id': '2e0c3749-6df2-4946-82f4-50691419c065', 'season': 'Season 3', 'season_number': 3, 'episode': 'Episode 3', 'episode_number': 3, 't...
@@ -0,0 +1,84 @@ +import json +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + get_element_by_id, +) + + +class MaveIE(InfoExtractor): + _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)' + _TESTS = [ + { + 'url'...
yt_dlp/extractor/mave.py
26
Python
0.929
suggestion
684
51
51
false
[ie/mave] Add extractor for Mave Digital
13,380
yt-dlp/yt-dlp
132,642
Python
bashonly
anlar
return { 'id': video_id, 'title': title, 'description': self._og_search_description(webpage), 'channel': channel, 'channel_id': channel_id, 'channel_url': channel_url, 'url': self._mave_link(webpage, video_id), 'thum...
If my next couple suggestions are applied, we won't need any of this (it has been obsoleted by `_search_nuxt_json`). However, we should move the API URL to a class constant ```suggestion ```
'duration': 3664, 'thumbnail': r're:https://.+/storage/podcasts/.+\.jpg', 'series': 'Все там будем', 'series_id': 'fe9347bf-c009-4ebd-87e8-b06f2f324746', 'season': 'Season 2', 'season_number': 2, 'episode': 'Episode 5', 'epi...
@@ -0,0 +1,84 @@ +import json +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + get_element_by_id, +) + + +class MaveIE(InfoExtractor): + _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)' + _TESTS = [ + { + 'url'...
yt_dlp/extractor/mave.py
26
Python
0.786
suggestion
192
27
50
false
[ie/mave] Add extractor for Mave Digital
13,380
yt-dlp/yt-dlp
132,642
Python
bashonly
anlar
video_id = f'{channel_id}-{short_id}' webpage = self._download_webpage(url, video_id) # Format: "TITLE — Подкаст «CHANNEL»" page_title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title') match = re.search(r'^(.+?)\s*—\s*(.+?)«(.+?)»', page_title) title...
```suggestion _API_BASE_URL = 'https://api.mave.digital/' def _real_extract(self, url): ```
'display_id': 'budem-ep-12', 'title': 'Екатерина Михайлова: "Горе от ума" не про женщин написана', 'description': 'md5:fa3bdd59ee829dfaf16e3efcb13f1d19', 'uploader': 'Полина Цветкова+Евгения Акопова', 'channel': 'Все там будем', 'channel_id': 'bude...
@@ -0,0 +1,84 @@ +import json +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + get_element_by_id, +) + + +class MaveIE(InfoExtractor): + _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)' + _TESTS = [ + { + 'url'...
yt_dlp/extractor/mave.py
26
Python
0.786
refactor
104
38
51
false
[ie/mave] Add extractor for Mave Digital
13,380
yt-dlp/yt-dlp
132,642
Python
bashonly
anlar
def _real_extract(self, url): channel_id, short_id = self._match_valid_url(url).group('channel_id', 'short_id') channel_url = f'https://{channel_id}.mave.digital/' video_id = f'{channel_id}-{short_id}' webpage = self._download_webpage(url, video_id) # Format: "TITLE — По...
with `traverse_obj`, we can safely & easily traverse the data we got with `_search_nuxt_json`, and get more metadata in the process: ```suggestion return { 'display_id': display_id, 'channel_id': channel_id, 'channel_url': f'https://{channel_id}.mave.digital/', ...
'url': 'https://budem.mave.digital/ep-12', 'md5': 'e1ce2780fcdb6f17821aa3ca3e8c919f', 'info_dict': { 'id': '41898bb5-ff57-4797-9236-37a8e537aa21', 'ext': 'mp3', 'display_id': 'budem-ep-12', 'title': 'Екатерина Михайлова: "Горе от ума" не про женщин...
@@ -0,0 +1,84 @@ +import json +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + get_element_by_id, +) + + +class MaveIE(InfoExtractor): + _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)' + _TESTS = [ + { + 'url'...
yt_dlp/extractor/mave.py
26
Python
0.929
security
1,696
43
51
false
[ie/mave] Add extractor for Mave Digital
13,380
yt-dlp/yt-dlp
132,642
Python
bashonly
anlar
{ 'url': 'https://ochenlichnoe.mave.digital/ep-25', 'md5': 'aa3e513ef588b4366df1520657cbc10c', 'info_dict': { 'id': 'ochenlichnoe-25', 'title': 'Между мной и миром: психология самооценки', 'description': 'md5:83183d7002dc32fbebc...
when running these tests to update the data, I would just remove everything except `id` and `ext`, and the test script will output the rest of the keys+values for you
_VALID_URL = r'https?://(?P<channel>[\w-]+)\.mave\.digital/(?P<id>ep-\d+)' _TESTS = [{ 'url': 'https://ochenlichnoe.mave.digital/ep-25', 'md5': 'aa3e513ef588b4366df1520657cbc10c', 'info_dict': { 'id': '4035f587-914b-44b6-aa5a-d76685ad9bc2', 'ext': 'mp3', ...
@@ -0,0 +1,84 @@ +import json +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + get_element_by_id, +) + + +class MaveIE(InfoExtractor): + _VALID_URL = r'https?://(?P<channel_id>[a-z]+)\.mave\.digital/ep-(?P<short_id>[0-9]+)' + _TESTS = [ + { + 'url'...
yt_dlp/extractor/mave.py
26
Python
0.571
suggestion
166
51
51
false
[ie/mave] Add extractor for Mave Digital
13,380
yt-dlp/yt-dlp
132,642
Python
bashonly
anlar
parse_iso8601, urljoin, ) from ..utils.traversal import require, traverse_obj class MaveIE(InfoExtractor): _VALID_URL = r'https?://(?P<channel>[\w-]+)\.mave\.digital/(?P<id>ep-\d+)' _TESTS = [{ 'url': 'https://ochenlichnoe.mave.digital/ep-25', 'md5': 'aa3e513ef588b4366df1520657cbc10c',...
```suggestion 'thumbnail': r're:https://.+/storage/podcasts/.+\.jpg', ```
parse_iso8601, urljoin, ) from ..utils.traversal import require, traverse_obj class MaveIE(InfoExtractor): _VALID_URL = r'https?://(?P<channel>[\w-]+)\.mave\.digital/(?P<id>ep-\d+)' _TESTS = [{ 'url': 'https://ochenlichnoe.mave.digital/ep-25', 'md5': 'aa3e513ef588b4366df1520657cbc10c',...
@@ -0,0 +1,107 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + clean_html, + int_or_none, + parse_iso8601, + urljoin, +) +from ..utils.traversal import require, traverse_obj + + +class MaveIE(InfoExtractor): + _VALID_URL = r'https?://(?P<channel>[\w-]+)\.mave\.digital/(?P<id>e...
yt_dlp/extractor/mave.py
26
Python
0.714
suggestion
87
51
51
false
[ie/mave] Add extractor for Mave Digital
13,380
yt-dlp/yt-dlp
132,642
Python
bashonly
anlar
'season': 'Season 3', 'season_number': 3, 'episode': 'Episode 3', 'episode_number': 3, 'timestamp': 1747817300, 'upload_date': '20250521', }, }, { 'url': 'https://budem.mave.digital/ep-12', 'md5': 'e1ce2780fcdb6f17821aa3...
```suggestion 'thumbnail': r're:https://.+/storage/podcasts/.+\.jpg', ```
'season': 'Season 3', 'season_number': 3, 'episode': 'Episode 3', 'episode_number': 3, 'timestamp': 1747817300, 'upload_date': '20250521', }, }, { 'url': 'https://budem.mave.digital/ep-12', 'md5': 'e1ce2780fcdb6f17821aa3...
@@ -0,0 +1,107 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + clean_html, + int_or_none, + parse_iso8601, + urljoin, +) +from ..utils.traversal import require, traverse_obj + + +class MaveIE(InfoExtractor): + _VALID_URL = r'https?://(?P<channel>[\w-]+)\.mave\.digital/(?P<id>e...
yt_dlp/extractor/mave.py
26
Python
0.714
suggestion
87
51
51
false
[ie/mave] Add extractor for Mave Digital
13,380
yt-dlp/yt-dlp
132,642
Python
bashonly
anlar
def _search_nextjs_data(self, webpage, video_id, *, fatal=True, default=NO_DEFAULT, **kw): if default == '{}': self._downloader.deprecation_warning('using `default=\'{}\'` is deprecated, use `default={}` instead') default = {} if default is not NO_DEFAULT: fatal =...
```suggestion if data and isinstance(name, str) and name[:1] == '$': ```
traverse_json_ld(json_ld) return filter_dict(info) def _search_nextjs_data(self, webpage, video_id, *, fatal=True, default=NO_DEFAULT, **kw): if default == '{}': self._downloader.deprecation_warning('using `default=\'{}\'` is deprecated, use `default={}` instead') de...
@@ -1779,6 +1780,59 @@ def _search_nextjs_data(self, webpage, video_id, *, fatal=True, default=NO_DEFAU r'<script[^>]+id=[\'"]__NEXT_DATA__[\'"][^>]*>', webpage, 'next.js data', video_id, end_pattern='</script>', fatal=fatal, default=default, **kw) + def _search_nextjs_v13_data(self, webp...
yt_dlp/extractor/common.py
26
Python
0.571
suggestion
90
51
51
false
[ie] Add `_search_nextjs_v13_data` helper
13,398
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
continue else: break traverse_json_ld(json_ld) return filter_dict(info) def _search_nextjs_data(self, webpage, video_id, *, fatal=True, default=NO_DEFAULT, **kw): if default == '{}': self._downloader.deprecation_warning('u...
```suggestion if not isinstance(flight_data, list): ```
if is_type(video, 'VideoObject'): extract_video_object(video) if expected_type is None: continue else: break traverse_json_ld(json_ld) return filter_dict(info) def _search_nextjs_data(self, ...
@@ -1779,6 +1780,59 @@ def _search_nextjs_data(self, webpage, video_id, *, fatal=True, default=NO_DEFAU r'<script[^>]+id=[\'"]__NEXT_DATA__[\'"][^>]*>', webpage, 'next.js data', video_id, end_pattern='</script>', fatal=fatal, default=default, **kw) + def _search_nextjs_v13_data(self, webp...
yt_dlp/extractor/common.py
26
Python
0.571
suggestion
69
51
51
false
[ie] Add `_search_nextjs_v13_data` helper
13,398
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
extract_nsig = self._cached(self._extract_n_function_from_code, 'nsig func', player_url) ret = extract_nsig(jsi, func_code)(s) except JSInterpreter.Exception as e: try: jsi = PhantomJSwrapper(self, timeout=5000) except ExtractorError: ...
```suggestion pattern = r'''(?x) \{\s*return\s+%s\[%d\]\s*\+\s*(?P<argname>[a-zA-Z0-9_$]+)\s*\} ''' % (re.escape(varname), global_list.index(debug_str)) ```
extract_nsig = self._cached(self._extract_n_function_from_code, 'nsig func', player_url) ret = extract_nsig(jsi, func_code)(s) except JSInterpreter.Exception as e: try: jsi = PhantomJSwrapper(self, timeout=5000) except ExtractorError: ...
@@ -2229,20 +2229,18 @@ def _decrypt_nsig(self, s, video_id, player_url): def _extract_n_function_name(self, jscode, player_url=None): varname, global_list = self._interpret_player_js_global_var(jscode, player_url) if debug_str := traverse_obj(global_list, (lambda _, v: v.endswith('-_w8_'), any))...
yt_dlp/extractor/youtube/_video.py
26
Python
0.929
bug
200
51
51
false
[ie/youtube] Rework nsig function name extraction
13,403
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
f'Native nsig extraction failed: Trying with PhantomJS\n' f' n = {s} ; player = {player_url}', video_id) self.write_debug(e, only_once=True) args, func_body = func_code ret = jsi.execute( f'console.log(function({", ".join(args)...
```suggestion pattern = r'''(?x) \{\s*\)%s\(\s* (?: (?P<funcname1>[a-zA-Z0-9_$]+)\s*noitcnuf\s* |noitcnuf\s*=\s*(?P<funcname2>[a-zA-Z0-9_$]+)(?:\s+rav)? ) ''' % re.escape(ma...
f'Native nsig extraction failed: Trying with PhantomJS\n' f' n = {s} ; player = {player_url}', video_id) self.write_debug(e, only_once=True) args, func_body = func_code ret = jsi.execute( f'console.log(function({", ".join(args)...
@@ -2229,20 +2229,18 @@ def _decrypt_nsig(self, s, video_id, player_url): def _extract_n_function_name(self, jscode, player_url=None): varname, global_list = self._interpret_player_js_global_var(jscode, player_url) if debug_str := traverse_obj(global_list, (lambda _, v: v.endswith('-_w8_'), any))...
yt_dlp/extractor/youtube/_video.py
26
Python
0.786
security
352
51
51
false
[ie/youtube] Rework nsig function name extraction
13,403
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
f' n = {s} ; player = {player_url}', video_id) self.write_debug(e, only_once=True) args, func_body = func_code ret = jsi.execute( f'console.log(function({", ".join(args)}) {{ {func_body} }}({s!r}));', video_id=video_id, note='E...
```suggestion )[;\n] ```
f' n = {s} ; player = {player_url}', video_id) self.write_debug(e, only_once=True) args, func_body = func_code ret = jsi.execute( f'console.log(function({", ".join(args)}) {{ {func_body} }}({s!r}));', video_id=video_id, note='E...
@@ -2229,20 +2229,20 @@ def _decrypt_nsig(self, s, video_id, player_url): def _extract_n_function_name(self, jscode, player_url=None): varname, global_list = self._interpret_player_js_global_var(jscode, player_url) if debug_str := traverse_obj(global_list, (lambda _, v: v.endswith('-_w8_'), any))...
yt_dlp/extractor/youtube/_video.py
26
Python
0.429
suggestion
46
51
51
false
[ie/youtube] Rework nsig function name extraction
13,403
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
'ir9-V6cdbCiyKxhr', '9YE85kNjZiS4', ), ( 'https://www.youtube.com/s/player/20830619/player-plasma-ias-phone-en_US.vflset/base.js', 'ir9-V6cdbCiyKxhr', '9YE85kNjZiS4', ), ( 'https://www.youtube.com/s/player/20830619/player-plasma-ias-tablet-en_US.vflset/base.js', '...
```suggestion ), ( 'https://www.youtube.com/s/player/fc2a56a5/tv-player-ias.vflset/tv-player-ias.js', 'qTKWg_Il804jd2kAC', 'OtUAm2W6gyzJjB9u', ), ```
'ir9-V6cdbCiyKxhr', '9YE85kNjZiS4', ), ( 'https://www.youtube.com/s/player/20830619/player-plasma-ias-phone-en_US.vflset/base.js', 'ir9-V6cdbCiyKxhr', '9YE85kNjZiS4', ), ( 'https://www.youtube.com/s/player/20830619/player-plasma-ias-tablet-en_US.vflset/base.js', '...
@@ -320,6 +320,10 @@ 'https://www.youtube.com/s/player/59b252b9/player_ias.vflset/en_US/base.js', 'D3XWVpYgwhLLKNK4AGX', 'aZrQ1qWJ5yv5h', ), + ( + 'https://www.youtube.com/s/player/fc2a56a5/player_ias.vflset/en_US/base.js', + 'qTKWg_Il804jd2kAC', 'OtUAm2W6gyzJjB9u', + ),
test/test_youtube_signature.py
26
Python
0.714
suggestion
183
51
51
false
[ie/youtube] Rework nsig function name extraction
13,403
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
'url': 'http://www.history.com/videos/history-of-valentines-day', 'only_matching': True, }, { 'url': 'https://play.aetv.com/shows/duck-dynasty/videos/best-of-duck-dynasty-getting-quack-in-shape', 'only_matching': True, }] def _real_extract(self, url): domain, canonic...
just formatting ```suggestion return self._download_json( 'https://yoga.appsvcs.aetnd.com/graphql', slug, query={'brand': brand}, headers={'Content-Type': 'application/json'}, data=json.dumps({ 'query': '''{ %s(slug: "%s") { %s } }''' % (reso...
'url': 'http://www.history.com/videos/history-of-valentines-day', 'only_matching': True, }, { 'url': 'https://play.aetv.com/shows/duck-dynasty/videos/best-of-duck-dynasty-getting-quack-in-shape', 'only_matching': True, }] def _real_extract(self, url): domain, canonic...
@@ -203,19 +204,22 @@ def _real_extract(self, url): class AENetworksListBaseIE(AENetworksBaseIE): def _call_api(self, resource, slug, brand, fields): - return self._download_json( - 'https://yoga.appsvcs.aetnd.com/graphql', - slug, query={'brand': brand}, data=urlencode_postdata({ -...
yt_dlp/extractor/aenetworks.py
26
Python
0.929
suggestion
404
51
51
false
[ie/aenetworks] Fix playlist extractors
13,408
yt-dlp/yt-dlp
132,642
Python
bashonly
Sipherdrakon
'ext': 'wav', 'title': 'Flame Shadow', 'album': 'Flame Shadow', 'artists': ['塞壬唱片-MSR'], 'description': 'md5:19e2acfcd1b65b41b29e8079ab948053', 'thumbnail': r're:https?://web\.hycdn\.cn/siren/pic/.+\.jpg', }, }, { 'url': 'https:...
Error handling should be non-fatal; we don't want to inadvertently raise a KeyError when checking for an error. Also I'd prefer to only make this an expected error if we're sure we have a message from the site ```suggestion if traverse_obj(song, 'code') != 0: msg = traverse_obj(song, ('msg', {str...
'title': 'Flame Shadow', 'album': 'Flame Shadow', 'artists': ['塞壬唱片-MSR'], 'description': 'md5:19e2acfcd1b65b41b29e8079ab948053', 'thumbnail': r're:https?://web\.hycdn\.cn/siren/pic/.+\.jpg', }, }, { 'url': 'https://monster-siren.hypergryph...
@@ -1,32 +1,65 @@ from .common import InfoExtractor -from ..utils import js_to_json, traverse_obj +from ..utils import ( + ExtractorError, + clean_html, + url_or_none, +) +from ..utils.traversal import subs_list_to_dict, traverse_obj class MonsterSirenHypergryphMusicIE(InfoExtractor): + IE_NAME = 'mon...
yt_dlp/extractor/hypergryph.py
26
Python
1
refactor
431
47
48
false
[ie/hypergryph] Improve metadata extraction
13,415
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'description': 'md5:19e2acfcd1b65b41b29e8079ab948053', 'thumbnail': r're:https?://web\.hycdn\.cn/siren/pic/.+\.jpg', }, }, { 'url': 'https://monster-siren.hypergryph.com/music/514518', 'info_dict': { 'id': '514518', 'ext': 'wav', 't...
Since this code is only extracting metadata, it should be non-fatal ```suggestion album = None if album_id := traverse_obj(song, ('data', 'albumCid', {str})): album = self._download_json(f'{self._API_BASE}/album/{album_id}/detail', album_id, fatal=False) ```
'thumbnail': r're:https?://web\.hycdn\.cn/siren/pic/.+\.jpg', }, }, { 'url': 'https://monster-siren.hypergryph.com/music/514518', 'info_dict': { 'id': '514518', 'ext': 'wav', 'title': 'Heavenly Me (Instrumental)', 'album': 'Heavenly...
@@ -1,32 +1,65 @@ from .common import InfoExtractor -from ..utils import js_to_json, traverse_obj +from ..utils import ( + ExtractorError, + clean_html, + url_or_none, +) +from ..utils.traversal import subs_list_to_dict, traverse_obj class MonsterSirenHypergryphMusicIE(InfoExtractor): + IE_NAME = 'mon...
yt_dlp/extractor/hypergryph.py
26
Python
0.857
refactor
291
43
44
false
[ie/hypergryph] Improve metadata extraction
13,415
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'album': 'Heavenly Me', 'artists': ['塞壬唱片-MSR', 'AIYUE blessed : 理名'], 'description': 'md5:ce790b41c932d1ad72eb791d1d8ae598', 'thumbnail': r're:https?://web\.hycdn\.cn/siren/pic/.+\.jpg', }, }] def _real_extract(self, url): audio_id = self._match_...
```py 'subtitles': ({'url': ('lyricUrl', {url_or_none})}, all, {subs_list_to_dict(lang='en')}), ```
'artists': ['塞壬唱片-MSR', 'AIYUE blessed : 理名'], 'description': 'md5:ce790b41c932d1ad72eb791d1d8ae598', 'thumbnail': r're:https?://web\.hycdn\.cn/siren/pic/.+\.jpg', }, }] def _real_extract(self, url): audio_id = self._match_id(url) song = self._downloa...
@@ -1,32 +1,65 @@ from .common import InfoExtractor -from ..utils import js_to_json, traverse_obj +from ..utils import ( + ExtractorError, + clean_html, + url_or_none, +) +from ..utils.traversal import subs_list_to_dict, traverse_obj class MonsterSirenHypergryphMusicIE(InfoExtractor): + IE_NAME = 'mon...
yt_dlp/extractor/hypergryph.py
26
Python
0.714
suggestion
117
34
35
false
[ie/hypergryph] Improve metadata extraction
13,415
yt-dlp/yt-dlp
132,642
Python
bashonly
doe1080
'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$', }, }] def _real_extract(self, url): episode_id = self._match_id(url) headers = self.geo_verification_headers() webpage = self._download_webpage(url, episode_id, headers=headers) if '您所在的地区无法观看本片' in webpage: ...
line too long ```suggestion geo_blocked = traverse_obj(play_info, ( 'raw', 'data', 'plugins', lambda _, v: v['name'] == 'AreaLimitPanel', 'config', 'is_block', {bool}, any)) ```
'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$', }, }] def _real_extract(self, url): episode_id = self._match_id(url) headers = self.geo_verification_headers() webpage = self._download_webpage(url, episode_id, headers=headers) if '您所在的地区无法观看本片' in webpage: ...
@@ -879,12 +899,25 @@ def _real_extract(self, url): 'Extracting episode', query={'fnval': 12240, 'ep_id': episode_id}, headers=headers)) + geo_blocked = traverse_obj(play_info, ('raw', 'data', 'plugins', lambda _, v: v['name'] == 'AreaLimitPanel', 'config', 'is_block', {bool},...
yt_dlp/extractor/bilibili.py
26
Python
0.786
refactor
201
51
51
false
[ie/BiliBiliBangumi] Fix extractor
13,416
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
headers['Referer'] = url play_info = ( self._search_json( r'playurlSSRData\s*=', webpage, 'embedded page info', episode_id, end_pattern='\n', default=None) or self._download_json( 'https://api.bilibili.com/pgc/player/web/v2/playurl...
I *think* the `x and` is unnecessary? But lemme know if it's not ```suggestion 'result', 'play_check', 'play_detail', {lambda x: x == 'PLAY_PREVIEW'}), # vs 'PLAY_WHOLE' ('raw', 'data', 'play_video_type', {lambda x: x == 'preview'}), # vs 'whole' ```
headers['Referer'] = url play_info = ( self._search_json( r'playurlSSRData\s*=', webpage, 'embedded page info', episode_id, end_pattern='\n', default=None) or self._download_json( 'https://api.bilibili.com/pgc/player/web/v2/playurl...
@@ -879,12 +899,25 @@ def _real_extract(self, url): 'Extracting episode', query={'fnval': 12240, 'ep_id': episode_id}, headers=headers)) + geo_blocked = traverse_obj(play_info, ('raw', 'data', 'plugins', lambda _, v: v['name'] == 'AreaLimitPanel', 'config', 'is_block', {bool},...
yt_dlp/extractor/bilibili.py
26
Python
0.929
suggestion
280
51
51
false
[ie/BiliBiliBangumi] Fix extractor
13,416
yt-dlp/yt-dlp
132,642
Python
bashonly
c-basalt
play_info = ( self._search_json( r'playurlSSRData\s*=', webpage, 'embedded page info', episode_id, end_pattern='\n', default=None) or self._download_json( 'https://api.bilibili.com/pgc/player/web/v2/playurl', episode_id, 'Ex...
```suggestion if traverse_obj(play_info, (( ('result', 'play_check', 'play_detail'), ('raw', 'data', 'play_video_type'), ), any, {lambda x: x in ('PLAY_PREVIEW', 'preview')})): ``` perhaps something like this?
play_info = ( self._search_json( r'playurlSSRData\s*=', webpage, 'embedded page info', episode_id, end_pattern='\n', default=None) or self._download_json( 'https://api.bilibili.com/pgc/player/web/v2/playurl', episode_id, 'Ex...
@@ -879,12 +899,26 @@ def _real_extract(self, url): 'Extracting episode', query={'fnval': 12240, 'ep_id': episode_id}, headers=headers)) + geo_blocked = traverse_obj(play_info, ( + 'raw', 'data', 'plugins', lambda _, v: v['name'] == 'AreaLimitPanel', 'config', 'is_b...
yt_dlp/extractor/bilibili.py
26
Python
0.929
question
255
51
51
false
[ie/BiliBiliBangumi] Fix extractor
13,416
yt-dlp/yt-dlp
132,642
Python
Grub4K
c-basalt
import re from .common import InfoExtractor from ..utils import ( ExtractorError, traverse_obj, ) class FaulioLiveIE(InfoExtractor): _VALID_URL = ( r'https?://(?P<domain>aloula\.sba\.sa|maraya\.sba\.net\.ae|sat7plus\.org)/' r'(?:en/)?live/(?P<faulio_url>[a-zA-Z0-9\-]+)' ) _TESTS ...
```suggestion from ..utils import ExtractorError from ..utils.traversal import traverse_obj ```
import re import urllib.parse from .common import InfoExtractor from ..utils import js_to_json, url_or_none from ..utils.traversal import traverse_obj class FaulioLiveIE(InfoExtractor): _DOMAINS = ( 'aloula.sba.sa', 'maraya.sba.net.ae', 'sat7plus.org', ) _VALID_URL = fr'https?://(...
@@ -0,0 +1,104 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + traverse_obj, +)
yt_dlp/extractor/faulio.py
7
Python
0.786
refactor
98
32
32
false
[ie/FaulioLive] Add extractor
13,421
yt-dlp/yt-dlp
132,642
Python
doe1080
CasperMcFadden95