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
if server_js_data: video_data = extract_video_data(server_js_data.get('instances', [])) def extract_from_jsmods_instances(js_data): if js_data: return extract_video_data(try_get( js_data, lambda x: x['jsmods']['instances'], list) or []) ...
```suggestion r'data-sjs>({.*?%s.*?})</script>' % _filter, ```
if server_js_data: video_data = extract_video_data(server_js_data.get('instances', [])) def extract_from_jsmods_instances(js_data): if js_data: return extract_video_data(try_get( js_data, lambda x: x['jsmods']['instances'], list) or []) ...
@@ -493,14 +509,19 @@ def process_formats(info): def extract_relay_data(_filter): return self._parse_json(self._search_regex( - r'handleWithCustomApplyEach\([^,]+,\s*({.*?%s.*?})\);' % _filter, + r'data-sjs>({.*?%s.*?})<\/script' % _filter,
yt_dlp/extractor/facebook.py
26
Python
0.571
suggestion
80
51
51
false
[extractor/Facebook] fix: Changed json data retrieval
7,890
yt-dlp/yt-dlp
132,642
Python
bashonly
ringus1
formats.extend(self._parse_mpd_formats( compat_etree_fromstring(urllib.parse.unquote_plus(dash_manifest)), mpd_url=video.get('dash_manifest_url'))) def process_formats(info): # Downloads with browser's User-Agent are rate limited. Working arou...
```suggestion else: return traverse_obj(require, ( ..., ..., '__bbox', 'require', lambda _, v: 'RelayPrefetchedStreamCache' in v, ..., ..., '__bbox', 'result', 'data', {dict}), get_all=False) or {} ``` ~~Do we need the `if/else` t...
formats.extend(self._parse_mpd_formats( compat_etree_fromstring(urllib.parse.unquote_plus(dash_manifest)), mpd_url=video.get('dash_manifest_url'))) def process_formats(info): # Downloads with browser's User-Agent are rate limited. Working arou...
@@ -493,14 +509,19 @@ def process_formats(info): def extract_relay_data(_filter): return self._parse_json(self._search_regex( - r'handleWithCustomApplyEach\([^,]+,\s*({.*?%s.*?})\);' % _filter, + r'data-sjs>({.*?%s.*?})<\/script' % _filter, webpage,...
yt_dlp/extractor/facebook.py
26
Python
0.857
bug
432
51
51
false
[extractor/Facebook] fix: Changed json data retrieval
7,890
yt-dlp/yt-dlp
132,642
Python
bashonly
ringus1
# with non-browser User-Agent. for f in info['formats']: f.setdefault('http_headers', {})['User-Agent'] = 'facebookexternalhit/1.1' info['_format_sort_fields'] = ('res', 'quality') def extract_relay_data(_filter): return self._parse_json(self._sea...
Is this necessary? I'm not saying it's wrong to change it, just wondering why
# with non-browser User-Agent. for f in info['formats']: f.setdefault('http_headers', {})['User-Agent'] = 'facebookexternalhit/1.1' info['_format_sort_fields'] = ('res', 'quality') def extract_relay_data(_filter): return self._parse_json(self._sea...
@@ -511,7 +532,7 @@ def extract_relay_prefetched_data(_filter): if not video_data: data = extract_relay_prefetched_data( - r'"(?:dash_manifest|playable_url(?:_quality_hd)?)"\s*:\s*"[^"]+"') + r'"(?:dash_manifest|playable_url(?:_quality_hd)?)')
yt_dlp/extractor/facebook.py
26
Python
0.286
bug
77
51
51
false
[extractor/Facebook] fix: Changed json data retrieval
7,890
yt-dlp/yt-dlp
132,642
Python
bashonly
ringus1
formats.extend(self._parse_mpd_formats( compat_etree_fromstring(urllib.parse.unquote_plus(dash_manifest)), mpd_url=video.get('dash_manifest_url'))) def process_formats(info): # Downloads with browser's User-Agent are rate limited. Working arou...
```suggestion def extract_relay_prefetched_data(_filter): return traverse_obj(extract_relay_data(_filter), ( 'require', (None, (..., ..., ..., '__bbox', 'require')), lambda _, v: 'RelayPrefetchedStreamCache' in v, ..., ..., '__bbox', 'result', 'da...
formats.extend(self._parse_mpd_formats( compat_etree_fromstring(urllib.parse.unquote_plus(dash_manifest)), mpd_url=video.get('dash_manifest_url'))) def process_formats(info): # Downloads with browser's User-Agent are rate limited. Working arou...
@@ -493,14 +509,19 @@ def process_formats(info): def extract_relay_data(_filter): return self._parse_json(self._search_regex( - r'handleWithCustomApplyEach\([^,]+,\s*({.*?%s.*?})\);' % _filter, + r'data-sjs>({.*?%s.*?})</script>' % _filter, webpage,...
yt_dlp/extractor/facebook.py
26
Python
0.857
performance
359
51
51
false
[extractor/Facebook] fix: Changed json data retrieval
7,890
yt-dlp/yt-dlp
132,642
Python
bashonly
ringus1
self.report_warning('unable to log in: %s' % error_to_compat_str(err)) return def _extract_from_url(self, url, video_id): webpage = self._download_webpage( url.replace('://m.facebook.com/', '://www.facebook.com/'), video_id) def extract_metadata(webpage): ...
This can cause catastrophic backtracking. Try to see if there's a better way. Can still merge if no easy solution is found, but it is something to be aware of.
if not fb_dtsg or not h: return check_form = { 'fb_dtsg': fb_dtsg, 'h': h, 'name_action_selected': 'dont_save', } check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form)) check_...
@@ -401,9 +417,9 @@ def _extract_from_url(self, url, video_id): def extract_metadata(webpage): post_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall( - r'handleWithCustomApplyEach\(\s*ScheduledApplyEach\s*,\s*(\{.+?\})\s*\);', webpage)] + r'dat...
yt_dlp/extractor/facebook.py
26
Python
0.429
suggestion
159
51
51
false
[extractor/Facebook] fix: Changed json data retrieval
7,890
yt-dlp/yt-dlp
132,642
Python
pukkandan
ringus1
'expected_warnings': ['HTTP Error 404'], 'skip': 'This content is no longer available', }, { 'url': 'http://www.wat.tv/video/gregory-lemarchal-voix-ange-6z1v7_6ygkj_.html', 'md5': 'b16574df2c3cd1a36ca0098f2a791925', 'info_dict': { ...
```suggestion 'params': {'skip_download': 'm3u8'}, ```
'expected_warnings': ['HTTP Error 404'], 'skip': 'This content is no longer available', }, { 'url': 'http://www.wat.tv/video/gregory-lemarchal-voix-ange-6z1v7_6ygkj_.html', 'md5': 'b16574df2c3cd1a36ca0098f2a791925', 'info_dict': { ...
@@ -41,6 +41,18 @@ class WatIE(InfoExtractor): 'expected_warnings': ["Ce contenu n'est pas disponible pour l'instant."], 'skip': 'This content is no longer available', }, + { + 'url': 'wat:14010600', + 'info_dict': { + 'id': '14010600', + ...
yt_dlp/extractor/wat.py
26
Python
0.571
suggestion
68
51
51
false
fix(wat.tv): remove `MYTF1` context to remove "Permission insuffisante" error
7,898
yt-dlp/yt-dlp
132,642
Python
bashonly
davinkevin
from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, parse_qs, time_seconds, traverse_obj, ) class PIAULIZAPortalIE(InfoExtractor): IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' _VALID_URL = r'https?://ulizaportal\.jp/pages/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f...
```suggestion _VALID_URL = r'https?://(?:www\.)?ulizaportal\.jp/pages/(?P<id>[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12})' ```
from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, parse_qs, time_seconds, traverse_obj, ) class PIAULIZAPortalIE(InfoExtractor): IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' _VALID_URL = r'https?://(?:www\.)?ulizaportal\.jp/pages/(?P<id>[\da-f]{8}-(?:[\da...
@@ -0,0 +1,77 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_qs, + time_seconds, + traverse_obj, +) + + +class PIAULIZAPortalIE(InfoExtractor): + IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' + _VALID_URL = r'https?://ulizaportal\.jp/pages/(?P<i...
yt_dlp/extractor/piaulizaportal.py
13
Python
0.714
suggestion
129
38
38
false
[ie/PIAULIZAPortal] Add extractor
7,903
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
}, }, { 'url': 'https://ulizaportal.jp/pages/005e1b23-fe93-5780-19a0-98e917cc4b7d?expires=4102412400&signature=f422a993b683e1068f946caf406d211c17d1ef17da8bef3df4a519502155aa91&version=1', 'info_dict': { 'id': '005e1b23-fe93-5780-19a0-98e917cc4b7d', 'title': '【確認用】視聴サン...
```suggestion r'<script [^>]*\bsrc="(https://player-api\.p\.uliza\.jp/v1/players/[^"]+)"', ```
}, }, { 'url': 'https://ulizaportal.jp/pages/005e1b23-fe93-5780-19a0-98e917cc4b7d?expires=4102412400&signature=f422a993b683e1068f946caf406d211c17d1ef17da8bef3df4a519502155aa91&version=1', 'info_dict': { 'id': '005e1b23-fe93-5780-19a0-98e917cc4b7d', 'title': '【確認用】視聴サン...
@@ -0,0 +1,77 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_qs, + time_seconds, + traverse_obj, +) + + +class PIAULIZAPortalIE(InfoExtractor): + IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' + _VALID_URL = r'https?://ulizaportal\.jp/pages/(?P<i...
yt_dlp/extractor/piaulizaportal.py
26
Python
0.714
suggestion
112
51
48
false
[ie/PIAULIZAPortal] Add extractor
7,903
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
'skip_download': True, 'ignore_no_formats_error': True, }, }] def _real_extract(self, url): video_id = self._match_id(url) expires = int_or_none(traverse_obj(parse_qs(url), ('expires', 0))) if expires and expires <= time_seconds(): raise Extr...
- `errnote=False` is not appropriate here IMO, it will make debugging very difficult, since the regex search also has a default - Why do we want this to be non-fatal, anyways? It doesn't look like we are extracting upcoming livestreams - Not using a capture group and having `[^"]+` at the end of the pattern could mat...
'skip_download': True, 'ignore_no_formats_error': True, }, }] def _real_extract(self, url): video_id = self._match_id(url) expires = int_or_none(traverse_obj(parse_qs(url), ('expires', 0))) if expires and expires <= time_seconds(): raise Extr...
@@ -0,0 +1,77 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_qs, + time_seconds, + traverse_obj, +) + + +class PIAULIZAPortalIE(InfoExtractor): + IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' + _VALID_URL = r'https?://ulizaportal\.jp/pages/(?P<i...
yt_dlp/extractor/piaulizaportal.py
26
Python
1
bug
687
46
39
false
[ie/PIAULIZAPortal] Add extractor
7,903
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
def _real_extract(self, url): video_id = self._match_id(url) expires = int_or_none(traverse_obj(parse_qs(url), ('expires', 0))) if expires and expires <= time_seconds(): raise ExtractorError('The link is expired.', video_id=video_id, expected=True) webpage = self._down...
IMO we can keep this pretty simple since we are only searching within a format URL ```suggestion m3u8_type = self._search_regex( r'/hls/(dvr|video)/', traverse_obj(formats, (0, 'url')), 'm3u8 type', default=None) ```
def _real_extract(self, url): video_id = self._match_id(url) expires = int_or_none(traverse_obj(parse_qs(url), ('expires', 0))) if expires and expires <= time_seconds(): raise ExtractorError('The link is expired.', video_id=video_id, expected=True) webpage = self._down...
@@ -0,0 +1,77 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_qs, + time_seconds, + traverse_obj, +) + + +class PIAULIZAPortalIE(InfoExtractor): + IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' + _VALID_URL = r'https?://ulizaportal\.jp/pages/(?P<i...
yt_dlp/extractor/piaulizaportal.py
26
Python
0.929
suggestion
240
42
35
false
[ie/PIAULIZAPortal] Add extractor
7,903
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
parse_qs, time_seconds, traverse_obj, ) class PIAULIZAPortalIE(InfoExtractor): IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' _VALID_URL = r'https?://ulizaportal\.jp/pages/(?P<id>[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})' _TESTS = [{ 'url': 'https://ulizaportal.jp/pages/00...
No m3u8 url can be extracted for this test. Did it expire? timestamp says it's good til the year 2099
parse_qs, time_seconds, traverse_obj, ) class PIAULIZAPortalIE(InfoExtractor): IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' _VALID_URL = r'https?://(?:www\.)?ulizaportal\.jp/pages/(?P<id>[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12})' _TESTS = [{ 'url': 'https://ulizaportal.jp/pages/005f18b...
@@ -0,0 +1,77 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_qs, + time_seconds, + traverse_obj, +) + + +class PIAULIZAPortalIE(InfoExtractor): + IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' + _VALID_URL = r'https?://ulizaportal\.jp/pages/(?P<i...
yt_dlp/extractor/piaulizaportal.py
26
Python
0.429
refactor
101
51
51
false
[ie/PIAULIZAPortal] Add extractor
7,903
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
video_id, headers={'Referer': 'https://ulizaportal.jp/'}, note='Fetching player data', errnote='Unable to fetch player data') formats = self._extract_m3u8_formats( self._search_regex( r'["\'](https://vms-api\.p\.uliza\.jp/v1/prog-index\.m3u8[^"\']+)', player_...
```suggestion m3u8_type = self._search_regex( r'/hls/(dvr|video)/', traverse_obj(formats, (0, 'url')), 'm3u8 type', default=None) return { 'id': video_id, 'title': self._html_extract_title(webpage), 'formats': formats, 'live_status': {...
from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, parse_qs, time_seconds, traverse_obj, ) class PIAULIZAPortalIE(InfoExtractor): IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' _VALID_URL = r'https?://(?:www\.)?ulizaportal\.jp/pages/(?P<id>[\da-f]{8}-(?:[\da...
@@ -0,0 +1,76 @@ +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + int_or_none, + parse_qs, + time_seconds, + traverse_obj, +) + + +class PIAULIZAPortalIE(InfoExtractor): + IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM' + _VALID_URL = r'https?://(?:www\.)?ulizaportal\.jp/p...
yt_dlp/extractor/piaulizaportal.py
26
Python
1
refactor
505
27
71
false
[ie/PIAULIZAPortal] Add extractor
7,903
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
if (not self.get_param('allow_unplayable_formats') and traverse_obj(format_dict, ('drm', 'keySystem'))): drm_formats.append(format_dict) continue format_url = url_or_none(format_dict.get('src')) format_type =...
use `_search_json` ```py player = self._search_json( r'player:', webpage, 'player', video_id, fatal=False, end_pattern=r';\s*</script>') ```
if (not self.get_param('allow_unplayable_formats') and traverse_obj(format_dict, ('drm', 'keySystem'))): has_drm = True continue format_url = url_or_none(format_dict.get('src')) format_type = format_dict.get(...
@@ -45,83 +45,95 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) - has_drm = False + drm_formats = [] duration = None formats = [] + def process_format_list(format_list, format_id=""): + if not isinstance(format_list, list...
yt_dlp/extractor/nova.py
26
Python
0.786
suggestion
166
51
51
false
[NovaEmbed] Fix extractor (handle new player)
7,910
yt-dlp/yt-dlp
132,642
Python
bashonly
std-move
drm_formats.append(format_dict) continue format_url = url_or_none(format_dict.get('src')) format_type = format_dict.get('type') ext = determine_ext(format_url) if (format_type == 'application/x-mpegURL' ...
branching with `...` in traversal will always return a list ```suggestion for src in traverse_obj(player, ('lib', 'source', 'sources', ...)): ```
has_drm = True continue format_url = url_or_none(format_dict.get('src')) format_type = format_dict.get('type') ext = determine_ext(format_url) if (format_type == 'application/x-mpegURL' or for...
@@ -45,83 +45,95 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) - has_drm = False + drm_formats = [] duration = None formats = [] + def process_format_list(format_list, format_id=""): + if not isinstance(format_list, list...
yt_dlp/extractor/nova.py
26
Python
0.714
suggestion
160
51
51
false
[NovaEmbed] Fix extractor (handle new player)
7,910
yt-dlp/yt-dlp
132,642
Python
bashonly
std-move
format_url = url_or_none(format_dict.get('src')) format_type = format_dict.get('type') ext = determine_ext(format_url) if (format_type == 'application/x-mpegURL' or format_id == 'HLS' or ext == 'm3u8'): formats.e...
more readable imo ```suggestion duration = traverse_obj(player, ('sourceInfo', 'duration', {int_or_none})) ```
format_url = url_or_none(format_dict.get('src')) format_type = format_dict.get('type') ext = determine_ext(format_url) if (format_type == 'application/x-mpegURL' or format_id == 'HLS' or ext == 'm3u8'): formats.e...
@@ -45,83 +45,95 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) - has_drm = False + drm_formats = [] duration = None formats = [] + def process_format_list(format_list, format_id=""): + if not isinstance(format_list, list...
yt_dlp/extractor/nova.py
26
Python
0.714
suggestion
125
51
51
false
[NovaEmbed] Fix extractor (handle new player)
7,910
yt-dlp/yt-dlp
132,642
Python
bashonly
std-move
format_list = [format_list] for format_dict in format_list: if not isinstance(format_dict, dict): continue if (not self.get_param('allow_unplayable_formats') and traverse_obj(format_dict, ('drm', 'keySystem'))): ...
We're not gonna add code to extract DRM formats. Keep the `has_drm` boolean. Mandatory change ```suggestion has_drm = False duration = None formats = [] def process_format_list(format_list, format_id=''): nonlocal formats, has_drm for format_dict in tra...
format_list = [format_list] for format_dict in format_list: if not isinstance(format_dict, dict): continue if (not self.get_param('allow_unplayable_formats') and traverse_obj(format_dict, ('drm', 'keySystem'))): ...
@@ -45,83 +45,95 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) - has_drm = False + drm_formats = [] duration = None formats = [] + def process_format_list(format_list, format_id=""): + if not isinstance(format_list, list...
yt_dlp/extractor/nova.py
26
Python
1
refactor
1,301
51
51
false
[NovaEmbed] Fix extractor (handle new player)
7,910
yt-dlp/yt-dlp
132,642
Python
bashonly
std-move
for format_url in format_list: format_url = url_or_none(format_url) if not format_url: continue if format_id == 'hls': formats.extend(self._extract_m3u8_formats( ...
Mandatory change ```suggestion if not formats and has_drm:: ```
r'videoDuration\s*:\s*(\d+)', webpage, 'duration', default=duration)) return { 'id': video_id, 'title': title, 'thumbnail': thumbnail, 'duration': duration, 'formats': formats, } class NovaIE(InfoExtractor): IE_DE...
@@ -45,83 +45,95 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) - has_drm = False + drm_formats = [] duration = None formats = [] + def process_format_list(format_list, format_id=""): + if not isinstance(format_list, list...
yt_dlp/extractor/nova.py
26
Python
0.643
suggestion
74
51
51
false
[NovaEmbed] Fix extractor (handle new player)
7,910
yt-dlp/yt-dlp
132,642
Python
bashonly
std-move
format_type = format_dict.get('type') ext = determine_ext(format_url) if (format_type == 'application/x-mpegURL' or format_id == 'HLS' or ext == 'm3u8'): formats.extend(self._extract_m3u8_formats( format_...
Mandatory change ```suggestion if not formats and not has_drm: ```
format_type = format_dict.get('type') ext = determine_ext(format_url) if (format_type == 'application/x-mpegURL' or format_id == 'HLS' or ext == 'm3u8'): formats.extend(self._extract_m3u8_formats( format_...
@@ -45,83 +45,95 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) - has_drm = False + drm_formats = [] duration = None formats = [] + def process_format_list(format_list, format_id=""): + if not isinstance(format_list, list...
yt_dlp/extractor/nova.py
26
Python
0.643
suggestion
77
51
51
false
[NovaEmbed] Fix extractor (handle new player)
7,910
yt-dlp/yt-dlp
132,642
Python
bashonly
std-move
or format_id == 'HLS' or ext == 'm3u8'): formats.extend(self._extract_m3u8_formats( format_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)) elif (format_typ...
Can these patterns be simplified at all? Are you able to share webpage source where these patterns are needed? I would think at least the first `(?:replacePlaceholders|processAdTagModifier).*?:\s*)?` could be removed
or format_id == 'HLS' or ext == 'm3u8'): formats.extend(self._extract_m3u8_formats( format_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)) elif (format_typ...
@@ -45,83 +45,95 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) - has_drm = False + drm_formats = [] duration = None formats = [] + def process_format_list(format_list, format_id=""): + if not isinstance(format_list, list...
yt_dlp/extractor/nova.py
26
Python
0.643
suggestion
219
51
51
false
[NovaEmbed] Fix extractor (handle new player)
7,910
yt-dlp/yt-dlp
132,642
Python
bashonly
std-move
if not isinstance(format_list, list): format_list = [format_list] for format_url in format_list: format_url = url_or_none(format_url) if not format_url: continue ...
This could probably be refactored with `traverse_obj`, or perhaps `process_format_list` could be generalized more and that could be used here But since this is old code that you are just indenting, you don't need to change it ```suggestion for format_id, format_list in traverse_obj(bitrates, ({di...
'thumbnail', fatal=False, group='value') duration = int_or_none(self._search_regex( r'videoDuration\s*:\s*(\d+)', webpage, 'duration', default=duration)) return { 'id': video_id, 'title': title, 'thumbnail': thumbnail, ...
@@ -45,83 +45,95 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) - has_drm = False + drm_formats = [] duration = None formats = [] + def process_format_list(format_list, format_id=""): + if not isinstance(format_list, list...
yt_dlp/extractor/nova.py
26
Python
0.857
refactor
1,313
51
51
false
[NovaEmbed] Fix extractor (handle new player)
7,910
yt-dlp/yt-dlp
132,642
Python
bashonly
std-move
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e', 'thumbnail': 'https://cdn.jwplayer.com/v2/media/nwpt1elX/poster.jpg?width=720', 'duration': 60, 'timestamp': 1633014214, 'upload_date': '20210930', }, 'params': {'skip_download': True} ...
Avoid `.*` in regex when possible and while we are fixing the extractor, let's make it so it's not using a builtin as a var name ```suggestion video_id = self._search_regex(r'"https://cdn\.jwplayer\.com/players/(\w+)', webpage, 'id') data_json = self._download_json(f'https://cdn.jwplayer.com/v2/medi...
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e', 'thumbnail': 'https://cdn.jwplayer.com/v2/media/nwpt1elX/poster.jpg?width=720', 'duration': 60, 'timestamp': 1633014214, 'upload_date': '20210930', }, 'params': {'skip_download': True} ...
@@ -81,10 +81,23 @@ class MediaiteIE(InfoExtractor): 'upload_date': '20210930', }, 'params': {'skip_download': True} + }, { + 'url': 'https://www.mediaite.com/politics/i-cant-read-it-fast-enough-while-defending-trump-larry-kudlow-overwhelmed-by-volume-of-ex-presidents-legal-trou...
yt_dlp/extractor/mediaite.py
26
Python
0.857
refactor
349
28
29
false
[Mediaite] Broken downloading fix
7,923
yt-dlp/yt-dlp
132,642
Python
bashonly
Grabien
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e', 'thumbnail': 'https://cdn.jwplayer.com/v2/media/sEIWvKR7/poster.jpg?width=720', 'duration': 52, 'timestamp': 1631553328, 'upload_date': '20210913', }, 'params': {'skip_download': True} ...
```suggestion 'title': 'Fox Business Network - 4:00 PM - 5:00 PM - 1:39:42 pm - 1:42:20 pm', ```
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e', 'thumbnail': 'https://cdn.jwplayer.com/v2/media/sEIWvKR7/poster.jpg?width=720', 'duration': 52, 'timestamp': 1631553328, 'upload_date': '20210913', }, 'params': {'skip_download': True} ...
@@ -81,10 +81,23 @@ class MediaiteIE(InfoExtractor): 'upload_date': '20210930', }, 'params': {'skip_download': True} + }, { + 'url': 'https://www.mediaite.com/politics/i-cant-read-it-fast-enough-while-defending-trump-larry-kudlow-overwhelmed-by-volume-of-ex-presidents-legal-trou...
yt_dlp/extractor/mediaite.py
26
Python
0.714
suggestion
110
41
42
false
[Mediaite] Broken downloading fix
7,923
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grabien
'timestamp': 1633014214, 'upload_date': '20210930', }, 'params': {'skip_download': True} }, { 'url': 'https://www.mediaite.com/politics/i-cant-read-it-fast-enough-while-defending-trump-larry-kudlow-overwhelmed-by-volume-of-ex-presidents-legal-troubles/', 'info...
```suggestion video_id = self._search_regex( [r'"https://cdn\.jwplayer\.com/players/(\w+)', r'data-video-id\s*=\s*\"([^\"]+)\"'], webpage, 'id') data_json = self._download_json(f'https://cdn.jwplayer.com/v2/media/{video_id}', video_id) ```
'timestamp': 1633014214, 'upload_date': '20210930', }, 'params': {'skip_download': True} }, { 'url': 'https://www.mediaite.com/politics/i-cant-read-it-fast-enough-while-defending-trump-larry-kudlow-overwhelmed-by-volume-of-ex-presidents-legal-troubles/', 'info...
@@ -81,10 +81,26 @@ class MediaiteIE(InfoExtractor): 'upload_date': '20210930', }, 'params': {'skip_download': True} + }, { + 'url': 'https://www.mediaite.com/politics/i-cant-read-it-fast-enough-while-defending-trump-larry-kudlow-overwhelmed-by-volume-of-ex-presidents-legal-trou...
yt_dlp/extractor/mediaite.py
26
Python
0.786
suggestion
271
28
26
false
[Mediaite] Broken downloading fix
7,923
yt-dlp/yt-dlp
132,642
Python
bashonly
Grabien
wmd = base64.b64encode(hmac.HMAC( key, f'{api_path[:255]}{wmsgpad}'.encode(), digestmod=hashlib.sha1).digest()).decode() headers = {'Content-Type': 'application/json'} if data else {} try: return self._download_json( f'https://global.apis.naver.com/weverse...
```suggestion path = '' if 'Authorization' in self._API_HEADERS else '/preview' return self._call_api(f'/post/v1.0/post-{video_id}{path}?fieldSet=postV1', video_id) ```
wmd = base64.b64encode(hmac.HMAC( key, f'{api_path[:255]}{wmsgpad}'.encode(), digestmod=hashlib.sha1).digest()).decode() headers = {'Content-Type': 'application/json'} if data else {} try: return self._download_json( f'https://global.apis.naver.com/weverse...
@@ -101,11 +99,17 @@ def _call_api(self, ep, video_id, data=None, note='Downloading API JSON'): self.raise_login_required( 'Session token has expired. Log in again or refresh cookies in browser') elif isinstance(e.cause, HTTPError) and e.cause.status == 403: - ...
yt_dlp/extractor/weverse.py
26
Python
0.714
security
187
51
51
false
Use Weverse preview endpoint if no auth provided
7,924
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
api_path = update_url_query(ep, { 'appId': 'be4d79eb8fc7bd008ee82c8ec4ff6fd4', 'language': 'en', 'platform': 'WEB', 'wpf': 'pc', }) wmsgpad = int(time.time() * 1000) wmd = base64.b64encode(hmac.HMAC( key, f'{api_path[:255]}{wmsg...
```suggestion self.raise_login_required() ```
api_path = update_url_query(ep, { 'appId': 'be4d79eb8fc7bd008ee82c8ec4ff6fd4', 'language': 'en', 'platform': 'WEB', 'wpf': 'pc', }) wmsgpad = int(time.time() * 1000) wmd = base64.b64encode(hmac.HMAC( key, f'{api_path[:255]}{wmsg...
@@ -101,11 +99,15 @@ def _call_api(self, ep, video_id, data=None, note='Downloading API JSON'): self.raise_login_required( 'Session token has expired. Log in again or refresh cookies in browser') elif isinstance(e.cause, HTTPError) and e.cause.status == 403: - ...
yt_dlp/extractor/weverse.py
26
Python
0.571
suggestion
63
51
51
false
Use Weverse preview endpoint if no auth provided
7,924
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
import os.path import re from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, traverse_obj, try_get, url_basename, ) class DropboxIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:scl/fi/|e/scl/fi/|s/|sh/)(?P<i...
isn't `\w+` enough for the `id`? ```suggestion _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:(?:e/)?scl/fi|sh?)/(?P<id>\w+)/.*' ``` or else this: ```suggestion _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:(?:e/)?scl/fi|sh?)/(?P<id>[^/#?]+)/.*' ```
import base64 import os.path import re from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, update_url_query, url_basename, ) class DropboxIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:(?:e/)?scl/fi|sh?)/(?P<id...
@@ -12,7 +12,7 @@ class DropboxIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?dropbox[.]com/sh?/(?P<id>[a-zA-Z0-9]{15})/.*' + _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:scl/fi/|e/scl/fi/|s/|sh/)(?P<id>[^/]+)/.*'
yt_dlp/extractor/dropbox.py
15
Python
0.786
question
271
40
40
false
[ie/Dropbox] Fix extractor
7,926
yt-dlp/yt-dlp
132,642
Python
bashonly
nathantouze
) class DropboxIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:(?:e/)?scl/fi|sh?)/(?P<id>\w+)/.*' _TESTS = [ { 'url': 'https://www.dropbox.com/s/nelirfsxnmcfbfh/youtube-dl%20test%20video%20%27%C3%A4%22BaW_jenozKc.mp4?dl=0', 'info_dict': { 'i...
```suggestion }, { 'url': 'https://www.dropbox.com/scl/fi/r2kd2skcy5ylbbta5y1pz/DJI_0003.MP4?dl=0&rlkey=wcdgqangn7t3lnmmv6li9mu9h', 'only_matching': True, }, { 'url': 'https://www.dropbox.com/e/scl/fi/r2kd2skcy5ylbbta5y1pz/DJI_0003.MP4?dl=0&rlkey=wcdgqangn7t3lnmm...
) class DropboxIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:(?:e/)?scl/fi|sh?)/(?P<id>\w+)' _TESTS = [ { 'url': 'https://www.dropbox.com/s/nelirfsxnmcfbfh/youtube-dl%20test%20video%20%27%C3%A4%22BaW_jenozKc.mp4?dl=0', 'info_dict': { 'id':...
@@ -22,9 +22,17 @@ class DropboxIE(InfoExtractor): 'title': 'youtube-dl test video \'ä"BaW_jenozKc' } }, { - 'url': 'https://www.dropbox.com/sh/662glsejgzoj9sr/AAByil3FGH9KFNZ13e08eSa1a/Pregame%20Ceremony%20Program%20PA%2020140518.m4v', + 'url': 'https://www....
yt_dlp/extractor/dropbox.py
26
Python
0.786
suggestion
391
51
51
false
[ie/Dropbox] Fix extractor
7,926
yt-dlp/yt-dlp
132,642
Python
bashonly
nathantouze
import base64 import os.path import re from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, update_url_query, url_basename, ) class DropboxIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:(?:e/)?scl/fi|sh?)/(?P<id...
```suggestion _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:(?:e/)?scl/fi|sh?)/(?P<id>\w+)' ``` Example: `https://www.dropbox.com/s/nelirfsxnmcfbfh`
import base64 import os.path import re from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, update_url_query, url_basename, ) class DropboxIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:(?:e/)?scl/fi|sh?)/(?P<id...
@@ -1,18 +1,18 @@ +import base64 import os.path import re from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, - traverse_obj, - try_get, + update_url_query, url_basename, ) class DropboxIE(InfoExtractor): - _VALID_UR...
yt_dlp/extractor/dropbox.py
15
Python
0.714
suggestion
161
40
40
false
[ie/Dropbox] Fix extractor
7,926
yt-dlp/yt-dlp
132,642
Python
pukkandan
nathantouze
import base64 import os.path import re from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, update_url_query, url_basename, ) class DropboxIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:(?:e/)?scl/fi|sh?)/(?P<id...
```suggestion }, { 'url': 'https://www.dropbox.com/s/nelirfsxnmcfbfh', 'only_matching': True, }, { ```
import base64 import os.path import re from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote from ..utils import ( ExtractorError, update_url_query, url_basename, ) class DropboxIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?dropbox\.com/(?:(?:e/)?scl/fi|sh?)/(?P<id...
@@ -22,7 +22,13 @@ class DropboxIE(InfoExtractor): 'title': 'youtube-dl test video \'ä"BaW_jenozKc' } }, {
yt_dlp/extractor/dropbox.py
24
Python
0.714
suggestion
147
49
49
false
[ie/Dropbox] Fix extractor
7,926
yt-dlp/yt-dlp
132,642
Python
bashonly
nathantouze
from datetime import datetime import base64 from .common import InfoExtractor from ..networking import HEADRequest from ..utils import int_or_none, urlencode_postdata class TenPlayIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/]+/)+(?P<id>tpv\d{6}[a-z]{5})' _NETRC_MACHINE = '10pla...
Can do this in one line, and use single quotes ```suggestion show, season = self._match_valid_url(url).group('show', 'season') ```
class TenPlaySeasonIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/?#]+)/episodes/(?P<season>[^/?#]+)/?(?:$|[?#])' _TESTS = [{ 'url': 'https://10play.com.au/masterchef/episodes/season-14', 'info_dict': { 'title': 'Season 14', 'id': 'MjMyOT...
@@ -113,3 +113,62 @@ def _real_extract(self, url): 'uploader': 'Channel 10', 'uploader_id': '2199827728001', } + + +class TenPlaySeasonIE(TenPlayIE): + _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/]+)/episodes/(?P<season>[^/]+)$' + + _TESTS = [{ + 'url': ...
yt_dlp/extractor/tenplay.py
26
Python
0.786
suggestion
141
116
51
false
[tenplay] Add support for downloading whole seasons
7,939
yt-dlp/yt-dlp
132,642
Python
bashonly
midnightveil
from datetime import datetime import base64 from .common import InfoExtractor from ..networking import HEADRequest from ..utils import int_or_none, urlencode_postdata class TenPlayIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/]+/)+(?P<id>tpv\d{6}[a-z]{5})' _NETRC_MACHINE = '10pla...
```suggestion season_info = self._download_json( f'https://10play.com.au/api/shows/{show}/episodes/{season}', f'{show}/{season}') ```
_TESTS = [{ 'url': 'https://10play.com.au/masterchef/episodes/season-14', 'info_dict': { 'title': 'Season 14', 'id': 'MjMyOTIy', }, 'playlist_mincount': 64, }, { 'url': 'https://10play.com.au/the-bold-and-the-beautiful-fast-tracked/episodes/season-...
@@ -113,3 +113,62 @@ def _real_extract(self, url): 'uploader': 'Channel 10', 'uploader_id': '2199827728001', } + + +class TenPlaySeasonIE(TenPlayIE): + _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/]+)/episodes/(?P<season>[^/]+)$' + + _TESTS = [{ + 'url': ...
yt_dlp/extractor/tenplay.py
26
Python
0.714
suggestion
156
116
49
false
[tenplay] Add support for downloading whole seasons
7,939
yt-dlp/yt-dlp
132,642
Python
bashonly
midnightveil
from datetime import datetime import base64 from .common import InfoExtractor from ..networking import HEADRequest from ..utils import int_or_none, urlencode_postdata class TenPlayIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/]+/)+(?P<id>tpv\d{6}[a-z]{5})' _NETRC_MACHINE = '10pla...
```suggestion _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/?#]+)/episodes/(?P<season>[^/?#]+)/?(?:$|[?#])' ```
headers=headers).get('source') m3u8_url = self._request_webpage(HEADRequest( _video_url), content_id).url if '10play-not-in-oz' in m3u8_url: self.raise_geo_restricted(countries=['AU']) formats = self._extract_m3u8_formats(m3u8_url, content_id, 'mp4') ...
@@ -113,3 +113,62 @@ def _real_extract(self, url): 'uploader': 'Channel 10', 'uploader_id': '2199827728001', } + + +class TenPlaySeasonIE(TenPlayIE): + _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/]+)/episodes/(?P<season>[^/]+)$'
yt_dlp/extractor/tenplay.py
26
Python
0.714
suggestion
133
116
51
false
[tenplay] Add support for downloading whole seasons
7,939
yt-dlp/yt-dlp
132,642
Python
bashonly
midnightveil
from datetime import datetime import base64 from .common import InfoExtractor from ..networking import HEADRequest from ..utils import int_or_none, urlencode_postdata class TenPlayIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/]+/)+(?P<id>tpv\d{6}[a-z]{5})' _NETRC_MACHINE = '10pla...
```suggestion episodes_carousel = traverse_obj(season_info, ('content', 0, 'components', ( lambda _, v: v['title'].lower() == 'episodes', (..., {dict}))), get_all=False) or {} ```
}, 'playlist_mincount': 64, }, { 'url': 'https://10play.com.au/the-bold-and-the-beautiful-fast-tracked/episodes/season-2022', 'info_dict': { 'title': 'Season 2022', 'id': 'Mjc0OTIw', }, 'playlist_mincount': 256, }] def _entries(self, l...
@@ -113,3 +113,62 @@ def _real_extract(self, url): 'uploader': 'Channel 10', 'uploader_id': '2199827728001', } + + +class TenPlaySeasonIE(TenPlayIE): + _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/]+)/episodes/(?P<season>[^/]+)$' + + _TESTS = [{ + 'url': ...
yt_dlp/extractor/tenplay.py
26
Python
0.857
suggestion
202
116
44
false
[tenplay] Add support for downloading whole seasons
7,939
yt-dlp/yt-dlp
132,642
Python
bashonly
midnightveil
from datetime import datetime import base64 from .common import InfoExtractor from ..networking import HEADRequest from ..utils import int_or_none, urlencode_postdata class TenPlayIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/]+/)+(?P<id>tpv\d{6}[a-z]{5})' _NETRC_MACHINE = '10pla...
Do not subclass from concrete IE; move common code into a baseclass and subclass both concrete IEs from the baseclass
data.get('playbackApiEndpoint'), content_id, 'Downloading video JSON', headers=headers).get('source') m3u8_url = self._request_webpage(HEADRequest( _video_url), content_id).url if '10play-not-in-oz' in m3u8_url: self.raise_geo_restricted(countries=['AU']) ...
@@ -113,3 +113,62 @@ def _real_extract(self, url): 'uploader': 'Channel 10', 'uploader_id': '2199827728001', } + + +class TenPlaySeasonIE(TenPlayIE):
yt_dlp/extractor/tenplay.py
26
Python
0.429
suggestion
117
116
51
false
[tenplay] Add support for downloading whole seasons
7,939
yt-dlp/yt-dlp
132,642
Python
bashonly
midnightveil
from datetime import datetime import base64 from .common import InfoExtractor from ..networking import HEADRequest from ..utils import int_or_none, urlencode_postdata class TenPlayIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/]+/)+(?P<id>tpv\d{6}[a-z]{5})' _NETRC_MACHINE = '10pla...
```suggestion playlist_title = traverse_obj(season_info, ('content', 0, 'title', {str})) ```
'info_dict': { 'title': 'Season 2022', 'id': 'Mjc0OTIw', }, 'playlist_mincount': 256, }] def _entries(self, load_more_url, display_id=None): skip_ids = [] for page in itertools.count(1): episodes_carousel = self._download_json( ...
@@ -113,3 +113,62 @@ def _real_extract(self, url): 'uploader': 'Channel 10', 'uploader_id': '2199827728001', } + + +class TenPlaySeasonIE(TenPlayIE): + _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/]+)/episodes/(?P<season>[^/]+)$' + + _TESTS = [{ + 'url': ...
yt_dlp/extractor/tenplay.py
26
Python
0.714
suggestion
102
116
40
false
[tenplay] Add support for downloading whole seasons
7,939
yt-dlp/yt-dlp
132,642
Python
bashonly
midnightveil
from datetime import datetime import base64 from .common import InfoExtractor from ..networking import HEADRequest from ..utils import int_or_none, urlencode_postdata class TenPlayIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/]+/)+(?P<id>tpv\d{6}[a-z]{5})' _NETRC_MACHINE = '10pla...
use a generator function for entries
import base64 import functools import itertools from datetime import datetime from .common import InfoExtractor from ..networking import HEADRequest from ..utils import int_or_none, traverse_obj, urlencode_postdata, urljoin class TenPlayIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/]...
@@ -113,3 +113,62 @@ def _real_extract(self, url): 'uploader': 'Channel 10', 'uploader_id': '2199827728001', } + + +class TenPlaySeasonIE(TenPlayIE): + _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/]+)/episodes/(?P<season>[^/]+)$' + + _TESTS = [{ + 'url': ...
yt_dlp/extractor/tenplay.py
26
Python
0.143
suggestion
36
116
170
false
[tenplay] Add support for downloading whole seasons
7,939
yt-dlp/yt-dlp
132,642
Python
bashonly
midnightveil
'info_dict': { 'title': 'Season 2022', 'id': 'Mjc0OTIw', }, 'playlist_count': 256, 'params': { 'skip_download': True, } }] def _entries(self, show, season, load_more_url): skip_ids = [] has_more = True base_url...
- we can delegate the `urljoin`-ing to the `playlist_from_matches` getter - displaying episode count during API calls may be misleading since we don't know which order the episodes are in; counting pages with itertools seems more straightforward ```suggestion def _entries(self, load_more_url, display_id=None): ...
'id': 'Mjc0OTIw', }, 'playlist_mincount': 256, }] def _entries(self, load_more_url, display_id=None): skip_ids = [] for page in itertools.count(1): episodes_carousel = self._download_json( load_more_url, display_id, query={'skipIds[]': ski...
@@ -113,3 +113,63 @@ def _real_extract(self, url): 'uploader': 'Channel 10', 'uploader_id': '2199827728001', } + + +class TenPlaySeasonIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/?#]+)/episodes/(?P<season>[^/?#]+)/?(?:$|[?#])' + + _TESTS = ...
yt_dlp/extractor/tenplay.py
26
Python
0.857
suggestion
866
44
38
false
[tenplay] Add support for downloading whole seasons
7,939
yt-dlp/yt-dlp
132,642
Python
bashonly
midnightveil
def _entries(self, show, season, load_more_url): skip_ids = [] has_more = True base_url = f'https://10play.com.au/{show}/episodes/{season}' while has_more: episodes_carousel = self._download_json( load_more_url, f'{show}/{season}', query={'skipIds[]': s...
just formatting / readability ```suggestion episodes_carousel = traverse_obj(season_info, ( 'content', 0, 'components', ( lambda _, v: v['title'].lower() == 'episodes', (..., {dict}), )), get_all=False) or {} ```
load_more_url, display_id, query={'skipIds[]': skip_ids}, note=f'Fetching episodes page {page}') episodes_chunk = episodes_carousel['items'] skip_ids.extend(ep['id'] for ep in episodes_chunk) for ep in episodes_chunk: yield ep['cardLi...
@@ -113,3 +113,63 @@ def _real_extract(self, url): 'uploader': 'Channel 10', 'uploader_id': '2199827728001', } + + +class TenPlaySeasonIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/?#]+)/episodes/(?P<season>[^/?#]+)/?(?:$|[?#])' + + _TESTS = ...
yt_dlp/extractor/tenplay.py
26
Python
0.857
suggestion
283
35
29
false
[tenplay] Add support for downloading whole seasons
7,939
yt-dlp/yt-dlp
132,642
Python
bashonly
midnightveil
episodes_carousel = self._download_json( load_more_url, f'{show}/{season}', query={'skipIds[]': skip_ids}, note=f'Fetching episodes {len(skip_ids)}+') has_more = episodes_carousel['hasMore'] episodes_chunk = episodes_carousel['items'] skip...
- we can inline `playlist_title` and `load_more_url` - have `playlist_from_matches` make itself useful by handling the `urljoin`-ing outside of `_entries()` ```suggestion return self.playlist_from_matches( self._entries(urljoin(url, episodes_carousel['loadMoreUrl']), playlist_id), ...
import base64 import functools import itertools from datetime import datetime from .common import InfoExtractor from ..networking import HEADRequest from ..utils import int_or_none, traverse_obj, urlencode_postdata, urljoin class TenPlayIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/]...
@@ -113,3 +113,63 @@ def _real_extract(self, url): 'uploader': 'Channel 10', 'uploader_id': '2199827728001', } + + +class TenPlaySeasonIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/?#]+)/episodes/(?P<season>[^/?#]+)/?(?:$|[?#])' + + _TESTS = ...
yt_dlp/extractor/tenplay.py
26
Python
0.857
suggestion
470
27
170
false
[tenplay] Add support for downloading whole seasons
7,939
yt-dlp/yt-dlp
132,642
Python
bashonly
midnightveil
import urllib.parse from .common import InfoExtractor from ..utils import ( determine_ext, extract_attributes, int_or_none, parse_duration, try_get, ) class TV5MondePlusIE(InfoExtractor): IE_DESC = 'TV5MONDE+' _VALID_URL = r'https?://(?:www\.)?(?:tv5mondeplus|revoir\.tv5monde)\.com/toutes...
Don't replace tests. If these tests are dead, add `'skip': '[reason for skipping]'` to the test dict and add new tests
import urllib.parse from .common import InfoExtractor from ..utils import ( determine_ext, extract_attributes, int_or_none, parse_duration, traverse_obj, try_get, url_or_none, ) class TV5MondePlusIE(InfoExtractor): IE_DESC = 'TV5MONDE+' _VALID_URL = r'https?://(?:www\.)?(?:tv5mond...
@@ -13,28 +15,33 @@ class TV5MondePlusIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?(?:tv5mondeplus|revoir\.tv5monde)\.com/toutes-les-videos/[^/]+/(?P<id>[^/?#]+)' _TESTS = [{ # movie - 'url': 'https://revoir.tv5monde.com/toutes-les-videos/cinema/ceux-qui-travaillent', - 'md5': '...
yt_dlp/extractor/tv5mondeplus.py
20
Python
0.571
suggestion
118
45
45
false
[tv5mondeplus] fix extractor
7,952
yt-dlp/yt-dlp
132,642
Python
bashonly
korli
'url': 'https://revoir.tv5monde.com/toutes-les-videos/info-societe/le-journal-de-la-rts-edition-du-30-01-20-19h30', 'only_matching': True, }] _GEO_BYPASS = False def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) ...
```suggestion if not v_url: continue if video_file.get('type') == 'application/deferred': ```
'id': 'dc57a011-ec4b-4648-2a9a-4f03f8352ed3', 'display_id': 'ceux-qui-travaillent', 'ext': 'mp4', 'title': 'Ceux qui travaillent', 'description': 'md5:570e8bb688036ace873b2d50d24c026d', 'upload_date': '20210819', }, 'skip': 'no long...
@@ -65,8 +72,20 @@ def _real_extract(self, url): formats = [] for video_file in video_files: v_url = video_file.get('url') + v_type = video_file.get('type') if not v_url: continue + if v_type == 'application/deferred':
yt_dlp/extractor/tv5mondeplus.py
26
Python
0.857
suggestion
137
51
51
false
[tv5mondeplus] fix extractor
7,952
yt-dlp/yt-dlp
132,642
Python
bashonly
korli
display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) if ">Ce programme n'est malheureusement pas disponible pour votre zone géographique.<" in webpage: self.raise_geo_restricted(countries=['FR']) title = episode = self._html_search_regex(r'<h1>...
- make everything non-fatal, use `traverse_obj` (import from `utils.traversal`) - do not use `json` as var name - import `url_or_none` from `utils` ```suggestion token = video_file.get('token') if not token: continue deferred_json = self._downlo...
}, 'skip': 'no longer available', }, { # series episode 'url': 'https://revoir.tv5monde.com/toutes-les-videos/series-fictions/vestiaires-caro-actrice', 'info_dict': { 'id': '9e9d599e-23af-6915-843e-ecbf62e97925', 'display_id': 'vestiaires-caro-actrice'...
@@ -65,8 +72,20 @@ def _real_extract(self, url): formats = [] for video_file in video_files: v_url = video_file.get('url') + v_type = video_file.get('type') if not v_url: continue + if v_type == 'application/deferred': + d...
yt_dlp/extractor/tv5mondeplus.py
26
Python
0.857
security
697
51
51
false
[tv5mondeplus] fix extractor
7,952
yt-dlp/yt-dlp
132,642
Python
bashonly
korli
if ">Ce programme n'est malheureusement pas disponible pour votre zone géographique.<" in webpage: self.raise_geo_restricted(countries=['FR']) title = episode = self._html_search_regex(r'<h1>([^<]+)', webpage, 'title') vpl_data = extract_attributes(self._search_regex( r'...
Is there a reason why we want to extract video id from the deferred video URL instead of from the webpage? Can you explain please
# series episode 'url': 'https://revoir.tv5monde.com/toutes-les-videos/series-fictions/vestiaires-caro-actrice', 'info_dict': { 'id': '9e9d599e-23af-6915-843e-ecbf62e97925', 'display_id': 'vestiaires-caro-actrice', 'ext': 'mp4', 'title': "Vestiaire...
@@ -65,8 +72,20 @@ def _real_extract(self, url): formats = [] for video_file in video_files: v_url = video_file.get('url') + v_type = video_file.get('type') if not v_url: continue + if v_type == 'application/deferred': + d...
yt_dlp/extractor/tv5mondeplus.py
26
Python
0.429
refactor
129
51
51
false
[tv5mondeplus] fix extractor
7,952
yt-dlp/yt-dlp
132,642
Python
bashonly
korli
video_files = self._parse_json( vpl_data['data-broadcast'], display_id) formats = [] video_id = None def process_video_files(v): nonlocal video_id for video_file in v: v_url = video_file.get('url') if not v_url: ...
Don't remove the `default` param because we still want it to be non-fatal, we will just default to `None` ```suggestion video_id = self._search_regex( r'materials/([\da-zA-Z]{10}_[\da-fA-F]{7})/', v_url, 'video id', default=None) ```
video_files = self._parse_json( vpl_data['data-broadcast'], display_id) formats = [] video_id = None def process_video_files(v): nonlocal video_id for video_file in v: v_url = video_file.get('url') if not v_url: ...
@@ -63,20 +99,46 @@ def _real_extract(self, url): video_files = self._parse_json( vpl_data['data-broadcast'], display_id) formats = [] - for video_file in video_files: - v_url = video_file.get('url') - if not v_url: - continue - video...
yt_dlp/extractor/tv5mondeplus.py
26
Python
0.857
suggestion
281
51
51
false
[tv5mondeplus] fix extractor
7,952
yt-dlp/yt-dlp
132,642
Python
bashonly
korli
}, { 'url': 'https://kinder.wdr.de/tv/die-sendung-mit-dem-elefanten/av/video-folge---astronaut-100.html', 'only_matching': True, }, ] def _real_extract(self, url): mobj = self._match_valid_url(url) display_id = dict_get(mobj.groupdict(), ('display...
no harm in also matching the old pattern, just in case, yeah? ```suggestion )data-extension(?:-ard)?=(["\'])(?P<data>(?:(?!\3).)+)\3 ```
{ 'url': 'http://www.sportschau.de/handballem2018/audio-vorschau---die-handball-em-startet-mit-grossem-favoritenfeld-100.html', 'only_matching': True, }, { 'url': 'https://kinder.wdr.de/tv/die-sendung-mit-dem-elefanten/av/video-folge---astronaut-100.html', ...
@@ -268,7 +268,7 @@ def _real_extract(self, url): (?: (["\'])(?:mediaLink|wdrrPlayerPlayBtn|videoButton)\b.*?\1[^>]+| (["\'])videoLink\b.*?\2[\s]*>\n[^\n]* - )data-extension=(["\'])(?P<data>(?:(?!\3).)+)\3 + )da...
yt_dlp/extractor/wdr.py
26
Python
0.714
suggestion
159
51
51
false
[WDR] Update extractor to fit the current markup
7,979
yt-dlp/yt-dlp
132,642
Python
bashonly
szabyg
media_link_obj = self._parse_json( mobj.group('data'), display_id, transform_source=js_to_json, fatal=False) if not media_link_obj: continue jsonp_url = try_get( media_link_obj, lambda x: x['mediaObj']['url'], compat_str...
```suggestion r'<a[^>]+\bhref=(["\'])(?P<href>(?:(?!\1).)+)\1[^>]+\bdata-extension(?:-ard)?=', ```
# Article with several videos # for wdr.de the data-extension-ard is in a tag with the class "mediaLink" # for wdr.de radio players, in a tag with the class "wdrrPlayerPlayBtn" # for wdrmaus, in a tag with the class "videoButton" (previously a link # to the page in a multiline "...
@@ -295,7 +295,7 @@ def _real_extract(self, url): compat_urlparse.urljoin(url, mobj.group('href')), ie=WDRPageIE.ie_key()) for mobj in re.finditer( - r'<a[^>]+\bhref=(["\'])(?P<href>(?:(?!\1).)+)\1[^>]+\bdata-extension=', + ...
yt_dlp/extractor/wdr.py
26
Python
0.714
suggestion
120
51
51
false
[WDR] Update extractor to fit the current markup
7,979
yt-dlp/yt-dlp
132,642
Python
bashonly
szabyg
'md5': 'fb0ed4f09c495d4ba7ce2eee0bb90de1', 'info_dict': { 'id': '85158620', 'ext': 'mp4', 'title': 'Der Sprungturm-Skandal', 'description': 'md5:709b543c24dc31bbbffee73bccda34ad', 'thumbnail': r're:^https?://.*\.jpg$', 'duration': 6...
- Extract the formats non-fatally with `traverse_obj`: you can use branching (`...`) or filtering (`lambda _, v:`) so that it always returns a list. We can filter here for a truthy value to the `'src'` key - `entry_protocol=m3u8_native` is the default, so we can omit - Warn when an unsupported source type is skipped ...
'url': 'https://www.bild.de/video/clip/news-ausland/deftiger-abgang-vom-10m-turm-bademeister-sorgt-fuer-skandal-85158620.bild.html', 'md5': 'fb0ed4f09c495d4ba7ce2eee0bb90de1', 'info_dict': { 'id': '85158620', 'ext': 'mp4', 'title': 'Der Sprungturm-Skandal', ...
@@ -19,19 +20,41 @@ class BildIE(InfoExtractor): 'thumbnail': r're:^https?://.*\.jpg$', 'duration': 196, } - } + }, { + 'note': 'static MP4 and HLS', + 'url': 'https://www.bild.de/video/clip/news-ausland/deftiger-abgang-vom-10m-turm-bademeister-sorgt-fuer-skandal-8...
yt_dlp/extractor/bild.py
26
Python
1
refactor
918
36
39
false
[ie/Bild.de] fix extraction when HLS formats are available (fixes #7951)
8,032
yt-dlp/yt-dlp
132,642
Python
bashonly
barsnick
if live_status in {'is_live', 'post_live'}: duration = None else: duration = int_or_none(video.get('duration')) return { 'id': video_id, 'title': unescapeHTML(video.get('title')), 'formats': formats, 'subtitles': subtitles...
```suggestion r'<a[^>]+class="videostream__link link"[^>]+href=(?P<url>/v[\w.-]+\.html)[^>]*>'] ```
if live_status in {'is_live', 'post_live'}: duration = None else: duration = int_or_none(video.get('duration')) return { 'id': video_id, 'title': unescapeHTML(video.get('title')), 'formats': formats, 'subtitles': subtitles...
@@ -236,7 +236,9 @@ def _real_extract(self, url): class RumbleIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?rumble\.com/(?P<id>v(?!ideos)[\w.-]+)[^/]*$' - _EMBED_REGEX = [r'<a class=video-item--a href=(?P<url>/v[\w.-]+\.html)>'] + _EMBED_REGEX = [ + r'<a class=video-item--a href=(?P<url>/v[\...
yt_dlp/extractor/rumble.py
26
Python
0.714
suggestion
109
51
51
false
[extractor/Rumble] fix: updated field extraction
8,035
yt-dlp/yt-dlp
132,642
Python
bashonly
trislee
'info_dict': { 'id': 'video?q=rumble&sort=views', 'title': 'Search results for: rumble', 'age_limit': 0, }, }] def _real_extract(self, url): page_id = self._match_id(url) webpage = self._download_webpage(url, page_id) url_info = next(R...
- `fatal=False` is redundant if there is a `default` - `.` does not need to be escaped inside a regex character class - For `view_count`, would it be better to parse the JSON LD instead? Would save a step maybe. Or else the regex pattern should allow whitespace, e.g. `r'"userInteractionCount"\s*:\s*(\d+)'` . And it's...
'info_dict': { 'id': 'video?q=rumble&sort=views', 'title': 'Search results for: rumble', 'age_limit': 0, }, }] def _real_extract(self, url): page_id = self._match_id(url) webpage = self._download_webpage(url, page_id) url_info = next(R...
@@ -337,14 +345,22 @@ def _real_extract(self, url): release_ts_str = self._search_regex( r'(?:Livestream begins|Streamed on):\s+<time datetime="([^"]+)', webpage, 'release date', fatal=False, default=None) - view_count_str = self._search_regex(r'<span class="media-heading-info"...
yt_dlp/extractor/rumble.py
26
Python
1
security
888
51
51
false
[extractor/Rumble] fix: updated field extraction
8,035
yt-dlp/yt-dlp
132,642
Python
bashonly
trislee
}, }, { 'url': 'https://rumble.com/search/video?q=rumble&sort=views', 'playlist_mincount': 24, 'info_dict': { 'id': 'video?q=rumble&sort=views', 'title': 'Search results for: rumble', 'age_limit': 0, }, }] def _real_extract(self, u...
so it's non-fatal when `_search_regex` returns default ```suggestion 'view_count': int_or_none(self._search_regex( r'"userInteractionCount"\s*:\s*(\d+)', webpage, 'view count', default=None)), ```
}, }, { 'url': 'https://rumble.com/search/video?q=rumble&sort=views', 'playlist_mincount': 24, 'info_dict': { 'id': 'video?q=rumble&sort=views', 'title': 'Search results for: rumble', 'age_limit': 0, }, }] def _real_extract(self, u...
@@ -334,19 +342,20 @@ def _real_extract(self, url): if not url_info: raise UnsupportedError(url) - release_ts_str = self._search_regex( - r'(?:Livestream begins|Streamed on):\s+<time datetime="([^"]+)', - webpage, 'release date', fatal=False, default=None) - v...
yt_dlp/extractor/rumble.py
26
Python
0.857
suggestion
228
51
51
false
[extractor/Rumble] fix: updated field extraction
8,035
yt-dlp/yt-dlp
132,642
Python
bashonly
trislee
'Downloading player page', headers={'referer': 'https://zaiko.io/'}) player_meta = self._parse_vue_element_attr('player', player_page, video_id) status = traverse_obj(player_meta, ('initial_event_info', 'status', {str})) live_status, msg, expected = { 'vod': ('was_live', ...
`_og_search_thumbnail(False)` is fatal, so we need `or ''` ```suggestion self._og_search_thumbnail(self._download_webpage( f'https://zaiko.io/event/{video_id}', video_id, 'Downloading event page', fatal=False) or ''), ```
'vod': ('was_live', 'No VOD stream URL was found', False), 'archiving': ('post_live', 'Event VOD is still being processed', True), 'deleting': ('post_live', 'This event has ended', True), 'deleted': ('post_live', 'This event has ended', True), 'error': ('post_...
@@ -83,6 +90,12 @@ def _real_extract(self, url): if not formats: self.raise_no_formats(msg, expected=expected) + thumbnail_urls = [ + traverse_obj(player_meta, ('initial_event_info', 'poster_url')), + self._og_search_thumbnail(self._download_webpage( + ...
yt_dlp/extractor/zaiko.py
26
Python
0.786
suggestion
253
51
51
false
[ie/zaiko] add thumbnails from event pages
8,054
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
for key, value in extract_attributes(page_elem).items(): if key.startswith(':'): attrs[key[1:]] = self._parse_json( value, video_id, transform_source=unescapeHTML, fatal=False) return attrs class ZaikoIE(ZaikoBaseIE): _VALID_URL = r'https?://(?:[\w-]...
I know you can't actually run this test currently, but if you could, the test would still check for `thumbnail` and ignore `thumbnails`, so let's just do this ```suggestion 'thumbnail': r're:^https://[\w.-]+/\w+/\w+', 'thumbnails': 'count:2', ``` and add a `skip` key to this test with the r...
for key, value in extract_attributes(page_elem).items(): if key.startswith(':'): attrs[key[1:]] = self._parse_json( value, video_id, transform_source=unescapeHTML, fatal=False) return attrs class ZaikoIE(ZaikoBaseIE): _VALID_URL = r'https?://(?:[\w-]...
@@ -45,7 +46,13 @@ class ZaikoIE(ZaikoBaseIE): 'uploader_id': '454', 'uploader': 'ZAIKO ZERO', 'release_timestamp': 1583809200, - 'thumbnail': r're:https://[a-z0-9]+.cloudfront.net/[a-z0-9_]+/[a-z0-9_]+', + 'thumbnails': [{ + 'id': r're:[a-z0-9...
yt_dlp/extractor/zaiko.py
26
Python
0.857
suggestion
338
51
51
false
[ie/zaiko] add thumbnails from event pages
8,054
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
def _socket_connect(ip_addr, timeout, source_address): af, socktype, proto, canonname, sa = ip_addr sock = socket.socket(af, socktype, proto) try: if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address)...
```suggestion ip_addrs = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM) if not ip_addrs: raise socket.error('getaddrinfo returns an empty list') ``` This seems easier to read than the fallthrough. This also enable us to use ```diff - ip_addrs = [addr for addr in addrs if addr[0] == ...
def _socket_connect(ip_addr, timeout, source_address): af, socktype, proto, canonname, sa = ip_addr sock = socket.socket(af, socktype, proto) try: if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address)...
@@ -206,3 +207,54 @@ def wrapper(self, *args, **kwargs): e.handler = self raise return wrapper + + +def _socket_connect(ip_addr, timeout, source_address): + af, socktype, proto, canonname, sa = ip_addr + sock = socket.socket(af, socktype, proto) + try: + if timeout is ...
yt_dlp/networking/_helper.py
26
Python
1
suggestion
867
51
51
false
[networking] Fix various bugs in socks proxy implementation
8,065
yt-dlp/yt-dlp
132,642
Python
Grub4K
coletdjnz
def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None, *, _create_socket_func=_socket_connect): # This is to workaround _create_connection() from socket where it will try all # address data from getaddrinfo() including IPv6. This filters the result from # getaddrinfo()...
```suggestion err = None for ip_addr in ip_addrs: ``` Maybe move down here now for clarity
def create_connection( address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None, *, _create_socket_func=_socket_connect ): # Work around socket.create_connection() which tries all addresses from getaddrinfo() including IPv6. # This filters the addresses based on the given sourc...
@@ -206,3 +207,54 @@ def wrapper(self, *args, **kwargs): e.handler = self raise return wrapper + + +def _socket_connect(ip_addr, timeout, source_address): + af, socktype, proto, canonname, sa = ip_addr + sock = socket.socket(af, socktype, proto) + try: + if timeout is ...
yt_dlp/networking/_helper.py
26
Python
0.786
suggestion
102
37
42
false
[networking] Fix various bugs in socks proxy implementation
8,065
yt-dlp/yt-dlp
132,642
Python
Grub4K
coletdjnz
def _socket_connect(ip_addr, timeout, source_address): af, socktype, proto, canonname, sa = ip_addr sock = socket.socket(af, socktype, proto) try: if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) ...
`::192.168.0.123` is a valid ipv6 address, though I'm not sure if it will ever be returned like this. Still, maybe better to use `if ':' in source_address[0]`?
def _socket_connect(ip_addr, timeout, source_address): af, socktype, proto, canonname, sa = ip_addr sock = socket.socket(af, socktype, proto) try: if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) ...
@@ -206,3 +207,54 @@ def wrapper(self, *args, **kwargs): e.handler = self raise return wrapper + + +def _socket_connect(ip_addr, timeout, source_address): + af, socktype, proto, canonname, sa = ip_addr + sock = socket.socket(af, socktype, proto) + try: + if timeout is ...
yt_dlp/networking/_helper.py
26
Python
0.571
question
159
50
51
false
[networking] Fix various bugs in socks proxy implementation
8,065
yt-dlp/yt-dlp
132,642
Python
Grub4K
coletdjnz
e.handler = self raise return wrapper def _socket_connect(ip_addr, timeout, source_address): af, socktype, proto, canonname, sa = ip_addr sock = socket.socket(af, socktype, proto) try: if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(tim...
How about this? ```suggestion # Work around socket._create_connection() which tries all # addresses from getaddrinfo() including IPv6. # This filters the addresses based on the given source_address. # Based on: https://github.com/python/cpython/blob/main/Lib/socket.py#L810 ```
e.handler = self raise return wrapper def _socket_connect(ip_addr, timeout, source_address): af, socktype, proto, canonname, sa = ip_addr sock = socket.socket(af, socktype, proto) try: if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(tim...
@@ -206,3 +207,54 @@ def wrapper(self, *args, **kwargs): e.handler = self raise return wrapper + + +def _socket_connect(ip_addr, timeout, source_address): + af, socktype, proto, canonname, sa = ip_addr + sock = socket.socket(af, socktype, proto) + try: + if timeout is ...
yt_dlp/networking/_helper.py
26
Python
0.786
question
299
51
51
false
[networking] Fix various bugs in socks proxy implementation
8,065
yt-dlp/yt-dlp
132,642
Python
Grub4K
coletdjnz
except socket.error: sock.close() raise def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None, *, _create_socket_func=_socket_connect): # This is to workaround _create_connection() from socket where it will try all # address data from getaddrinfo() incl...
This puzzled me when I first read it. We should declare explicitly what reference we are breaking from (applies both here and down below): ```suggestion # Explicitly break __traceback__ reference cycle ``` Cycles will also eventually be collected by the GC, so I'm not sure if we would even need this opt...
except socket.error: sock.close() raise def create_connection( address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None, *, _create_socket_func=_socket_connect ): # Work around socket.create_connection() which tries all addresses from getaddrinfo() including IPv...
@@ -206,3 +207,54 @@ def wrapper(self, *args, **kwargs): e.handler = self raise return wrapper + + +def _socket_connect(ip_addr, timeout, source_address): + af, socktype, proto, canonname, sa = ip_addr + sock = socket.socket(af, socktype, proto) + try: + if timeout is ...
yt_dlp/networking/_helper.py
26
Python
0.857
suggestion
330
40
45
false
[networking] Fix various bugs in socks proxy implementation
8,065
yt-dlp/yt-dlp
132,642
Python
Grub4K
coletdjnz
if source_address is not None: af = socket.AF_INET if ':' not in source_address[0] else socket.AF_INET6 ip_addrs = [addr for addr in ip_addrs if addr[0] == af] if not ip_addrs: raise OSError( f'No remote IPv{4 if af == socket.AF_INET else 6} addresses available fo...
```suggestion try: raise err finally: # Explicitly break __traceback__ reference cycle # https://bugs.python.org/issue36820 err = None ```
if source_address is not None: af = socket.AF_INET if ':' not in source_address[0] else socket.AF_INET6 ip_addrs = [addr for addr in ip_addrs if addr[0] == af] if not ip_addrs: raise OSError( f'No remote IPv{4 if af == socket.AF_INET else 6} addresses available fo...
@@ -206,3 +207,60 @@ def wrapper(self, *args, **kwargs): e.handler = self raise return wrapper + + +def _socket_connect(ip_addr, timeout, source_address): + af, socktype, proto, canonname, sa = ip_addr + sock = socket.socket(af, socktype, proto) + try: + if timeout is ...
yt_dlp/networking/_helper.py
26
Python
0.857
bug
185
27
26
false
[networking] Fix various bugs in socks proxy implementation
8,065
yt-dlp/yt-dlp
132,642
Python
Grub4K
coletdjnz
entries = [] def parse_graphql_video(video): v_id = video.get('videoId') or video.get('id') or video_id reel_info = traverse_obj( video, ('creation_story', 'short_form_video_context', 'playback_video', {dict})) ...
```suggestion # sd, hd formats w/o resolution info should be deprioritized below DASH 'quality': q(format_id) - 3, ```
entries = [] def parse_graphql_video(video): v_id = video.get('videoId') or video.get('id') or video_id reel_info = traverse_obj( video, ('creation_story', 'short_form_video_context', 'playback_video', {dict})) ...
@@ -552,7 +551,9 @@ def parse_graphql_video(video): else: formats.append({ 'format_id': format_id, - 'quality': q(format_id), + # downgrade quality of old sd, hd formats t...
yt_dlp/extractor/facebook.py
26
Python
0.786
suggestion
185
51
51
false
[ie/facebook] improve format sorting
8,074
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
if len(video_data) > 1: entries = [] for v in video_data: video_url = v[0].get('video_url') if not video_url: continue entries.append(self.url_result(urljoin( url, video_url), self.ie_key(), v[0].get(...
```suggestion # sd, hd formats w/o resolution info should be deprioritized below DASH # TODO: investigate if progressive or src formats still exist preference = -10 if format_id == 'progressive' else -3 ```
entries = [] for v in video_data: video_url = v[0].get('video_url') if not video_url: continue entries.append(self.url_result(urljoin( url, video_url), self.ie_key(), v[0].get('video_id'))) return...
@@ -719,9 +720,11 @@ def parse_attachment(attachment, key='media'): for src_type in ('src', 'src_no_ratelimit'): src = f[0].get('%s_%s' % (quality, src_type)) if src: - preference = -10 if format_id == 'progressive' else -1 + ...
yt_dlp/extractor/facebook.py
26
Python
0.857
suggestion
282
51
51
false
[ie/facebook] improve format sorting
8,074
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
from .common import InfoExtractor from ..utils import ( float_or_none, js_to_json, parse_iso8601, ) class AxsIE(InfoExtractor): IE_NAME = 'axs.tv' _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/]+/)?video/(?P<id>[^?/]+)' _META_URL = 'https://api.myspotlight.tv/dotplayer/video/%s/%s?de...
exclude both queries and fragments with both character classes ```suggestion _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/?#]+/)?video/(?P<id>[^/?#]+)' ```
from .common import InfoExtractor from ..utils import ( float_or_none, js_to_json, parse_iso8601, traverse_obj, url_or_none, ) class AxsIE(InfoExtractor): IE_NAME = 'axs.tv' _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/(?:[^/?#]+/)+)?video/(?P<id>[^/?#]+)' _TESTS = [{ ...
@@ -0,0 +1,83 @@ +from .common import InfoExtractor +from ..utils import ( + float_or_none, + js_to_json, + parse_iso8601, +) + + +class AxsIE(InfoExtractor): + IE_NAME = 'axs.tv' + _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/]+/)?video/(?P<id>[^?/]+)'
yt_dlp/extractor/axs.py
11
Python
0.714
suggestion
173
36
36
false
[ie/Axs] new extractor
8,094
yt-dlp/yt-dlp
132,642
Python
bashonly
barsnick
'duration': 1284.216, 'channel': 'Rock & Roll Road Trip with Sammy Hagar', 'season': 2, 'episode': '3', 'thumbnail': 'https://images.dotstudiopro.com/5f4e9d330a0c3b295a7e8394', }, }, { 'url': 'https://www.axs.tv/channel/rock-star-interview/...
Convention is to use `display_id` (and you could return it in the info_dict, too, if desired), but you don't need to change it. It's fine as-is too
'timestamp': 1685729564, 'duration': 1284.216, 'series': 'Rock & Roll Road Trip with Sammy Hagar', 'season': 2, 'episode': '3', 'thumbnail': 'https://images.dotstudiopro.com/5f4e9d330a0c3b295a7e8394', }, }, { 'url': 'https://www...
@@ -0,0 +1,83 @@ +from .common import InfoExtractor +from ..utils import ( + float_or_none, + js_to_json, + parse_iso8601, +) + + +class AxsIE(InfoExtractor): + IE_NAME = 'axs.tv' + _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/]+/)?video/(?P<id>[^?/]+)' + _META_URL = 'https://api.myspotligh...
yt_dlp/extractor/axs.py
26
Python
0.571
suggestion
147
51
51
false
[ie/Axs] new extractor
8,094
yt-dlp/yt-dlp
132,642
Python
bashonly
barsnick
}, }, { 'url': 'https://www.axs.tv/channel/rock-star-interview/video/daryl-hall', 'md5': '300ae795cd8f9984652c0949734ffbdc', 'info_dict': { 'id': '5f488148b70e4f392572977c', 'title': 'Daryl Hall', 'ext': 'mp4', 'description': 'md5:e54ec...
No point to having a default if the next line is fatal ```suggestion transform_source=js_to_json) ```
'thumbnail': 'https://images.dotstudiopro.com/5f4e9d330a0c3b295a7e8394', }, }, { 'url': 'https://www.axs.tv/channel/rock-star-interview/video/daryl-hall', 'md5': '300ae795cd8f9984652c0949734ffbdc', 'info_dict': { 'id': '5f488148b70e4f392572977c', '...
@@ -0,0 +1,83 @@ +from .common import InfoExtractor +from ..utils import ( + float_or_none, + js_to_json, + parse_iso8601, +) + + +class AxsIE(InfoExtractor): + IE_NAME = 'axs.tv' + _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/]+/)?video/(?P<id>[^?/]+)' + _META_URL = 'https://api.myspotligh...
yt_dlp/extractor/axs.py
26
Python
0.714
suggestion
116
51
51
false
[ie/Axs] new extractor
8,094
yt-dlp/yt-dlp
132,642
Python
bashonly
barsnick
'id': '5f488148b70e4f392572977c', 'title': 'Daryl Hall', 'ext': 'mp4', 'description': 'md5:e54ecaa0f4b5683fc9259e9e4b196628', 'upload_date': '20230214', 'timestamp': 1676403615, 'duration': 2570.668, 'channel': 'The Big Inte...
IMO since `_META_URL` is only being used once, this is more readable: ```suggestion meta = self._download_json( f'https://api.myspotlight.tv/dotplayer/video/{company_id}/{video_id}, video_id, query={'device_type': 'desktop_web'})['video'] ``` (and remove `_META_URL` above)
'info_dict': { 'id': '5f488148b70e4f392572977c', 'display_id': 'daryl-hall', 'title': 'Daryl Hall', 'ext': 'mp4', 'description': 'md5:e54ecaa0f4b5683fc9259e9e4b196628', 'upload_date': '20230214', 'timestamp': 1676403615, ...
@@ -0,0 +1,83 @@ +from .common import InfoExtractor +from ..utils import ( + float_or_none, + js_to_json, + parse_iso8601, +) + + +class AxsIE(InfoExtractor): + IE_NAME = 'axs.tv' + _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/]+/)?video/(?P<id>[^?/]+)' + _META_URL = 'https://api.myspotligh...
yt_dlp/extractor/axs.py
26
Python
1
suggestion
313
51
51
false
[ie/Axs] new extractor
8,094
yt-dlp/yt-dlp
132,642
Python
bashonly
barsnick
'timestamp': 1676403615, 'duration': 2570.668, 'channel': 'The Big Interview with Dan Rather', 'season': 3, 'episode': '5', 'thumbnail': 'https://images.dotstudiopro.com/5f4d1901f340b50d937cec32', }, }] def _real_extract(self, url)...
We can get rid of `entry_protocol` and inline the format URL ```suggestion formats = self._extract_m3u8_formats( meta['video_m3u8'], video_id, 'mp4', m3u8_id='hls', fatal=False) ``` I'm assuming `fatal=False` is so metadata/subs can still be extracted if the m3u8 extraction fails? Do we want to...
'description': 'md5:e54ecaa0f4b5683fc9259e9e4b196628', 'upload_date': '20230214', 'timestamp': 1676403615, 'duration': 2570.668, 'series': 'The Big Interview with Dan Rather', 'season': 3, 'episode': '5', 'thumbnail': 'https...
@@ -0,0 +1,83 @@ +from .common import InfoExtractor +from ..utils import ( + float_or_none, + js_to_json, + parse_iso8601, +) + + +class AxsIE(InfoExtractor): + IE_NAME = 'axs.tv' + _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/]+/)?video/(?P<id>[^?/]+)' + _META_URL = 'https://api.myspotligh...
yt_dlp/extractor/axs.py
26
Python
0.857
bug
354
46
50
false
[ie/Axs] new extractor
8,094
yt-dlp/yt-dlp
132,642
Python
bashonly
barsnick
'season': 3, 'episode': '5', 'thumbnail': 'https://images.dotstudiopro.com/5f4d1901f340b50d937cec32', }, }] def _real_extract(self, url): initial_id = self._match_id(url) webpage = self._download_webpage(url, initial_id) webpage_json_data = s...
Subtitles extraction should be non-fatal. Here let's use `traverse_obj` to branch/filter: ```suggestion for cc in traverse_obj(meta, ('closeCaption', lambda _, v: url_or_none(v['srtPath']))): ```
'duration': 2570.668, 'series': 'The Big Interview with Dan Rather', 'season': 3, 'episode': '5', 'thumbnail': 'https://images.dotstudiopro.com/5f4d1901f340b50d937cec32', }, }] def _real_extract(self, url): display_id = self._match_id(...
@@ -0,0 +1,83 @@ +from .common import InfoExtractor +from ..utils import ( + float_or_none, + js_to_json, + parse_iso8601, +) + + +class AxsIE(InfoExtractor): + IE_NAME = 'axs.tv' + _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/]+/)?video/(?P<id>[^?/]+)' + _META_URL = 'https://api.myspotligh...
yt_dlp/extractor/axs.py
26
Python
0.857
refactor
206
43
47
false
[ie/Axs] new extractor
8,094
yt-dlp/yt-dlp
132,642
Python
bashonly
barsnick
company_id = webpage_json_data['company_id'] meta_url = self._META_URL % (company_id, video_id) meta = self._download_json(meta_url, video_id)['video'] format_url = meta['video_m3u8'] formats = self._extract_m3u8_formats( format_url, video_id, 'mp4', m3u8_id='hls', ...
`traverse_obj` is especially useful for inline metadata extraction; we can use dict key traversal here. Using set syntax, we can expect types (e.g. `{str}`) and perform transformations (`{callable}`) I changed `channel` to `series`, since that seems more accurate? Although if you have rationale for extracting it as ...
transform_source=js_to_json) video_id = webpage_json_data['video_id'] company_id = webpage_json_data['company_id'] meta = self._download_json( f'https://api.myspotlight.tv/dotplayer/video/{company_id}/{video_id}', video_id, query={'device_type': 'desktop_web'...
@@ -0,0 +1,83 @@ +from .common import InfoExtractor +from ..utils import ( + float_or_none, + js_to_json, + parse_iso8601, +) + + +class AxsIE(InfoExtractor): + IE_NAME = 'axs.tv' + _VALID_URL = r'https?://(?:www\.)?axs\.tv/(?:channel/[^/]+/)?video/(?P<id>[^?/]+)' + _META_URL = 'https://api.myspotligh...
yt_dlp/extractor/axs.py
26
Python
1
refactor
1,040
29
33
false
[ie/Axs] new extractor
8,094
yt-dlp/yt-dlp
132,642
Python
bashonly
barsnick
'timestamp': 1603820940, 'view_count': int, 'like_count': int, 'repost_count': int, 'comment_count': int, }, 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'], }, { # not the first ...
let's explicitly state what we are testing ```suggestion }, { # no OpenGraph title ```
'timestamp': 1603820940, 'view_count': int, 'like_count': int, 'repost_count': int, 'comment_count': int, }, 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'], }, { # not the first ...
@@ -265,6 +265,26 @@ class NitterIE(InfoExtractor): 'repost_count': int, 'comment_count': int, } + }, { # test for OpenGraph patch #7575
yt_dlp/extractor/nitter.py
26
Python
0.571
suggestion
99
51
51
false
Fixes the issue #7575 [Nitter] unable to extract OpenGraph description
8,102
yt-dlp/yt-dlp
132,642
Python
bashonly
ApoorvShah111
'view_count': int, 'like_count': int, 'repost_count': int, 'comment_count': int, }, 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'], }, { # not the first tweet but main-tweet 'url': f...
```suggestion 'url': f'https://{current_instance}/LocalBateman/status/1678455464038735895#m', ```
'view_count': int, 'like_count': int, 'repost_count': int, 'comment_count': int, }, 'expected_warnings': ['Ignoring subtitle tracks found in the HLS manifest'], }, { # not the first tweet but main-tweet 'url': f...
@@ -265,6 +265,26 @@ class NitterIE(InfoExtractor): 'repost_count': int, 'comment_count': int, } + }, { # test for OpenGraph patch #7575 + 'url': f'https://nitter.net/LocalBateman/status/1678455464038735895#m',
yt_dlp/extractor/nitter.py
26
Python
0.714
suggestion
111
51
51
false
Fixes the issue #7575 [Nitter] unable to extract OpenGraph description
8,102
yt-dlp/yt-dlp
132,642
Python
bashonly
ApoorvShah111
'id': '1354848277481414657', 'ext': 'mp4', 'title': 'md5:bef647f03bd1c6b15b687ea70dfc9700', 'description': 'md5:5efba25e2f9dac85ebcd21160cb4341f', 'thumbnail': r're:^https?://.*\.jpg$', 'uploader': 'Firefox 🔥', ...
```suggestion 'uploader_url': f'https://{current_instance}/LocalBateman', ```
'id': '1354848277481414657', 'ext': 'mp4', 'title': 'md5:bef647f03bd1c6b15b687ea70dfc9700', 'description': 'md5:5efba25e2f9dac85ebcd21160cb4341f', 'thumbnail': r're:^https?://.*\.jpg$', 'uploader': 'Firefox 🔥', ...
@@ -265,6 +265,26 @@ class NitterIE(InfoExtractor): 'repost_count': int, 'comment_count': int, } + }, { # test for OpenGraph patch #7575 + 'url': f'https://nitter.net/LocalBateman/status/1678455464038735895#m', + 'info_dict': { + ...
yt_dlp/extractor/nitter.py
26
Python
0.571
suggestion
95
51
51
false
Fixes the issue #7575 [Nitter] unable to extract OpenGraph description
8,102
yt-dlp/yt-dlp
132,642
Python
bashonly
ApoorvShah111
while has_next_page: playlist = self._call_api( self._ROOT_TYPE, '''%s %s %s(first: 100%s) { edges { node { %s } } pageInfo { endCursor hasNextPage } }''' % (self._TITLE_KEY, self._DESCRIPTION_KEY, playlist...
```suggestion video_id = f'{owner_username}_{item_slug}' if item_slug and owner_username else None ``` if it's already touched, we might as well
while has_next_page: playlist = self._call_api( self._ROOT_TYPE, '''%s %s %s(first: 100%s) { edges { node { %s } } pageInfo { endCursor hasNextPage } }''' % (self._TITLE_KEY, self._DESCRIPTION_KEY, playlist...
@@ -259,9 +274,9 @@ def _real_extract(self, url): cloudcast_url = cloudcast.get('url') if not cloudcast_url: continue - slug = try_get(cloudcast, lambda x: x['slug'], compat_str) + item_slug = try_get(cloudcast, lambda x: x['slug'], co...
yt_dlp/extractor/mixcloud.py
26
Python
0.786
suggestion
163
51
51
false
update mixcloud api url
8,114
yt-dlp/yt-dlp
132,642
Python
Grub4K
garret1317
'series': 'Auf Endlagersuche. Der deutsche Weg zu einem sicheren Atommülllager', 'tags': ['Atomenergie', 'Endlager', 'hoch-radioaktiver Abfall', 'Endlagersuche', 'Atommüll', 'Atomendlager', 'Gorleben', 'Deutschland'], 'thumbnail': 'https://www.bpb.de/cache/images/3/315813_teaser_16x9...
We can just use `url` in the `urljoin` call below
'series': 'Auf Endlagersuche. Der deutsche Weg zu einem sicheren Atommülllager', 'tags': ['Atomenergie', 'Endlager', 'hoch-radioaktiver Abfall', 'Endlagersuche', 'Atommüll', 'Atomendlager', 'Gorleben', 'Deutschland'], 'thumbnail': 'https://www.bpb.de/cache/images/3/315813_teaser_16x9...
@@ -1,56 +1,168 @@ +import functools import re from .common import InfoExtractor from ..utils import ( + clean_html, + extract_attributes, + get_element_text_and_html_by_tag, + get_elements_by_class, + join_nonempty, js_to_json, - determine_ext, + mimetype2ext, + unified_strdate, + ...
yt_dlp/extractor/bpb.py
26
Python
0.286
suggestion
49
51
51
false
[ie/bpb] Support more urls and extract more metadata
8,119
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
'tags': ['Atomenergie', 'Endlager', 'hoch-radioaktiver Abfall', 'Endlagersuche', 'Atommüll', 'Atomendlager', 'Gorleben', 'Deutschland'], 'thumbnail': 'https://www.bpb.de/cache/images/3/315813_teaser_16x9_1240.png?92A94', 'title': 'Folge 1: Eine Einführung', 'uploader': 'B...
```suggestion _TITLE_RE = re.compile('(?P<title>[^<]*)<[^>]+>(?P<series>[^<]*)') ```
'tags': ['Atomenergie', 'Endlager', 'hoch-radioaktiver Abfall', 'Endlagersuche', 'Atommüll', 'Atomendlager', 'Gorleben', 'Deutschland'], 'thumbnail': 'https://www.bpb.de/cache/images/3/315813_teaser_16x9_1240.png?92A94', 'title': 'Folge 1: Eine Einführung', 'uploader': 'B...
@@ -1,56 +1,168 @@ +import functools import re from .common import InfoExtractor from ..utils import ( + clean_html, + extract_attributes, + get_element_text_and_html_by_tag, + get_elements_by_class, + join_nonempty, js_to_json, - determine_ext, + mimetype2ext, + unified_strdate, + ...
yt_dlp/extractor/bpb.py
26
Python
0.571
suggestion
90
51
51
false
[ie/bpb] Support more urls and extract more metadata
8,119
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
'id': '517806', 'ext': 'mp3', 'creator': 'Bundeszentrale für politische Bildung', 'description': 'md5:594689600e919912aade0b2871cc3fed', 'release_date': '20230127', 'series': 'Vorträge des Fachtags "Modernisierer. Grenzgänger. Anstifter. Sechs Jahr...
Just a note that it might be useful to eventually generalize this and add it as an `InfoExtractor` helper method, since it is very similar to `ZaikoBaseIE._parse_vue_element_attrs` (but not similar enough as-is)
'id': '517806', 'ext': 'mp3', 'creator': 'Bundeszentrale für politische Bildung', 'description': 'md5:594689600e919912aade0b2871cc3fed', 'release_date': '20230127', 'series': 'Vorträge des Fachtags "Modernisierer. Grenzgänger. Anstifter. Sechs Jahr...
@@ -1,56 +1,168 @@ +import functools import re from .common import InfoExtractor from ..utils import ( + clean_html, + extract_attributes, + get_element_text_and_html_by_tag, + get_elements_by_class, + join_nonempty, js_to_json, - determine_ext, + mimetype2ext, + unified_strdate, + ...
yt_dlp/extractor/bpb.py
26
Python
0.643
refactor
211
51
51
false
[ie/bpb] Support more urls and extract more metadata
8,119
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
_TITLE_RE = re.compile('(?P<title>.*?)<[^>]+>(?P<series>[^<]*)') def _parse_vue_attributes(self, name, string, video_id): attributes = extract_attributes(self._search_regex(rf'(<{name}(?:"[^"]*?"|[^>])*>)', string, name)) for key, value in attributes.items(): if key.startswith(':')...
`'vcodec': 'none'` if audio ```suggestion source_type = source.get('type', '') is_video = source_type.startswith('video') extension = mimetype2ext(source_type) note = url.rpartition('.')[0].rpartition('_')[2] if is_video else None return { 'url': url, ...
def _parse_vue_attributes(self, name, string, video_id): attributes = extract_attributes(self._search_regex(rf'(<{name}(?:"[^"]*?"|[^>])*>)', string, name)) for key, value in attributes.items(): if key.startswith(':'): attributes[key] = self._parse_json(value, video_id,...
@@ -1,56 +1,168 @@ +import functools import re from .common import InfoExtractor from ..utils import ( + clean_html, + extract_attributes, + get_element_text_and_html_by_tag, + get_elements_by_class, + join_nonempty, js_to_json, - determine_ext, + mimetype2ext, + unified_strdate, + ...
yt_dlp/extractor/bpb.py
26
Python
0.929
suggestion
544
51
51
false
[ie/bpb] Support more urls and extract more metadata
8,119
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
'format_id': join_nonempty(extension, note), } def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) title_result = traverse_obj(webpage, ({html_get_element(cls='opening-header__title')}, {self._TITLE_RE.match})) ...
as suggested above: ```suggestion 'thumbnail': ('poster', {lambda x: urljoin(url, x)}), ```
'quality': 10 if note == 'high' else 0, 'format_note': note, 'format_id': join_nonempty(extension, note), } def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) title_result = traverse_obj(w...
@@ -1,56 +1,168 @@ +import functools import re from .common import InfoExtractor from ..utils import ( + clean_html, + extract_attributes, + get_element_text_and_html_by_tag, + get_elements_by_class, + join_nonempty, js_to_json, - determine_ext, + mimetype2ext, + unified_strdate, + ...
yt_dlp/extractor/bpb.py
26
Python
0.714
suggestion
110
29
31
false
[ie/bpb] Support more urls and extract more metadata
8,119
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
video_urls = [] video_files = video.get('video_files') if isinstance(video_files, list): video_urls.extend(video_files) elif isinstance(video_files, dict): video_urls.extend(video_files.values()) video_urls = list(set(video_urls)) video_prefix =...
```suggestion token = filesh.get(str(height)) ``` can remove the compat_str now
'duration': 7, 'age_limit': 0, 'tags': ['cica', 'Jet_Pack'], }, }] def _real_extract(self, url): video_id = self._match_id(url) video = self._download_json( f'https://amfphp.indavideo.hu/SYm0json.php/player.playerHandler.getVideoData/{vid...
@@ -78,13 +73,12 @@ def _real_extract(self, url): for video_url in video_urls: height = int_or_none(self._search_regex( r'\.(\d{3,4})\.mp4(?:\?|$)', video_url, 'height', default=None)) - if filesh: - if not height: - continue - ...
yt_dlp/extractor/indavideo.py
26
Python
0.643
suggestion
96
51
51
false
[extractor/indavideo] Fix video extraction
8,129
yt-dlp/yt-dlp
132,642
Python
coletdjnz
aky-01
video_urls = [] video_files = video.get('video_files') if isinstance(video_files, list): video_urls.extend(video_files) elif isinstance(video_files, dict): video_urls.extend(video_files.values()) video_urls = list(set(video_urls)) video_prefix ...
```suggestion height = int_or_none(list(filesh.keys())[0]) ```
'upload_date': '20140127', 'duration': 7, 'age_limit': 0, 'tags': ['cica', 'Jet_Pack'], }, }] def _real_extract(self, url): video_id = self._match_id(url) video = self._download_json( f'https://amfphp.indavideo.hu/SYm0json.php...
@@ -78,13 +73,12 @@ def _real_extract(self, url): for video_url in video_urls: height = int_or_none(self._search_regex( r'\.(\d{3,4})\.mp4(?:\?|$)', video_url, 'height', default=None)) - if filesh: - if not height: - continue - ...
yt_dlp/extractor/indavideo.py
26
Python
0.571
suggestion
80
51
51
false
[extractor/indavideo] Fix video extraction
8,129
yt-dlp/yt-dlp
132,642
Python
coletdjnz
aky-01
from .common import InfoExtractor from ..compat import compat_str from ..utils import ( int_or_none, parse_age_limit, parse_iso8601, update_url_query, time_seconds, ) class IndavideoEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:(?:embed\.)?indavideo\.hu/player/video/|assets\.indavideo\.hu...
```suggestion time_seconds, update_url_query, ```
from .common import InfoExtractor from ..utils import ( int_or_none, parse_age_limit, parse_iso8601, time_seconds, update_url_query, ) class IndavideoEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:(?:embed\.)?indavideo\.hu/player/video/|assets\.indavideo\.hu/swf/player\.swf\?.*\b(?:v(?:ID|...
@@ -5,21 +5,21 @@ parse_age_limit, parse_iso8601, update_url_query, + time_seconds,
yt_dlp/extractor/indavideo.py
8
Python
0.571
suggestion
60
33
33
false
[extractor/indavideo] Fix video extraction
8,129
yt-dlp/yt-dlp
132,642
Python
bashonly
aky-01
from .common import InfoExtractor from ..compat import compat_str from ..utils import ( int_or_none, parse_age_limit, parse_iso8601, update_url_query, time_seconds, ) class IndavideoEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:(?:embed\.)?indavideo\.hu/player/video/|assets\.indavideo\.hu...
could you add one of these as a webpage test? e.g. ```py _WEBPAGE_TESTS = [{ 'url': 'https://indavideo.hu/video/Vicces_cica_1', 'info_dict': { 'id': 'id_goes_here', 'ext': 'mp4', # etc etc }, }] ```
from .common import InfoExtractor from ..utils import ( int_or_none, parse_age_limit, parse_iso8601, time_seconds, update_url_query, ) class IndavideoEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:(?:embed\.)?indavideo\.hu/player/video/|assets\.indavideo\.hu/swf/player\.swf\?.*\b(?:v(?:ID|...
@@ -5,21 +5,21 @@ parse_age_limit, parse_iso8601, update_url_query, + time_seconds, ) class IndavideoEmbedIE(InfoExtractor): _VALID_URL = r'https?://(?:(?:embed\.)?indavideo\.hu/player/video/|assets\.indavideo\.hu/swf/player\.swf\?.*\b(?:v(?:ID|id))=)(?P<id>[\da-f]+)' # Some example UR...
yt_dlp/extractor/indavideo.py
18
Python
0.857
question
279
43
43
false
[extractor/indavideo] Fix video extraction
8,129
yt-dlp/yt-dlp
132,642
Python
bashonly
aky-01
'ext': 'mp4', 'title': 'Cicatánc', 'description': '', 'thumbnail': r're:^https?://.*\.jpg$', 'uploader': 'cukiajanlo', 'uploader_id': '83729', 'timestamp': 1439193826, 'upload_date': '20150810', 'duration': 72, ...
```suggestion f'https://amfphp.indavideo.hu/SYm0json.php/player.playerHandler.getVideoData/{video_id}/', video_id, query={'_': time_seconds()})['data'] ```
'title': 'Cicatánc', 'description': '', 'thumbnail': r're:^https?://.*\.jpg$', 'uploader': 'cukiajanlo', 'uploader_id': '83729', 'timestamp': 1439193826, 'upload_date': '20150810', 'duration': 72, 'age_limit': 0,...
@@ -36,22 +36,20 @@ class IndavideoEmbedIE(InfoExtractor): 'tags': ['tánc', 'cica', 'cuki', 'cukiajanlo', 'newsroom'], }, }, { - 'url': 'http://embed.indavideo.hu/player/video/1bdc3c6d80?autostart=1&hide=1', + 'url': 'https://embed.indavideo.hu/player/video/1bdc3c6d80?autostart=...
yt_dlp/extractor/indavideo.py
26
Python
0.857
suggestion
182
51
51
false
[extractor/indavideo] Fix video extraction
8,129
yt-dlp/yt-dlp
132,642
Python
bashonly
aky-01
video_prefix = video_urls[0].rsplit('/', 1)[0] for flv_file in video.get('flv_files', []): flv_url = '%s/%s' % (video_prefix, flv_file) if flv_url not in video_urls: video_urls.append(flv_url) filesh = video.get('filesh') formats = [] f...
The old code implies that the `token` is optional and `video['filesh']` may be non-existent, and as such the old token code was completely non-fatal. Do you know for certain that every video requires a token now?
video = self._download_json( f'https://amfphp.indavideo.hu/SYm0json.php/player.playerHandler.getVideoData/{video_id}/', video_id, query={'_': time_seconds()})['data'] video_urls = [] video_files = video.get('video_files') if isinstance(video_files, list): ...
@@ -78,13 +73,12 @@ def _real_extract(self, url): for video_url in video_urls: height = int_or_none(self._search_regex( r'\.(\d{3,4})\.mp4(?:\?|$)', video_url, 'height', default=None)) - if filesh: - if not height: - continue - ...
yt_dlp/extractor/indavideo.py
26
Python
0.571
question
212
50
51
false
[extractor/indavideo] Fix video extraction
8,129
yt-dlp/yt-dlp
132,642
Python
bashonly
aky-01
elif isinstance(video_files, dict): video_urls.extend(video_files.values()) video_urls = list(set(video_urls)) video_prefix = video_urls[0].rsplit('/', 1)[0] for flv_file in video.get('flv_files', []): flv_url = '%s/%s' % (video_prefix, flv_file) if...
```suggestion formats.append({ 'url': update_url_query(video_url, {'token': token}), ```
def _real_extract(self, url): video_id = self._match_id(url) video = self._download_json( f'https://amfphp.indavideo.hu/SYm0json.php/player.playerHandler.getVideoData/{video_id}/', video_id, query={'_': time_seconds()})['data'] video_urls = [] video_files ...
@@ -78,13 +73,12 @@ def _real_extract(self, url): for video_url in video_urls: height = int_or_none(self._search_regex( r'\.(\d{3,4})\.mp4(?:\?|$)', video_url, 'height', default=None)) - if filesh: - if not height: - continue - ...
yt_dlp/extractor/indavideo.py
26
Python
0.714
suggestion
119
51
51
false
[extractor/indavideo] Fix video extraction
8,129
yt-dlp/yt-dlp
132,642
Python
bashonly
aky-01
'uploader': 'cukiajanlo', 'uploader_id': '83729', 'timestamp': 1439193826, 'upload_date': '20150810', 'duration': 72, 'age_limit': 0, 'tags': ['tánc', 'cica', 'cuki', 'cukiajanlo', 'newsroom'], }, }, { 'url': 'https:...
This is not what https://github.com/yt-dlp/yt-dlp/pull/8129/files#r1328046327 was asking for Add a new class var, `_WEBPAGE_TESTS`, and move this test to it with its original URL (https://indavideo.hu/video/Vicces_cica_1) We need to test embed extraction. You can run the test with: `python test/test_download.py ...
'uploader': 'cukiajanlo', 'uploader_id': '83729', 'timestamp': 1439193826, 'upload_date': '20150810', 'duration': 72, 'age_limit': 0, 'tags': ['tánc', 'cica', 'cuki', 'cukiajanlo', 'newsroom'], }, }, { 'url': 'https:...
@@ -36,21 +35,36 @@ class IndavideoEmbedIE(InfoExtractor): 'tags': ['tánc', 'cica', 'cuki', 'cukiajanlo', 'newsroom'], }, }, { - 'url': 'http://embed.indavideo.hu/player/video/1bdc3c6d80?autostart=1&hide=1', + 'url': 'https://embed.indavideo.hu/player/video/3b63bc219c?autostart=...
yt_dlp/extractor/indavideo.py
26
Python
0.643
refactor
498
51
51
false
[extractor/indavideo] Fix video extraction
8,129
yt-dlp/yt-dlp
132,642
Python
bashonly
aky-01
}, { 'url': 'https://assets.indavideo.hu/swf/player.swf?v=fe25e500&vID=1bdc3c6d80&autostart=1&hide=1&i=1', 'only_matching': True, }] _WEBPAGE_TESTS = [{ 'url': 'https://indavideo.hu/video/Vicces_cica_1', 'info_dict': { 'id': '1335611', 'ext': 'mp4', ...
pretty sure it should've been `if video_file:`, but are we sure we're not losing any formats by removing this code?
}] _WEBPAGE_TESTS = [{ 'url': 'https://indavideo.hu/video/Vicces_cica_1', 'info_dict': { 'id': '1335611', 'ext': 'mp4', 'title': 'Vicces cica', 'description': 'Játszik a tablettel. :D', 'thumbnail': r're:^https?://.*\.jpg$', ...
@@ -60,9 +74,6 @@ def _real_extract(self, url): elif isinstance(video_files, dict): video_urls.extend(video_files.values()) - video_file = video.get('video_file') - if video: - video_urls.append(video_file)
yt_dlp/extractor/indavideo.py
26
Python
0.571
question
115
51
51
false
[extractor/indavideo] Fix video extraction
8,129
yt-dlp/yt-dlp
132,642
Python
bashonly
aky-01
traverse_obj, ) class MonstercatIE(InfoExtractor): _VALID_URL = r'https://www\.monstercat\.com/release/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The Secret Language of Trees', ...
Make sure to use single quotes ```suggestion title = traverse_obj(get_element_by_class('d-inline-flex flex-column', td).partition(' <span'), (0, {strip_or_none})) ids = extract_attributes(get_element_html_by_class('btn-play cursor-pointer mr-small', td)) ```
strip_or_none, traverse_obj, try_call, ) class MonstercatIE(InfoExtractor): _VALID_URL = r'https://www\.monstercat\.com/release/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The ...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.857
refactor
286
51
51
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
Grub4K
garret1317
TRACK_API = 'https://www.monstercat.com/api/release/{release_id}/track-stream/{song_id}' def _extract_tracks(self, table, album_meta): for td in re.findall(r'<tr[^<]*>((?:(?!</tr>)[\w\W])+)', table): # regex by chatgpt due to lack of get_elements_by_tag title = traverse_obj(get_element_by_...
```suggestion date = traverse_obj(html, ({lambda x: get_element_by_class('font-italic mb-medium d-tablet-none d-phone-block', html).partition('Released ')}, 2, {strip_or_none}, {unified_strdate})) ``` The previous way was fatal, since the `get_element_by...` functions raise an error
}] def _extract_tracks(self, table, album_meta): for td in re.findall(r'<tr[^<]*>((?:(?!</tr>)[\w\W])+)', table): # regex by chatgpt due to lack of get_elements_by_tag title = clean_html(try_call( lambda: get_element_by_class('d-inline-flex flex-column', td).partition(' <sp...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.929
suggestion
294
39
49
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
Grub4K
garret1317
strip_or_none, traverse_obj, ) class MonstercatIE(InfoExtractor): _VALID_URL = r'https://www\.monstercat\.com/release/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The Secret Languag...
objects passed to `traverse_obj` can still be fatal. `{transformations}` are wrapped in `try_call`, which IMO is what we should use instead when traversal serves no other purpose also, for the string values IMO we should also call `clean_html` just in case (it takes care of the strip too) ```suggestion ...
unified_strdate, strip_or_none, traverse_obj, try_call, ) class MonstercatIE(InfoExtractor): _VALID_URL = r'https://www\.monstercat\.com/release/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { ...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.857
suggestion
458
51
51
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
traverse_obj, ) class MonstercatIE(InfoExtractor): _VALID_URL = r'https://www\.monstercat\.com/release/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The Secret Language of Trees', ...
I think we should check for the IDs needed in the URL and skip instead of yielding a bogus URL optionally you could add a warning before continue ```suggestion ids = extract_attributes(try_call(lambda: get_element_html_by_class('btn-play cursor-pointer mr-small', td)) or '') track_id = ids...
strip_or_none, traverse_obj, try_call, ) class MonstercatIE(InfoExtractor): _VALID_URL = r'https://www\.monstercat\.com/release/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The ...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.857
refactor
473
51
51
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
_VALID_URL = r'https://www\.monstercat\.com/release/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The Secret Language of Trees', 'id': '742779548009', 'thumbnail': 'htt...
```suggestion 'track_number': int_or_none(try_call(lambda: get_element_by_class('py-xsmall', td))), ```
class MonstercatIE(InfoExtractor): _VALID_URL = r'https://www\.monstercat\.com/release/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The Secret Language of Trees', 'id': '74277954...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.714
suggestion
121
51
51
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
_TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The Secret Language of Trees', 'id': '742779548009', 'thumbnail': 'https://www.monstercat.com/release/742779548009/cover', 'rel...
```suggestion 'artist': clean_html(try_call(lambda: get_element_by_class('d-block fs-xxsmall', td))), ```
class MonstercatIE(InfoExtractor): _VALID_URL = r'https://www\.monstercat\.com/release/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The Secret Language of Trees', 'id': '742779548...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.714
suggestion
123
51
51
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'album_artist': 'BT', } }] TRACK_API = 'https://www.monstercat.com/api/release/{release_id}/track-stream/{song_id}' def _extract_tracks(self, table, album_meta): for td in re.findall(r'<tr[^<]*>((?:(?!</tr>)[\w\W])+)', table): # regex by chatgpt due to lack of get_elements_by_...
Add a comment here, And if we want this to be non-fatal (to extract album metadata when no tracklist?), then we should fallback to empty string so that the `re.findall` in `_extract_tracks` doesn't throw ```suggestion # wrap all `get_elements` in `try_call`, HTMLParser has problems with site's html ...
'release_date': '20230711', 'album': 'The Secret Language of Trees', 'album_artist': 'BT', } }] def _extract_tracks(self, table, album_meta): for td in re.findall(r'<tr[^<]*>((?:(?!</tr>)[\w\W])+)', table): # regex by chatgpt due to lack of get_elements_by_t...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.857
refactor
414
43
51
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
}] TRACK_API = 'https://www.monstercat.com/api/release/{release_id}/track-stream/{song_id}' def _extract_tracks(self, table, album_meta): for td in re.findall(r'<tr[^<]*>((?:(?!</tr>)[\w\W])+)', table): # regex by chatgpt due to lack of get_elements_by_tag title = traverse_obj(get_ele...
```suggestion title = try_call(lambda: get_element_text_and_html_by_tag('h1', html)[0]) ```
'album_artist': 'BT', } }] def _extract_tracks(self, table, album_meta): for td in re.findall(r'<tr[^<]*>((?:(?!</tr>)[\w\W])+)', table): # regex by chatgpt due to lack of get_elements_by_tag title = clean_html(try_call( lambda: get_element_by_class('d-i...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.714
suggestion
101
41
51
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
yield { **album_meta, 'title': title, 'track': title, 'track_number': traverse_obj(get_element_by_class('py-xsmall', td), {int_or_none}), 'artist': traverse_obj(td, {lambda td: get_element_by_class('d-block fs-xxsmall', td)}), ...
```suggestion 'album_artist': try_call( lambda: get_element_by_class('h-normal text-uppercase mb-desktop-medium mb-smallish', html)), ```
ids = extract_attributes(try_call(lambda: get_element_html_by_class('btn-play cursor-pointer mr-small', td)) or '') track_id = ids.get('data-track-id') release_id = ids.get('data-release-id') track_number = int_or_none(try_call(lambda: get_element_by_class('py-xsmall', t...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.714
suggestion
168
33
43
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
**album_meta, 'title': title, 'track': title, 'track_number': traverse_obj(get_element_by_class('py-xsmall', td), {int_or_none}), 'artist': traverse_obj(td, {lambda td: get_element_by_class('d-block fs-xxsmall', td)}), 'url'...
```suggestion 'release_year': int_or_none(date[:4]) if date else None, ```
track_id = ids.get('data-track-id') release_id = ids.get('data-release-id') track_number = int_or_none(try_call(lambda: get_element_by_class('py-xsmall', td))) if not track_id or not release_id: self.report_warning(f'Skipping track {track_number}, ID(s) n...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.571
suggestion
88
32
42
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'info_dict': { 'title': 'The Secret Language of Trees', 'id': '742779548009', 'thumbnail': 'https://www.monstercat.com/release/742779548009/cover', 'release_year': 2023, 'release_date': '20230711', 'album': 'The Secret Language of Trees', ...
if we have ID variables already, then IMO it's simpler to inline f-string here instead of using class var ```suggestion 'url': f'https://www.monstercat.com/api/release/{release_id}/track-stream/{track_id}', 'id': track_id, ```
'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The Secret Language of Trees', 'id': '742779548009', 'thumbnail': 'https://www.monstercat.com/release/742779548009/cover', 'release_year': 2023...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.857
suggestion
262
50
51
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
ids = traverse_obj(get_element_html_by_class('btn-play cursor-pointer mr-small', td), {extract_attributes}) yield { **album_meta, 'title': title, 'track': title, 'track_number': traverse_obj(get_element_by_class('py-xsmall', td), {i...
input url might have a query or fragment, let's reconstruct ```suggestion 'thumbnail': f'https://www.monstercat.com/release/{url_id}/cover', ```
lambda: get_element_by_class('d-inline-flex flex-column', td).partition(' <span')[0])) ids = extract_attributes(try_call(lambda: get_element_html_by_class('btn-play cursor-pointer mr-small', td)) or '') track_id = ids.get('data-track-id') release_id = ids.get('data-re...
@@ -0,0 +1,69 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, +) + + +class MonstercatIE(Inf...
yt_dlp/extractor/monstercat.py
26
Python
0.714
suggestion
159
34
44
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'playlist_count': 20, 'info_dict': { 'title': 'The Secret Language of Trees', 'id': '742779548009', 'thumbnail': 'https://www.monstercat.com/release/742779548009/cover', 'release_year': 2023, 'release_date': '20230711', 'album': 'Th...
```suggestion if not track_id or not release_id: self.report_warning(f'Skipping track {track_number}, ID(s) not found') self.write_debug(f'release_id={repr(release_id)} track_id={repr(track_id)}') continue ```
'playlist_count': 20, 'info_dict': { 'title': 'The Secret Language of Trees', 'id': '742779548009', 'thumbnail': 'https://www.monstercat.com/release/742779548009/cover', 'release_year': 2023, 'release_date': '20230711', 'album': 'Th...
@@ -0,0 +1,80 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + clean_html, + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, + try_call...
yt_dlp/extractor/monstercat.py
26
Python
0.929
bug
274
51
51
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'id': track_id, 'ext': 'mp3' } def _real_extract(self, url): url_id = self._match_id(url) html = self._download_webpage(url, url_id) # wrap all `get_elements` in `try_call`, HTMLParser has problems with site's html tracklist_table = try_ca...
```suggestion return self.playlist_result( self._extract_tracks(tracklist_table, album_meta), playlist_id=url_id, **album_meta) ```
'id': track_id, 'ext': 'mp3' } def _real_extract(self, url): url_id = self._match_id(url) html = self._download_webpage(url, url_id) # wrap all `get_elements` in `try_call`, HTMLParser has problems with site's html tracklist_table = try_ca...
@@ -0,0 +1,79 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + clean_html, + extract_attributes, + get_element_by_class, + get_element_html_by_class, + get_element_text_and_html_by_tag, + int_or_none, + unified_strdate, + strip_or_none, + traverse_obj, + try_call...
yt_dlp/extractor/monstercat.py
26
Python
0.786
refactor
154
27
27
false
Add Monstercat extractor
8,133
yt-dlp/yt-dlp
132,642
Python
coletdjnz
garret1317
from .common import InfoExtractor from ..utils import ( int_or_none, iri_to_uri, parse_age_limit, smuggle_url, traverse_obj, unsmuggle_url, ) class CineverseBaseIE(InfoExtractor): _VALID_URL_BASE = r'https://www\.(?P<host>(?:cineverse|asiancrush|dovechannel|screambox|midnightpulp|fandor).c...
missed an escape ```suggestion _VALID_URL_BASE = r'https://www\.(?P<host>(?:cineverse|asiancrush|dovechannel|screambox|midnightpulp|fandor)\.com|retrocrush\.tv)' ``` &nbsp; or this may be more readable / maintainable ```suggestion _VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, (...
import re from .common import InfoExtractor from ..utils import ( filter_dict, int_or_none, parse_age_limit, smuggle_url, traverse_obj, unsmuggle_url, url_or_none, ) class CineverseBaseIE(InfoExtractor): _VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, ( ...
@@ -0,0 +1,128 @@ +from .common import InfoExtractor +from ..utils import ( + int_or_none, + iri_to_uri, + parse_age_limit, + smuggle_url, + traverse_obj, + unsmuggle_url, +) + + +class CineverseBaseIE(InfoExtractor): + _VALID_URL_BASE = r'https://www\.(?P<host>(?:cineverse|asiancrush|dovechannel|s...
yt_dlp/extractor/cineverse.py
13
Python
0.786
security
519
38
38
false
add Cineverse IEs
8,146
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317