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
entry = data.find(xpath_with_ns('./atom:entry', NS_MAP)) title = xpath_text( entry, xpath_with_ns('./atom:title', NS_MAP), 'title') description = xpath_text( entry, xpath_with_ns('./atom:summary', NS_MAP), 'description') timestamp = parse_iso8601(xpath_text( ...
```suggestion 'format_id': f'rtmp-{tbr:.0f}', ```
entry = data.find(xpath_with_ns('./atom:entry', NS_MAP)) title = xpath_text( entry, xpath_with_ns('./atom:title', NS_MAP), 'title') description = xpath_text( entry, xpath_with_ns('./atom:summary', NS_MAP), 'description') timestamp = parse_iso8601(xpath_text( ...
@@ -74,7 +74,7 @@ def _extract_video_info(self, partner_id, video_id): 'app': mobj.group('app'), 'ext': 'flv', 'tbr': tbr, - 'format_id': 'rtmp-%d' % tbr, + 'format_id': f'rtmp-{tbr}',
yt_dlp/extractor/xstream.py
26
Python
0.571
suggestion
71
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
r'<span[^>]+class="minustrack-full-title(?:\s+[^"]+)?"[^>]*>([^<]+)', webpage, 'title') duration = parse_duration(self._html_search_regex( r'<span[^>]+class="player-duration(?:\s+[^"]+)?"[^>]*>([^<]+)', webpage, 'duration', fatal=False)) mobj = re.search( ...
```suggestion video_url = f'http://x-minus.me/dl/minus?id={video_id}&tkn2={a}f{h:.0f}' ```
r'<span[^>]+class="minustrack-full-title(?:\s+[^"]+)?"[^>]*>([^<]+)', webpage, 'title') duration = parse_duration(self._html_search_regex( r'<span[^>]+class="player-duration(?:\s+[^"]+)?"[^>]*>([^<]+)', webpage, 'duration', fatal=False)) mobj = re.search( ...
@@ -61,7 +61,7 @@ def _real_extract(self, url): 'encoded data') h = time.time() / 3600 a = sum(map(int, [compat_ord(c) for c in k])) + int(video_id) + h - video_url = 'http://x-minus.me/dl/minus?id=%s&tkn2=%df%d' % (video_id, a, h) + video_url = f'http://x-minus.me/dl/minus?...
yt_dlp/extractor/xminus.py
26
Python
0.714
suggestion
100
40
40
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
if ext in ('m3u8', 'f4m'): format_url = self._get_tokenized_src(format_url, media_id, format_id) if ext == 'f4m': formats.extend(self._extract_f4m_formats( format_url + ('?' if '?' not in format_url else '&') + 'hdcore=3.4.0', ...
```suggestion format_id += f'-{rate:.0f}k' ```
if ext in ('m3u8', 'f4m'): format_url = self._get_tokenized_src(format_url, media_id, format_id) if ext == 'f4m': formats.extend(self._extract_f4m_formats( format_url + ('?' if '?' not in format_url else '&') + 'hdcore=3.4.0', ...
@@ -204,7 +204,7 @@ def extract_bitrate(url): ext = media.get('ext') or determine_ext(media_url, 'mp4') format_id = ext if rate: - format_id += '-%dk' % rate + format_id += f'-{rate}k'
yt_dlp/extractor/rts.py
26
Python
0.571
suggestion
64
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'url': 'http://livestream.com/bsww/concacafbeachsoccercampeonato2015', 'only_matching': True, }] _API_URL_TEMPLATE = 'http://livestream.com/api/accounts/%s/events/%s' def _parse_smil_formats_and_subtitles( self, smil, smil_url, video_id, namespace=None, f4m_params=None, transfor...
```suggestion 'format_id': f'smil_{tbr:.0f}', ```
'url': 'http://livestream.com/bsww/concacafbeachsoccercampeonato2015', 'only_matching': True, }] _API_URL_TEMPLATE = 'http://livestream.com/api/accounts/%s/events/%s' def _parse_smil_formats_and_subtitles( self, smil, smil_url, video_id, namespace=None, f4m_params=None, transfor...
@@ -100,7 +100,7 @@ def _parse_smil_formats_and_subtitles( furl += '&ssek=' + vn.attrib['clipBegin'] formats.append({ 'url': furl, - 'format_id': 'smil_%d' % tbr, + 'format_id': f'smil_{tbr}',
yt_dlp/extractor/livestream.py
26
Python
0.571
suggestion
67
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
elif src_ext == 'f4m': f4m_url = src_url if not f4m_params: f4m_params = { 'hdcore': '3.2.0', 'plugin': 'flowplayer-3.2.0.1', } f4m_url += '&' if '?' in f4m_url else '?' ...
```suggestion 'format_id': f'http-{(bitrate or http_count):.0f}', ```
elif src_ext == 'f4m': f4m_url = src_url if not f4m_params: f4m_params = { 'hdcore': '3.2.0', 'plugin': 'flowplayer-3.2.0.1', } f4m_url += '&' if '?' in f4m_url else '?' ...
@@ -2524,7 +2524,7 @@ def _parse_smil_formats_and_subtitles( formats.append({ 'url': src_url, 'ext': ext or src_ext or 'flv', - 'format_id': 'http-%d' % (bitrate or http_count), + 'format_id': f'http-{bitrate or http_count}...
yt_dlp/extractor/common.py
26
Python
0.571
suggestion
91
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'ext': 'flv', 'format_id': f'rtmp-{rtmp_count if bitrate is None else bitrate}', 'tbr': bitrate, 'filesize': filesize, 'width': width, 'height': height, }) if transform...
```suggestion 'format_id': f'hls-{(m3u8_count if bitrate is None else bitrate):.0f}', ```
'ext': 'flv', 'format_id': 'rtmp-%d' % (rtmp_count if bitrate is None else bitrate), 'tbr': bitrate, 'filesize': filesize, 'width': width, 'height': height, }) if trans...
@@ -2493,7 +2493,7 @@ def _parse_smil_formats_and_subtitles( if len(m3u8_formats) == 1: m3u8_count += 1 m3u8_formats[0].update({ - 'format_id': 'hls-%d' % (m3u8_count if bitrate is None else bitrate), + 'format_id':...
yt_dlp/extractor/common.py
26
Python
0.714
suggestion
115
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
media = itertools.chain.from_iterable( smil.findall(self._xpath_ns(arg, namespace)) for arg in ['.//video', './/audio', './/media']) for medium in media: src = medium.get('src') if not src or src in srcs: continue srcs.add(src) ...
```suggestion 'format_id': f'rtmp-{(rtmp_count if bitrate is None else bitrate):.0f}', ```
media = itertools.chain.from_iterable( smil.findall(self._xpath_ns(arg, namespace)) for arg in ['.//video', './/audio', './/media']) for medium in media: src = medium.get('src') if not src or src in srcs: continue srcs.add(src) ...
@@ -2469,7 +2469,7 @@ def _parse_smil_formats_and_subtitles( 'url': streamer, 'play_path': src, 'ext': 'flv', - 'format_id': 'rtmp-%d' % (rtmp_count if bitrate is None else bitrate), + 'format_id': f'rtmp-{rtmp_count if...
yt_dlp/extractor/common.py
26
Python
0.714
suggestion
112
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
video = self._download_json( 'https://%s/v1/ansvideos/findByUuid' % (base_api_tmpl % org), uuid, query={'uuid': uuid})[0] title = video['headlines']['basic'] is_live = video.get('status') == 'live' urls = [] formats = [] for s in video.get('stream...
```suggestion f['format_id'] = 'rtmp-{:.0f}'.format(f['vbr']) ```
video = self._download_json( 'https://%s/v1/ansvideos/findByUuid' % (base_api_tmpl % org), uuid, query={'uuid': uuid})[0] title = video['headlines']['basic'] is_live = video.get('status') == 'live' urls = [] formats = [] for s in video.get('stream...
@@ -118,7 +118,7 @@ def _real_extract(self, url): if isinstance(f['tbr'], float): f['vbr'] = f['tbr'] * 1000 del f['tbr'] - f['format_id'] = 'rtmp-%d' % f['vbr'] + f['format_id'] = 'r...
yt_dlp/extractor/arcpublishing.py
26
Python
0.571
suggestion
95
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
subtitles_json = self._parse_json(dec_subtitles.decode(), None, fatal=False) if not subtitles_json: return None subtitles = {} for sub_lang, sub in subtitles_json.items(): ssa = '''[Script Info] ScriptType:V4.00 [V4 Styles] Format: Name,Fontname,Fontsize,PrimaryC...
IMO noqa this, new version is unreadable ```suggestion '{\\a%d}' % alignment if alignment != 2 else '', # noqa: UP031 ```
subtitles_json = self._parse_json(dec_subtitles.decode(), None, fatal=False) if not subtitles_json: return None subtitles = {} for sub_lang, sub in subtitles_json.items(): ssa = '''[Script Info] ScriptType:V4.00 [V4 Styles] Format: Name,Fontname,Fontsize,PrimaryC...
@@ -134,7 +134,7 @@ def _get_subtitles(self, sub_url, video_id): ssa += os.linesep + 'Dialogue: Marked=0,{},{},Default,,0,0,0,,{}{}'.format( ass_subtitles_timecode(start), ass_subtitles_timecode(end), - '{\\a%d}' % alignment if alignment != 2...
yt_dlp/extractor/adn.py
26
Python
0.714
suggestion
145
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'report_warning', 'to_console_title', 'to_stderr', 'trouble', 'write_debug', ): if not hasattr(self, func): setattr(self, func, getattr(ydl, func)) def to_screen(self, *args, **kargs): self.ydl.to_screen(*args, ...
```suggestion return '{:02.0f}:{:02.0f}:{:02.0f}'.format(*time[:-1]) ```
'report_warning', 'to_console_title', 'to_stderr', 'trouble', 'write_debug', ): if not hasattr(self, func): setattr(self, func, getattr(ydl, func)) def to_screen(self, *args, **kargs): self.ydl.to_screen(*args, ...
@@ -125,7 +125,7 @@ def format_seconds(seconds): time = timetuple_from_msec(seconds * 1000) if time.hours > 99: return '--:--:--' - return '%02d:%02d:%02d' % time[:-1] + return '{:02d}:{:02d}:{:02d}'.format(*map(int, time[:-1]))
yt_dlp/downloader/common.py
26
Python
0.571
suggestion
82
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
return '{}p'.format(format['height']) elif format.get('width'): return '{}x?'.format(format['width']) return default def _list_format_headers(self, *headers): if self.params.get('listformats_table', True) is not False: return [self._format_out(header, sel...
```suggestion res += '{:4.0f}k'.format(fdict['tbr']) ```
return '{}p'.format(format['height']) elif format.get('width'): return '%dx?' % format['width'] return default def _list_format_headers(self, *headers): if self.params.get('listformats_table', True) is not False: return [self._format_out(header, self.Styl...
@@ -3817,7 +3817,7 @@ def _format_note(self, fdict): if fdict.get('tbr') is not None: if res: res += ', ' - res += '%4dk' % fdict['tbr'] + res += '{:4d}k'.format(fdict['tbr'])
yt_dlp/YoutubeDL.py
26
Python
0.571
suggestion
70
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
if res: res += ' ' res += '[{}]'.format(fdict['language']) if fdict.get('format_note') is not None: if res: res += ' ' res += fdict['format_note'] if fdict.get('tbr') is not None: if res: res += '...
```suggestion res += '{:4.0f}k'.format(fdict['vbr']) ```
if res: res += ' ' res += '[{}]'.format(fdict['language']) if fdict.get('format_note') is not None: if res: res += ' ' res += fdict['format_note'] if fdict.get('tbr') is not None: if res: res += '...
@@ -3832,7 +3832,7 @@ def _format_note(self, fdict): elif fdict.get('vbr') is not None and fdict.get('abr') is not None: res += 'video@' if fdict.get('vbr') is not None: - res += '%4dk' % fdict['vbr'] + res += '{:4d}k'.format(fdict['vbr'])
yt_dlp/YoutubeDL.py
26
Python
0.571
suggestion
70
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
if res: res += ', ' res += fdict['vcodec'] if fdict.get('vbr') is not None: res += '@' elif fdict.get('vbr') is not None and fdict.get('abr') is not None: res += 'video@' if fdict.get('vbr') is not None: res += '...
```suggestion res += '@{:3.0f}k'.format(fdict['abr']) ```
if res: res += ', ' res += fdict['vcodec'] if fdict.get('vbr') is not None: res += '@' elif fdict.get('vbr') is not None and fdict.get('abr') is not None: res += 'video@' if fdict.get('vbr') is not None: res += '...
@@ -3843,15 +3843,15 @@ def _format_note(self, fdict): if fdict['acodec'] == 'none': res += 'video only' else: - res += '%-5s' % fdict['acodec'] + res += '{:<5}'.format(fdict['acodec']) elif fdict.get('abr') is not None: if r...
yt_dlp/YoutubeDL.py
26
Python
0.571
suggestion
71
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
res += fdict['vcodec'] if fdict.get('vbr') is not None: res += '@' elif fdict.get('vbr') is not None and fdict.get('abr') is not None: res += 'video@' if fdict.get('vbr') is not None: res += '{:4d}k'.format(fdict['vbr']) if fdict.ge...
```suggestion res += ' ({:5.0f}Hz)'.format(fdict['asr']) ```
res += fdict['vcodec'] if fdict.get('vbr') is not None: res += '@' elif fdict.get('vbr') is not None and fdict.get('abr') is not None: res += 'video@' if fdict.get('vbr') is not None: res += '%4dk' % fdict['vbr'] if fdict.get('fps')...
@@ -3843,15 +3843,15 @@ def _format_note(self, fdict): if fdict['acodec'] == 'none': res += 'video only' else: - res += '%-5s' % fdict['acodec'] + res += '{:<5}'.format(fdict['acodec']) elif fdict.get('abr') is not None: if r...
yt_dlp/YoutubeDL.py
26
Python
0.571
suggestion
74
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
yield self._extract_video(renderer) def _extract_lookup_view_model(self, renderer): content_id = renderer.get('contentId') if not content_id: return entry_url = None if renderer.get('contentType') in ('LOCKUP_CONTENT_TYPE_PLAYLIST', 'LOCKUP_CONTENT_TYPE_PODCA...
```suggestion if entry := self._extract_lookup_view_model(lookup_view_model): ```
def _extract_lockup_view_model(self, view_model): content_id = view_model.get('contentId') if not content_id: return content_type = view_model.get('contentType') if content_type not in ('LOCKUP_CONTENT_TYPE_PLAYLIST', 'LOCKUP_CONTENT_TYPE_PODCAST'): self.repo...
@@ -5084,10 +5089,35 @@ def _playlist_entries(self, video_list_renderer): continue yield self._extract_video(renderer) + def _extract_lookup_view_model(self, renderer): + content_id = renderer.get('contentId') + if not content_id: + return + entry_url =...
yt_dlp/extractor/youtube.py
26
Python
0.643
refactor
95
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
# Shelf may not contain shelf URL, fallback to extraction from content yield from self._shelf_entries_from_content(shelf_renderer) def _playlist_entries(self, video_list_renderer): for content in video_list_renderer['contents']: if not isinstance(content, dict): ...
```suggestion if renderer.get('contentType') not in ('LOCKUP_CONTENT_TYPE_PLAYLIST', 'LOCKUP_CONTENT_TYPE_PODCAST'): self.report_warning( f'Unsupported lookup view model content type "{renderer.get("contentType")}"{bug_reports_message()}', only_once=True) return ...
yield from self._shelf_entries_from_content(shelf_renderer) def _playlist_entries(self, video_list_renderer): for content in video_list_renderer['contents']: if not isinstance(content, dict): continue renderer = content.get('playlistVideoRenderer') or content...
@@ -5084,10 +5089,35 @@ def _playlist_entries(self, video_list_renderer): continue yield self._extract_video(renderer) + def _extract_lookup_view_model(self, renderer): + content_id = renderer.get('contentId') + if not content_id: + return + entry_url =...
yt_dlp/extractor/youtube.py
26
Python
0.929
bug
394
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
continue renderer = content.get('playlistVideoRenderer') or content.get('playlistPanelVideoRenderer') if not isinstance(renderer, dict): continue video_id = renderer.get('videoId') if not video_id: continue yield...
this formatting is kinda odd ```suggestion entry_url, ie=YoutubeTabIE, video_id=content_id, title=traverse_obj(renderer, ( 'metadata', 'lockupMetadataViewModel', 'title', 'content', {str})), ```
renderer = content.get('playlistVideoRenderer') or content.get('playlistPanelVideoRenderer') if not isinstance(renderer, dict): continue video_id = renderer.get('videoId') if not video_id: continue yield self._extract_video(rend...
@@ -5084,10 +5089,35 @@ def _playlist_entries(self, video_list_renderer): continue yield self._extract_video(renderer) + def _extract_lookup_view_model(self, renderer): + content_id = renderer.get('contentId') + if not content_id: + return + entry_url =...
yt_dlp/extractor/youtube.py
26
Python
0.786
suggestion
226
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
'channel_id': channel_id, 'channel_url': channel_url, 'title': title, 'uploader_id': channel_handle, 'uploader_url': format_field(channel_handle, None, 'https://www.youtube.com/%s', default=None), # See above. YouTube sets videoCountText to the sub...
```suggestion if entry := self._extract_lookup_view_model(lookup_view_model): ```
'channel_id': channel_id, 'channel_url': channel_url, 'title': title, 'uploader_id': channel_handle, 'uploader_url': format_field(channel_handle, None, 'https://www.youtube.com/%s', default=None), # See above. YouTube sets videoCountText to the sub...
@@ -4986,6 +4986,11 @@ def _grid_entries(self, grid_renderer): for item in grid_renderer['items']: if not isinstance(item, dict): continue + if lookup_view_model := item.get('lockupViewModel'): + entry = self._extract_lookup_view_model(lookup_view_model) ...
yt_dlp/extractor/youtube.py
26
Python
0.643
refactor
99
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
seproDev
seproDev
'channel': title, 'uploader': title, 'channel_id': channel_id, 'channel_url': channel_url, 'title': title, 'uploader_id': channel_handle, 'uploader_url': format_field(channel_handle, None, 'https://www.youtube.com/%s', default=None), ...
```suggestion if lockup_view_model := traverse_obj(item, ('lockupViewModel', {dict})): ```
'channel': title, 'uploader': title, 'channel_id': channel_id, 'channel_url': channel_url, 'title': title, 'uploader_id': channel_handle, 'uploader_url': format_field(channel_handle, None, 'https://www.youtube.com/%s', default=None), ...
@@ -4986,6 +4986,10 @@ def _grid_entries(self, grid_renderer): for item in grid_renderer['items']: if not isinstance(item, dict): continue + if lookup_view_model := traverse_obj(item, ('lockupViewModel', {dict})):
yt_dlp/extractor/youtube.py
26
Python
0.714
suggestion
104
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'uploader': title, 'channel_id': channel_id, 'channel_url': channel_url, 'title': title, 'uploader_id': channel_handle, 'uploader_url': format_field(channel_handle, None, 'https://www.youtube.com/%s', default=None), # See above. YouTube...
```suggestion if entry := self._extract_lockup_view_model(lookup_view_model): ```
'uploader': title, 'channel_id': channel_id, 'channel_url': channel_url, 'title': title, 'uploader_id': channel_handle, 'uploader_url': format_field(channel_handle, None, 'https://www.youtube.com/%s', default=None), # See above. YouTube...
@@ -4986,6 +4986,10 @@ def _grid_entries(self, grid_renderer): for item in grid_renderer['items']: if not isinstance(item, dict): continue + if lookup_view_model := traverse_obj(item, ('lockupViewModel', {dict})): + if entry := self._extract_lookup_view_m...
yt_dlp/extractor/youtube.py
26
Python
0.643
refactor
99
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
str) shelf_url = urljoin('https://www.youtube.com', ep) if shelf_url: # Skipping links to another channels, note that checking for # endpoint.commandMetadata.webCommandMetadata.webPageTypwebPageType == WEB_PAGE_TYPE_CHANNEL # will not work if s...
```suggestion def _extract_lockup_view_model(self, view_model): ```
str) shelf_url = urljoin('https://www.youtube.com', ep) if shelf_url: # Skipping links to another channels, note that checking for # endpoint.commandMetadata.webCommandMetadata.webPageTypwebPageType == WEB_PAGE_TYPE_CHANNEL # will not work if s...
@@ -5084,10 +5088,29 @@ def _playlist_entries(self, video_list_renderer): continue yield self._extract_video(renderer) + def _extract_lookup_view_model(self, view_model):
yt_dlp/extractor/youtube.py
26
Python
0.643
refactor
73
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
continue renderer = content.get('playlistVideoRenderer') or content.get('playlistPanelVideoRenderer') if not isinstance(renderer, dict): continue video_id = renderer.get('videoId') if not video_id: continue yield...
```suggestion if lockup_view_model := traverse_obj(rich_grid_renderer, ('content', 'lockupViewModel', {dict})): ```
continue renderer = content.get('playlistVideoRenderer') or content.get('playlistPanelVideoRenderer') if not isinstance(renderer, dict): continue video_id = renderer.get('videoId') if not video_id: continue yield...
@@ -5084,10 +5088,29 @@ def _playlist_entries(self, video_list_renderer): continue yield self._extract_video(renderer) + def _extract_lookup_view_model(self, view_model): + content_id = view_model.get('contentId') + if not content_id: + return + if view...
yt_dlp/extractor/youtube.py
26
Python
0.714
suggestion
125
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
renderer = content.get('playlistVideoRenderer') or content.get('playlistPanelVideoRenderer') if not isinstance(renderer, dict): continue video_id = renderer.get('videoId') if not video_id: continue yield self._extract_video(rend...
```suggestion if entry := self._extract_lockup_view_model(lookup_view_model): ```
renderer = content.get('playlistVideoRenderer') or content.get('playlistPanelVideoRenderer') if not isinstance(renderer, dict): continue video_id = renderer.get('videoId') if not video_id: continue yield self._extract_video(rend...
@@ -5084,10 +5088,29 @@ def _playlist_entries(self, video_list_renderer): continue yield self._extract_video(renderer) + def _extract_lookup_view_model(self, view_model): + content_id = view_model.get('contentId') + if not content_id: + return + if view...
yt_dlp/extractor/youtube.py
26
Python
0.643
refactor
95
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
if skip_channels and '/channels?' in shelf_url: return title = self._get_text(shelf_renderer, 'title') yield self.url_result(shelf_url, video_title=title) # Shelf may not contain shelf URL, fallback to extraction from content yield from self._shelf_ent...
```suggestion f'Unsupported lockup view model content type "{view_model.get("contentType")}"{bug_reports_message()}', only_once=True) ```
if skip_channels and '/channels?' in shelf_url: return title = self._get_text(shelf_renderer, 'title') yield self.url_result(shelf_url, video_title=title) # Shelf may not contain shelf URL, fallback to extraction from content yield from self._shelf_ent...
@@ -5084,10 +5088,29 @@ def _playlist_entries(self, video_list_renderer): continue yield self._extract_video(renderer) + def _extract_lookup_view_model(self, view_model): + content_id = view_model.get('contentId') + if not content_id: + return + if view...
yt_dlp/extractor/youtube.py
26
Python
0.857
bug
155
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
if skip_channels and '/channels?' in shelf_url: return title = self._get_text(shelf_renderer, 'title') yield self.url_result(shelf_url, video_title=title) # Shelf may not contain shelf URL, fallback to extraction from content yield from self._shelf_ent...
also i would use a var for contentType since we use it in the msg too
if skip_channels and '/channels?' in shelf_url: return title = self._get_text(shelf_renderer, 'title') yield self.url_result(shelf_url, video_title=title) # Shelf may not contain shelf URL, fallback to extraction from content yield from self._shelf_ent...
@@ -5084,10 +5088,29 @@ def _playlist_entries(self, video_list_renderer): continue yield self._extract_video(renderer) + def _extract_lookup_view_model(self, view_model): + content_id = view_model.get('contentId') + if not content_id: + return + if view...
yt_dlp/extractor/youtube.py
26
Python
0.429
suggestion
69
51
51
false
[ie/youtube:tab] Fix playlists tab extraction
11,615
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'offline': 'Room is currently offline', 'private': 'Room is currently in a private show', 'away': 'Performer is currently away', 'password protected': 'Room is password protected', 'hidden': 'Hidden session in progress', } def _extract_from_api(self, video_id, tld): ...
```suggestion self.report_warning(f'Got status "{status}" from API; falling back to webpage extraction') ```
'offline': 'Room is currently offline', 'private': 'Room is currently in a private show', 'away': 'Performer is currently away', 'password protected': 'Room is password protected', 'hidden': 'Hidden session in progress', } def _extract_from_api(self, video_id, tld): ...
@@ -59,17 +59,17 @@ def _extract_from_api(self, video_id, tld): 'Accept': 'application/json', }, fatal=False, impersonate=True) or {} + m3u8_url = response.get('url') status = response.get('room_status') - if status != 'public': + + if not m3u8_url: ...
yt_dlp/extractor/chaturbate.py
26
Python
0.786
refactor
122
51
51
false
[ie/chaturbate] Support non-public (#11623)
11,624
yt-dlp/yt-dlp
132,642
Python
bashonly
jkruse
'url': 'https://www.dropbox.com/sh/2mgpiuq7kv8nqdf/AABy-fW4dkydT4GmWi2mdOUDa?dl=0&preview=Drone+Shot.mp4', 'only_matching': True, }, { 'url': 'https://www.dropbox.com/scl/fi/r2kd2skcy5ylbbta5y1pz/DJI_0003.MP4?dl=0&rlkey=wcdgqangn7t3lnmmv6li9mu9h', 'only_matching':...
```suggestion content_id = self._search_regex(r'content_id=([\w.+=/-]+)', part, 'content ID') ```
'url': 'https://www.dropbox.com/sh/2mgpiuq7kv8nqdf/AABy-fW4dkydT4GmWi2mdOUDa?dl=0&preview=Drone+Shot.mp4', 'only_matching': True, }, { 'url': 'https://www.dropbox.com/scl/fi/r2kd2skcy5ylbbta5y1pz/DJI_0003.MP4?dl=0&rlkey=wcdgqangn7t3lnmmv6li9mu9h', 'only_matching':...
@@ -48,32 +48,30 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) fn = urllib.parse.unquote(url_basename(url)) title = os.path.splitext(fn)[0] - password = self.get_param('videopassword') + content_id = None for part in self._yield_deco...
yt_dlp/extractor/dropbox.py
26
Python
0.714
suggestion
115
51
51
false
[ie/dropbox] Fix password-protected video extraction
11,636
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
'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=wcdgqangn7t3lnmmv6li9mu9h', 'only_ma...
As soon as you are logged in, password protection no longer applies?
'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=wcdgqangn7t3lnmmv6li9mu9h', 'only_ma...
@@ -48,32 +48,30 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) fn = urllib.parse.unquote(url_basename(url)) title = os.path.splitext(fn)[0] - password = self.get_param('videopassword') + content_id = None for part in self._yield_deco...
yt_dlp/extractor/dropbox.py
26
Python
0.214
question
68
51
51
false
[ie/dropbox] Fix password-protected video extraction
11,636
yt-dlp/yt-dlp
132,642
Python
seproDev
bashonly
if formats: formats[:] = filter( lambda f: self._is_valid_url( f['url'], video_id, item='{} video format'.format(f.get('format_id')) if f.get('format_id') else 'video'), formats) @staticmethod def _remove_duplicate_form...
So if a format has `fragments` but it is a generator/lazy, then we evaluate uniqueness by `url` instead?
if formats: formats[:] = filter( lambda f: self._is_valid_url( f['url'], video_id, item='{} video format'.format(f.get('format_id')) if f.get('format_id') else 'video'), formats) @staticmethod def _remove_duplicate_form...
@@ -1854,12 +1854,24 @@ def _check_formats(self, formats, video_id): @staticmethod def _remove_duplicate_formats(formats): - format_urls = set() + seen_urls = set() + seen_fragments = set() unique_formats = [] for f in formats: - if f['url'] not in format_ur...
yt_dlp/extractor/common.py
26
Python
0.571
question
104
51
51
false
[ie] Handle fragmented formats in `_remove_duplicate_formats`
11,637
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
The constructor can take multiple dicts, in which keys in the latter are prioritised. """ def __init__(self, *args, **kwargs): super().__init__() for dct in args: if dct is not None: self.update(dct) self.update(kwargs) def __setitem__(self, key, val...
I think we should put this into the extractor file, since its only a temporary workaround until we make `HTTPHeaderDict` store sensitive keys and the handler extension will select pre-normalization of headers
) return _USER_AGENT_TPL % random.choice(_CHROME_VERSIONS) class HTTPHeaderDict(dict): """ Store and access keys case-insensitively. The constructor can take multiple dicts, in which keys in the latter are prioritised. Retains a case sensitive mapping of the headers, which can be accessed via...
@@ -79,6 +79,22 @@ def __contains__(self, key): return super().__contains__(key.title() if isinstance(key, str) else key) +class CaseSensitiveDict(HTTPHeaderDict):
yt_dlp/utils/networking.py
26
Python
0.786
security
208
51
51
false
[ie/RTP] Rework extractor
11,638
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
import base64 import json import re import urllib from .common import InfoExtractor, Request from ..utils import ( determine_ext, int_or_none, js_to_json, parse_duration, parse_iso8601, url_or_none, ) from ..utils.traversal import traverse_obj class RTPIE(InfoExtractor): _VALID_URL = r'ht...
```suggestion import urllib.parse ```
import base64 import json import re import urllib.parse from .common import InfoExtractor, Request from ..utils import ( determine_ext, int_or_none, js_to_json, parse_duration, parse_iso8601, url_or_none, ) from ..utils.traversal import traverse_obj class RTPIE(InfoExtractor): _VALID_URL ...
@@ -1,114 +1,196 @@ import base64 import json import re -import urllib.parse +import urllib
yt_dlp/extractor/rtp.py
4
Python
0.429
suggestion
39
29
29
false
[ie/RTP] Rework extractor
11,638
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'modified_date': '20240404', }, }, { # Episode not accessible through API 'url': 'https://www.rtp.pt/play/estudoemcasa/p7776/e500050/portugues-1-ano', 'md5': '57660c0b46db9f22118c52cbd65975e4', 'info_dict': { 'id': 'e500050', 'ext': 'mp4', ...
```suggestion 'https://rtpplayapi.rtp.pt/play/api/2/token-manager', ```
'modified_date': '20240404', }, }, { # Episode not accessible through API 'url': 'https://www.rtp.pt/play/estudoemcasa/p7776/e500050/portugues-1-ano', 'md5': '57660c0b46db9f22118c52cbd65975e4', 'info_dict': { 'id': 'e500050', 'ext': 'mp4', ...
@@ -1,114 +1,196 @@ import base64 import json import re -import urllib.parse +import urllib -from .common import InfoExtractor -from ..utils import js_to_json +from .common import InfoExtractor, Request +from ..utils import ( + determine_ext, + int_or_none, + js_to_json, + parse_duration, + parse_is...
yt_dlp/extractor/rtp.py
26
Python
0.571
suggestion
85
51
51
false
[ie/RTP] Rework extractor
11,638
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
self._logger.stdout( f'{self.RH_NAME}: resolved impersonate target {target} to {supported_target}') return supported_target @classproperty def supported_targets(cls) -> tuple[ImpersonateTarget, ...]: return tuple(cls._SUPPORTED_IMPERSONATE_TAR...
`_prepare_impersonate_headers`
self._logger.stdout( f'{self.RH_NAME}: resolved impersonate target {target} to {supported_target}') return supported_target @classproperty def supported_targets(cls) -> tuple[ImpersonateTarget, ...]: return tuple(cls._SUPPORTED_IMPERSONATE_TAR...
@@ -123,15 +123,29 @@ def _get_request_target(self, request): """Get the requested target for the request""" return self._resolve_target(request.extensions.get('impersonate') or self.impersonate) - def _get_impersonate_headers(self, request): + def _prepare_impersonate_headers(self, request: R...
yt_dlp/networking/impersonate.py
26
Python
0.214
suggestion
30
47
47
false
[networking] Add `keep_header_casing` extension
11,652
yt-dlp/yt-dlp
132,642
Python
coletdjnz
Grub4K
ImpersonateTarget('chrome', '99', 'windows', '10'): curl_cffi.requests.BrowserType.chrome99, ImpersonateTarget('edge', '101', 'windows', '10'): curl_cffi.requests.BrowserType.edge101, ImpersonateTarget('edge', '99', 'windows', '10'): curl_cffi.requests.BrowserType.edge99, **({ ...
```suggestion ``` curl cffi does not support keeping header casing sometimes (e..g http/2 from memory)
ImpersonateTarget('chrome', '99', 'windows', '10'): curl_cffi.requests.BrowserType.chrome99, ImpersonateTarget('edge', '101', 'windows', '10'): curl_cffi.requests.BrowserType.edge101, ImpersonateTarget('edge', '99', 'windows', '10'): curl_cffi.requests.BrowserType.edge99, **({ ...
@@ -149,6 +149,7 @@ def _check_extensions(self, extensions): # CurlCFFIRH ignores legacy ssl options currently. # Impersonation generally uses a looser SSL configuration than urllib/requests. extensions.pop('legacy_ssl', None) + extensions.pop('keep_header_casing', None)
yt_dlp/networking/_curlcffi.py
26
Python
0.857
suggestion
106
51
51
false
[networking] Add `keep_header_casing` extension
11,652
yt-dlp/yt-dlp
132,642
Python
coletdjnz
Grub4K
def _real_extract(self, url): video_id = self._match_id(url) headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers[...
```suggestion play_info = self._download_playinfo(traverse_obj(initial_state, ('videoData', 'bvid'), default=video_id), initial_state['cid'], headers=headers) ```
def _real_extract(self, url): video_id = self._match_id(url) headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['...
@@ -644,15 +644,18 @@ def _real_extract(self, url): video_data = initial_state['videoInfo'] else: play_info_obj = self._search_json( - r'window\.__playinfo__\s*=', webpage, 'play info', video_id, fatal=False) + r'window\.__playinfo__\s*=', webpage, 'play ...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
231
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
grqz
grqz
}] def _real_extract(self, url): video_id = self._match_id(url) headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) h...
is this error handling still valid even with the site changes?
def _real_extract(self, url): video_id = self._match_id(url) headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers[...
@@ -644,15 +644,19 @@ def _real_extract(self, url): video_data = initial_state['videoInfo'] else: play_info_obj = self._search_json( - r'window\.__playinfo__\s*=', webpage, 'play info', video_id, fatal=False) + r'window\.__playinfo__\s*=', webpage, 'play ...
yt_dlp/extractor/bilibili.py
26
Python
0.429
question
62
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['Referer'] = url initial_state = self._search_json(r'window\.__IN...
if the `playinfo` JSON object has been removed, let's just simplify the code and always make this API call instead
webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['Referer'] = url initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', vide...
@@ -644,15 +644,19 @@ def _real_extract(self, url): video_data = initial_state['videoInfo'] else: play_info_obj = self._search_json( - r'window\.__playinfo__\s*=', webpage, 'play info', video_id, fatal=False) + r'window\.__playinfo__\s*=', webpage, 'play ...
yt_dlp/extractor/bilibili.py
26
Python
0.571
refactor
114
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
# from getMixinKey() in the vendor js mixin_key_enc_tab = [ 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, ...
let's not change the order of the args just in case ```suggestion def _download_playinfo(self, bvid, cid, headers=None, qn=None, fatal=True): ```
# from getMixinKey() in the vendor js mixin_key_enc_tab = [ 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, ...
@@ -165,14 +164,18 @@ def _sign_wbi(self, params, video_id): params['w_rid'] = hashlib.md5(f'{query}{self._get_wbi_key(video_id)}'.encode()).hexdigest() return params - def _download_playinfo(self, bvid, cid, headers=None, qn=None): + def _download_playinfo(self, bvid, cid, headers=None, fatal...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
152
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
'ts': time.time(), }) return self._wbi_key_cache['key'] def _sign_wbi(self, params, video_id): params['wts'] = round(time.time()) params = { k: ''.join(filter(lambda char: char not in "!'()*", str(v))) for k, v in sorted(params.items()) } ...
`.get()` is fatal ```suggestion return traverse_obj(play_info, ('data', {dict})) or {} ```
'ts': time.time(), }) return self._wbi_key_cache['key'] def _sign_wbi(self, params, video_id): params['wts'] = round(time.time()) params = { k: ''.join(filter(lambda char: char not in "!'()*", str(v))) for k, v in sorted(params.items()) } ...
@@ -165,14 +164,18 @@ def _sign_wbi(self, params, video_id): params['w_rid'] = hashlib.md5(f'{query}{self._get_wbi_key(video_id)}'.encode()).hexdigest() return params - def _download_playinfo(self, bvid, cid, headers=None, qn=None): + def _download_playinfo(self, bvid, cid, headers=None, fatal...
yt_dlp/extractor/bilibili.py
26
Python
0.714
suggestion
101
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11, 36, 20, 34, 44, 52, ] self._wbi_key_cache.update({ 'key': ''.join(lookup[i] for i in mixin_key_enc_tab)[:...
keep var name simple imo ```suggestion play_info = self._download_json( ```
33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11, 36, 20, 34, 44, 52, ] self._wbi_key_cache.update({ 'key': ''.join(lookup[i] for i in mixin_key_enc_tab)[:...
@@ -165,14 +164,18 @@ def _sign_wbi(self, params, video_id): params['w_rid'] = hashlib.md5(f'{query}{self._get_wbi_key(video_id)}'.encode()).hexdigest() return params - def _download_playinfo(self, bvid, cid, headers=None, qn=None): + def _download_playinfo(self, bvid, cid, headers=None, fatal...
yt_dlp/extractor/bilibili.py
26
Python
0.571
suggestion
86
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
self._wbi_key_cache.update({ 'key': ''.join(lookup[i] for i in mixin_key_enc_tab)[:32], 'ts': time.time(), }) return self._wbi_key_cache['key'] def _sign_wbi(self, params, video_id): params['wts'] = round(time.time()) params = { k: ''.join...
```suggestion return play_info['data'] ```
self._wbi_key_cache.update({ 'key': ''.join(lookup[i] for i in mixin_key_enc_tab)[:32], 'ts': time.time(), }) return self._wbi_key_cache['key'] def _sign_wbi(self, params, video_id): params['wts'] = round(time.time()) params = { k: ''.join...
@@ -165,14 +164,18 @@ def _sign_wbi(self, params, video_id): params['w_rid'] = hashlib.md5(f'{query}{self._get_wbi_key(video_id)}'.encode()).hexdigest() return params - def _download_playinfo(self, bvid, cid, headers=None, qn=None): + def _download_playinfo(self, bvid, cid, headers=None, fatal...
yt_dlp/extractor/bilibili.py
26
Python
0.571
suggestion
56
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
'url': 'https://www.bilibili.com/festival/bh3-7th?bvid=BV1tr4y1f7p2&', 'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=he...
Now error handling is happening after `video_data` is extracted. Are you sure we won't KeyError on the `initial_state['videoData']` before we even get to the error handling?
def _real_extract(self, url): video_id = self._match_id(url) headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['...
@@ -643,27 +646,15 @@ def _real_extract(self, url): if is_festival: video_data = initial_state['videoInfo'] else: - play_info_obj = self._search_json( - r'window\.__playinfo__\s*=', webpage, 'play info', video_id, fatal=False) - if not play_info_obj: -...
yt_dlp/extractor/bilibili.py
26
Python
0.714
refactor
173
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
note='Extracting videos in anthology', headers=headers), 'data', expected_type=list) or [] is_anthology = len(page_list_json) > 1 part_id = int_or_none(parse_qs(url).get('p', [None])[-1]) if is_anthology and not part_id and self._yes_playlist(video_id, video_id): ...
this could be simplified if we leave `_download_playinfo` as always being fatal, no?
page_list_json = not is_festival and traverse_obj( self._download_json( 'https://api.bilibili.com/x/player/pagelist', video_id, fatal=False, query={'bvid': video_id, 'jsonp': 'jsonp'}, note='Extracting videos in anthology', headers=headers), ...
@@ -689,10 +680,29 @@ def _real_extract(self, url): old_video_id = format_field(aid, None, f'%s_part{part_id or 1}') cid = traverse_obj(video_data, ('pages', part_id - 1, 'cid')) if part_id else video_data.get('cid') + play_info = ( + traverse_obj( + self._search_jso...
yt_dlp/extractor/bilibili.py
26
Python
0.429
question
84
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
title += f' p{part_id:02d} {traverse_obj(page_list_json, (part_id - 1, "part")) or ""}' aid = video_data.get('aid') old_video_id = format_field(aid, None, f'%s_part{part_id or 1}') cid = traverse_obj(video_data, ('pages', part_id - 1, 'cid')) if part_id else video_data.get('cid') ...
Why is this down here? Shouldn't we check after we extract `video_data`?
getter=lambda entry: f'https://www.bilibili.com/video/{video_id}?p={entry["page"]}') if is_anthology: part_id = part_id or 1 title += f' p{part_id:02d} {traverse_obj(page_list_json, (part_id - 1, "part")) or ""}' aid = video_data.get('aid') old_video_id ...
@@ -689,10 +680,29 @@ def _real_extract(self, url): old_video_id = format_field(aid, None, f'%s_part{part_id or 1}') cid = traverse_obj(video_data, ('pages', part_id - 1, 'cid')) if part_id else video_data.get('cid') + play_info = ( + traverse_obj( + self._search_jso...
yt_dlp/extractor/bilibili.py
26
Python
0.429
refactor
72
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
def _real_extract(self, url): video_id = self._match_id(url) headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['...
should we just warn the user instead and extract the preview format?
video_id = self._match_id(url) headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['Referer'] = url initial_s...
@@ -639,31 +639,28 @@ def _real_extract(self, url): headers['Referer'] = url initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', video_id) + + if traverse_obj(initial_state, ('error', 'trueCode')) == -403: + self.raise_login_required() + ...
yt_dlp/extractor/bilibili.py
26
Python
0.286
refactor
68
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
grqz
grqz
if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['Referer'] = url initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', video_id) if traverse_obj(initial_state, ('error', 'trueCode')) == -403: ...
```suggestion raise ExtractorError( f'{join_nonempty("title", "sub_title", from_dict=high_level, delim=",")}. ' ```
if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['Referer'] = url initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', video_id) if traverse_obj(initial_state, ('error', 'trueCode')) == -403: ...
@@ -639,31 +638,28 @@ def _real_extract(self, url): headers['Referer'] = url initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', video_id) + + if traverse_obj(initial_state, ('error', 'trueCode')) == -403: + self.raise_login_required() + ...
yt_dlp/extractor/bilibili.py
26
Python
0.929
refactor
146
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
grqz
grqz
webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['Referer'] = url initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', vide...
```suggestion 'This is a supporter-only video: ' f'{join_nonempty("title", "sub_title", from_dict=high_level, delim=",")}. ' ```
webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['Referer'] = url initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', vide...
@@ -639,31 +638,26 @@ def _real_extract(self, url): headers['Referer'] = url initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', video_id) + + if traverse_obj(initial_state, ('error', 'trueCode')) == -403: + self.raise_login_required() + ...
yt_dlp/extractor/bilibili.py
26
Python
0.714
suggestion
163
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
grqz
grqz
page_list_json = not is_festival and traverse_obj( self._download_json( 'https://api.bilibili.com/x/player/pagelist', video_id, fatal=False, query={'bvid': video_id, 'jsonp': 'jsonp'}, note='Extracting videos in anthology', headers=headers), ...
line will be a little longer but it's more readable imo ```suggestion self._search_json(r'window\.__playinfo__\s*=', webpage, 'play info', video_id, default=None), ```
# Bilibili anthologies are similar to playlists but all videos share the same video ID as the anthology itself. page_list_json = not is_festival and traverse_obj( self._download_json( 'https://api.bilibili.com/x/player/pagelist', video_id, fatal=False, query={...
@@ -689,10 +683,15 @@ def _real_extract(self, url): old_video_id = format_field(aid, None, f'%s_part{part_id or 1}') cid = traverse_obj(video_data, ('pages', part_id - 1, 'cid')) if part_id else video_data.get('cid') + play_info = ( + traverse_obj( + self._search_jso...
yt_dlp/extractor/bilibili.py
26
Python
0.714
suggestion
185
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
def _real_extract(self, url): video_id = self._match_id(url) headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['...
This *needs* to be a dict; if we pass it as the `from_dict` argument and it's `None`, then we are joining literal strings of `title` and `sub_title` ```suggestion high_level = traverse_obj(initial_state, ('elecFullInfo', 'show_info', 'high_level', {dict})) or {} ```
def _real_extract(self, url): video_id = self._match_id(url) headers = self.geo_verification_headers() webpage, urlh = self._download_webpage_handle(url, video_id, headers=headers) if not self._match_valid_url(urlh.url): return self.url_result(urlh.url) headers['...
@@ -639,31 +638,27 @@ def _real_extract(self, url): headers['Referer'] = url initial_state = self._search_json(r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', video_id) + + if traverse_obj(initial_state, ('error', 'trueCode')) == -403: + self.raise_login_required() + ...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
282
51
51
false
[ie/bilibili] Provide fallback for playinfo extraction
11,667
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
'uploader_id': ('upData', 'mid', {str_or_none}), 'like_count': ('videoData', 'stat', 'like', {int_or_none}), 'tags': ('tags', ..., 'tag_name'), 'thumbnail': ('videoData', 'pic', {url_or_none}), }), **festival_info, **tra...
per https://github.com/yt-dlp/yt-dlp/pull/11734#issuecomment-2518613153, should we do this? ```suggestion play_info = None if self.is_logged_in: play_info = traverse_obj( self._search_json(r'window\.__playinfo__\s*=', webpage, 'play info', video_id, default=None), ...
'uploader_id': ('upData', 'mid', {str_or_none}), 'like_count': ('videoData', 'stat', 'like', {int_or_none}), 'tags': ('tags', ..., 'tag_name'), 'thumbnail': ('videoData', 'pic', {url_or_none}), }), **festival_info, **tra...
@@ -724,6 +718,7 @@ def _real_extract(self, url): duration=traverse_obj(initial_state, ('videoData', 'duration', {int_or_none})), __post_extractor=self.extract_comments(aid)) + play_info = self._download_playinfo(video_id, cid, headers=headers, query={'try_look': 1})
yt_dlp/extractor/bilibili.py
26
Python
0.857
suggestion
484
51
51
false
[ie/bilibili] extract from `window.__playinfo__` only if the user isn't logged in
11,734
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
import itertools import re from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, determine_ext, dict_get, extract_attributes, float_or_none, int_or_none, parse_duration, str_or_none, try_get, unified_strdate, url_or_none, urljoin, ) cl...
```suggestion _DOMAINS = r'(?:xhamster\.(?:com|one|desi)|xhms\.pro|xhamster\d+\.(?:com|desi)|xhday\.com|xhvid\.com)' ``` [**Don't capture groups you don't use**](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#dont-capture-groups-you-dont-use)
import itertools import re from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, determine_ext, dict_get, extract_attributes, float_or_none, int_or_none, parse_duration, str_or_none, try_get, unified_strdate, url_or_none, urljoin, ) cl...
@@ -20,7 +20,7 @@ class XHamsterIE(InfoExtractor): - _DOMAINS = r'(?:xhamster\.(?:com|one|desi)|xhms\.pro|xhamster\d+\.com|xhday\.com|xhvid\.com)' + _DOMAINS = r'(?:xhamster\.(?:com|one|desi)|xhms\.pro|xhamster\d+\.(com|desi)|xhday\.com|xhvid\.com)'
yt_dlp/extractor/xhamster.py
23
Python
0.857
suggestion
267
48
48
false
[ie/xhamster] wrong key used in extractor
11,738
yt-dlp/yt-dlp
132,642
Python
grqz
knackku
from .common import InfoExtractor from ..utils import ExtractorError, float_or_none, url_or_none from ..utils.traversal import traverse_obj class NestIE(InfoExtractor): _VALID_URL = r'https?://video\.nest\.com/(?:embedded/)?live/(?P<id>\w+)' _EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"](?P<url>{_VALID_URL})'] ...
```suggestion _EMBED_REGEX = [rf'<iframe [^>]*\bsrc=[\'"](?P<url>{_VALID_URL})'] ```
from .common import InfoExtractor from ..utils import ExtractorError, float_or_none, update_url_query, url_or_none from ..utils.traversal import traverse_obj class NestIE(InfoExtractor): _VALID_URL = r'https?://video\.nest\.com/(?:embedded/)?live/(?P<id>\w+)' _EMBED_REGEX = [rf'<iframe [^>]*\bsrc=[\'"](?P<url...
@@ -0,0 +1,114 @@ +from .common import InfoExtractor +from ..utils import ExtractorError, float_or_none, url_or_none +from ..utils.traversal import traverse_obj + + +class NestIE(InfoExtractor): + _VALID_URL = r'https?://video\.nest\.com/(?:embedded/)?live/(?P<id>\w+)' + _EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"]...
yt_dlp/extractor/nest.py
8
Python
0.571
suggestion
90
33
33
false
[ie/nest] Add extractors
11,747
yt-dlp/yt-dlp
132,642
Python
bashonly
pabs3
'url': 'https://video.nest.com/live/4fvYdSo8AX', 'only_matching': True, }] _WEBPAGE_TESTS = [{ 'url': 'https://www.pacificblue.biz/noyo-harbor-webcam/', 'info_dict': { 'id': '4fvYdSo8AX', 'ext': 'mp4', 'title': 'startswith:Outside ', ...
```suggestion 'https://video.nest.com/api/dropcam/cameras.get_by_public_token', video_id, query={'token': video_id}) ```
'url': 'https://video.nest.com/live/4fvYdSo8AX', 'only_matching': True, }] _WEBPAGE_TESTS = [{ 'url': 'https://www.pacificblue.biz/noyo-harbor-webcam/', 'info_dict': { 'id': '4fvYdSo8AX', 'ext': 'mp4', 'title': 'startswith:Outside ', ...
@@ -0,0 +1,114 @@ +from .common import InfoExtractor +from ..utils import ExtractorError, float_or_none, url_or_none +from ..utils.traversal import traverse_obj + + +class NestIE(InfoExtractor): + _VALID_URL = r'https?://video\.nest\.com/(?:embedded/)?live/(?P<id>\w+)' + _EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"]...
yt_dlp/extractor/nest.py
26
Python
0.714
suggestion
147
51
51
false
[ie/nest] Add extractors
11,747
yt-dlp/yt-dlp
132,642
Python
bashonly
pabs3
'only_matching': True, }] _WEBPAGE_TESTS = [{ 'url': 'https://www.pacificblue.biz/noyo-harbor-webcam/', 'info_dict': { 'id': '4fvYdSo8AX', 'ext': 'mp4', 'title': 'startswith:Outside ', 'alt_title': 'Outside', 'description': '<nu...
it's fatal in the very next line if `data['items'][0]` isn't a dict, and we don't use any other part of `data`, so we might as well do this above: ```py item = self._download_json( 'https://video.nest.com/api/dropcam/cameras.get_by_public_token', video_id, query={'token': video_id})...
'only_matching': True, }] _WEBPAGE_TESTS = [{ 'url': 'https://www.pacificblue.biz/noyo-harbor-webcam/', 'info_dict': { 'id': '4fvYdSo8AX', 'ext': 'mp4', 'title': 'startswith:Outside ', 'alt_title': 'Outside', 'description': '<nu...
@@ -0,0 +1,114 @@ +from .common import InfoExtractor +from ..utils import ExtractorError, float_or_none, url_or_none +from ..utils.traversal import traverse_obj + + +class NestIE(InfoExtractor): + _VALID_URL = r'https?://video\.nest\.com/(?:embedded/)?live/(?P<id>\w+)' + _EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"]...
yt_dlp/extractor/nest.py
26
Python
0.857
suggestion
359
51
51
false
[ie/nest] Add extractors
11,747
yt-dlp/yt-dlp
132,642
Python
bashonly
pabs3
# m3u8 download 'skip_download': True, }, }] def _real_extract(self, url): video_id = self._match_id(url) data = self._download_json( f'https://video.nest.com/api/dropcam/cameras.get_by_public_token?token={video_id}', video_id) item = traverse...
could use `self._availability()` here if desired
# m3u8 download 'skip_download': True, }, }] def _real_extract(self, url): video_id = self._match_id(url) item = self._download_json( 'https://video.nest.com/api/dropcam/cameras.get_by_public_token', video_id, query={'token': video_id})['i...
@@ -0,0 +1,114 @@ +from .common import InfoExtractor +from ..utils import ExtractorError, float_or_none, url_or_none +from ..utils.traversal import traverse_obj + + +class NestIE(InfoExtractor): + _VALID_URL = r'https?://video\.nest\.com/(?:embedded/)?live/(?P<id>\w+)' + _EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"]...
yt_dlp/extractor/nest.py
26
Python
0.286
suggestion
48
51
51
false
[ie/nest] Add extractors
11,747
yt-dlp/yt-dlp
132,642
Python
bashonly
pabs3
item = traverse_obj(data, ('items', 0, {dict})) uuid = item.get('uuid') stream_domain = item.get('live_stream_host') if not stream_domain or not uuid: raise ExtractorError('Unable to construct playlist URL') thumb_domain = item.get('nexus_api_nest_domain_host') ...
```suggestion _EMBED_REGEX = [rf'<iframe [^>]*\bsrc=[\'"](?P<url>{_VALID_URL})'] ```
video_id, query={'token': video_id})['items'][0] uuid = item.get('uuid') stream_domain = item.get('live_stream_host') if not stream_domain or not uuid: raise ExtractorError('Unable to construct playlist URL') thumb_domain = item.get('nexus_api_nest_domain_host') ...
@@ -0,0 +1,114 @@ +from .common import InfoExtractor +from ..utils import ExtractorError, float_or_none, url_or_none +from ..utils.traversal import traverse_obj + + +class NestIE(InfoExtractor): + _VALID_URL = r'https?://video\.nest\.com/(?:embedded/)?live/(?P<id>\w+)' + _EMBED_REGEX = [rf'<iframe[^>]+\bsrc=[\'"]...
yt_dlp/extractor/nest.py
26
Python
0.571
suggestion
90
51
51
false
[ie/nest] Add extractors
11,747
yt-dlp/yt-dlp
132,642
Python
bashonly
pabs3
}, { 'url': 'https://cooking.nytimes.com/guides/20-how-to-frost-a-cake', 'md5': '64415805fe0b8640fce6b0b9def5989a', 'info_dict': { 'id': '20-how-to-frost-a-cake', 'title': 'How to Frost a Cake', 'description': 'md5:a31fe3b98a8ce7b98aae097730c269cd', ...
```suggestion map(self._extract_video, media_ids), page_id, title, description) ```
}, { 'url': 'https://cooking.nytimes.com/guides/20-how-to-frost-a-cake', 'md5': '64415805fe0b8640fce6b0b9def5989a', 'info_dict': { 'id': '20-how-to-frost-a-cake', 'title': 'How to Frost a Cake', 'description': 'md5:a31fe3b98a8ce7b98aae097730c269cd', ...
@@ -343,7 +343,7 @@ def _real_extract(self, url): if media_ids: media_ids.append(lead_video_id) return self.playlist_result( - [self._extract_video(media_id) for media_id in media_ids], page_id, title, description) + (self._extract_video(media_id) for med...
yt_dlp/extractor/nytimes.py
26
Python
0.786
refactor
101
51
51
false
[cleanup] Make more playlist extractions lazy
11,763
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
if json_data.get('error_subcode') == 'CLIENT_GEO': self.raise_geo_restricted(msg=message) elif json_data.get('error_code') == 'INVALID_POLICY_KEY' and not policy_key_extracted: policy_key = None store_pk(None...
```suggestion (self._parse_brightcove_metadata(vid, vid['id'], headers) ```
if json_data.get('error_subcode') == 'CLIENT_GEO': self.raise_geo_restricted(msg=message) elif json_data.get('error_code') == 'INVALID_POLICY_KEY' and not policy_key_extracted: policy_key = None store_pk(None...
@@ -935,8 +936,8 @@ def extract_policy_key(): if content_type == 'playlist': return self.playlist_result( - [self._parse_brightcove_metadata(vid, vid.get('id'), headers) - for vid in json_data.get('videos', []) if vid.get('id')], + (self._parse_brigh...
yt_dlp/extractor/brightcove.py
26
Python
0.571
suggestion
93
33
33
false
[cleanup] Make more playlist extractions lazy
11,763
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
self.report_warning('This is a premium-only stream') availability = 'premium_only' m3u8_url = f'https://vod-abematv.akamaized.net/slot/{video_id}/playlist.m3u8' else: raise ExtractorError('Unreachable') if is_live: self.report_warning...
```suggestion _VALID_URL = r'https?://abema\.tv/video/title/(?P<id>[^?/]+)(?:\?(?:[^#]+&)?s=(?P<season>[^&#]+))?' ```
self.report_warning('This is a premium-only stream') availability = 'premium_only' m3u8_url = f'https://vod-abematv.akamaized.net/slot/{video_id}/playlist.m3u8' else: raise ExtractorError('Unreachable') if is_live: self.report_warning...
@@ -421,7 +421,7 @@ def _real_extract(self, url): class AbemaTVTitleIE(AbemaTVBaseIE): - _VALID_URL = r'https?://abema\.tv/video/title/(?P<id>[^?/]+)' + _VALID_URL = r'https?://abema\.tv/video/title/(?P<id>[^?/]+)(?:\?(?:.*?&)?s=(?P<season>[^&]+))?'
yt_dlp/extractor/abematv.py
26
Python
0.714
suggestion
123
51
51
false
[ie/abematv] support season
11,771
yt-dlp/yt-dlp
132,642
Python
pukkandan
middlingphys
'title': '真心が届く~僕とスターのオフィス・ラブ!?~', }, 'playlist_mincount': 16, }, { 'url': 'https://abema.tv/video/title/25-102', 'info_dict': { 'id': '25-102', 'title': 'ソードアート・オンライン アリシゼーション', }, 'playlist_mincount': 24, }] def _fetch_pa...
```suggestion query=query) ```
'id': '193-132', 'title': '真心が届く~僕とスターのオフィス・ラブ!?~', 'description': 'md5:9b59493d1f3a792bafbc7319258e7af8', }, 'playlist_mincount': 16, }, { 'url': 'https://abema.tv/video/title/25-1nzan-whrxe', 'info_dict': { 'id': '25-1nzan-whrxe', ...
@@ -447,30 +447,35 @@ class AbemaTVTitleIE(AbemaTVBaseIE): 'playlist_mincount': 24, }] - def _fetch_page(self, playlist_id, series_version, page): + def _fetch_page(self, playlist_id, series_version, season_id, page): + query = { + 'seriesVersion': series_version, + 'o...
yt_dlp/extractor/abematv.py
26
Python
0.429
suggestion
44
45
51
false
[ie/abematv] support season
11,771
yt-dlp/yt-dlp
132,642
Python
pukkandan
middlingphys
def _fetch_page(self, playlist_id, series_version, season_id, page): query = { 'seriesVersion': series_version, 'offset': str(page * self._PAGE_SIZE), 'order': 'seq', 'limit': str(self._PAGE_SIZE), } if season_id: query['seasonId'] ...
```suggestion playlist_id, season_id = self._match_valid_url(url).group('id', 'season') ```
'playlist_mincount': 25, }, { 'url': 'https://abema.tv/video/title/26-2mzbynr-cph?s=26-2mzbynr-cph_s40', 'info_dict': { 'title': '〈物語〉シリーズ', 'id': '26-2mzbynr-cph', 'description': 'md5:e67873de1c88f360af1f0a4b84847a52', }, 'playlist_count':...
@@ -447,30 +447,35 @@ class AbemaTVTitleIE(AbemaTVBaseIE): 'playlist_mincount': 24, }] - def _fetch_page(self, playlist_id, series_version, page): + def _fetch_page(self, playlist_id, series_version, season_id, page): + query = { + 'seriesVersion': series_version, + 'o...
yt_dlp/extractor/abematv.py
26
Python
0.714
suggestion
101
33
42
false
[ie/abematv] support season
11,771
yt-dlp/yt-dlp
132,642
Python
pukkandan
middlingphys
}, 'playlist_mincount': 2, }, { 'url': 'https://abema.tv/video/title/193-132', 'info_dict': { 'id': '193-132', 'title': '真心が届く~僕とスターのオフィス・ラブ!?~', 'description': 'md5:9b59493d1f3a792bafbc7319258e7af8', }, 'playlist_mincount': 16, ...
With mincount, we can't know whether only the season has been downloaded. ```suggestion 'playlist_count': 31, ```
}, 'playlist_mincount': 2, }, { 'url': 'https://abema.tv/video/title/193-132', 'info_dict': { 'id': '193-132', 'title': '真心が届く~僕とスターのオフィス・ラブ!?~', 'description': 'md5:9b59493d1f3a792bafbc7319258e7af8', }, 'playlist_mincount': 16, ...
@@ -421,56 +421,70 @@ def _real_extract(self, url): class AbemaTVTitleIE(AbemaTVBaseIE): - _VALID_URL = r'https?://abema\.tv/video/title/(?P<id>[^?/]+)' + _VALID_URL = r'https?://abema\.tv/video/title/(?P<id>[^?/]+)(?:\?(?:[^#]+&)?s=(?P<season>[^&#]+))?' _PAGE_SIZE = 25 _TESTS = [{ - 'url'...
yt_dlp/extractor/abematv.py
26
Python
0.714
suggestion
124
51
51
false
[ie/abematv] support season
11,771
yt-dlp/yt-dlp
132,642
Python
pukkandan
middlingphys
self.report_warning('This is a premium-only stream') availability = 'premium_only' m3u8_url = f'https://vod-abematv.akamaized.net/slot/{video_id}/playlist.m3u8' else: raise ExtractorError('Unreachable') if is_live: self.report_warning...
```suggestion _VALID_URL = r'https?://abema\.tv/video/title/(?P<id>[^?/#]+)/?(?:\?(?:[^#]+&)?s=(?P<season>[^&#]+))?' ```
self.report_warning('This is a premium-only stream') availability = 'premium_only' m3u8_url = f'https://vod-abematv.akamaized.net/slot/{video_id}/playlist.m3u8' else: raise ExtractorError('Unreachable') if is_live: self.report_warning...
@@ -421,56 +421,70 @@ def _real_extract(self, url): class AbemaTVTitleIE(AbemaTVBaseIE): - _VALID_URL = r'https?://abema\.tv/video/title/(?P<id>[^?/]+)' + _VALID_URL = r'https?://abema\.tv/video/title/(?P<id>[^?/]+)(?:\?(?:[^#]+&)?s=(?P<season>[^&#]+))?'
yt_dlp/extractor/abematv.py
26
Python
0.714
suggestion
126
51
51
false
[ie/abematv] support season
11,771
yt-dlp/yt-dlp
132,642
Python
bashonly
middlingphys
'uploader': 'Bom Dia Brasil', 'uploader_id': '810', }, 'params': { 'skip_download': True, }, }, { 'url': 'globo:3607726', 'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) video...
If we are removing all these tests, does that mean these URL formats are no longer valid? If so, then we should tighten up the `_VALID_URL` regex too
''' _TESTS = [{ 'url': 'https://globoplay.globo.com/v/3607726/', 'info_dict': { 'id': '3607726', 'ext': 'mp4', 'title': 'Mercedes-Benz GLA passa por teste de colisão na Europa', 'duration': 103.204, 'uploader': 'G1 ao vivo', ...
@@ -38,126 +33,70 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom D...
yt_dlp/extractor/globo.py
26
Python
0.571
style
149
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
originProgramId headline } } } ''' video = self._download_json( f'https://cloud-jarvis.globo.com/graphql?operationName=getVideoView&variables=%7B"videoId":"{video_id}"%7D&query={video_view}', video_id, he...
we're not doing that unplayable param anymore ```suggestion if traverse_obj(video, ('resource', 'drm_protection_enabled', {bool})): ```
'uploader': 'Bom Dia Brasil', 'uploader_id': '810', }, 'params': { 'skip_download': True, }, }, { 'url': 'globo:3607726', 'only_matching': True, }, { 'url': 'globo:8013907', # needs subscription to globoplay 'in...
@@ -38,126 +33,70 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom D...
yt_dlp/extractor/globo.py
26
Python
0.714
suggestion
146
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
def _real_extract(self, url): video_id = self._match_id(url) video_view = ''' query getVideoView($videoId: ID!) { video(id: $videoId) { duration description headline title { originProgramId ...
I don't like continuing to name this variable `security` when we've removed all the security hash code. I changed it in my patch for a reason
}, 'params': { 'skip_download': True, }, }, { 'url': 'http://globoplay.globo.com/v/4581987/', 'info_dict': { 'id': '4581987', 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP'...
@@ -38,126 +33,70 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom D...
yt_dlp/extractor/globo.py
26
Python
0.714
security
141
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'https://playback.video.globo.com/v4/video-session', video_id, f'Downloading resource info for {video_id}', headers={'Content-Type': 'application/json'}, data=json.dumps({ 'player_type': 'desktop', 'video_id': video_id, 'quality': 'max', ...
IMO we should use `traverse_obj` and `subs_list_to_dict` here
'title': 'Capítulo de 14⧸08⧸1989', 'episode_number': 1, }, 'params': { 'skip_download': True, }, }, { 'url': 'globo:12824146', 'info_dict': { 'id': '12824146', 'ext': 'mp4', 'title': 'Acordo de da...
@@ -38,126 +33,70 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom D...
yt_dlp/extractor/globo.py
26
Python
0.429
suggestion
61
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'skip_download': True, }, }, { 'url': 'globo:3607726', 'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) video_view = ''' query getVideoView($videoId: ID!) { video(id: $videoId) { d...
lines too long. use `query` kwarg instead of putting it all into the url string
'id': '3607726', 'ext': 'mp4', 'title': 'Mercedes-Benz GLA passa por teste de colisão na Europa', 'duration': 103.204, 'uploader': 'G1 ao vivo', 'uploader_id': '4209', }, 'params': { 'skip_download': True, }, ...
@@ -38,126 +33,70 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom D...
yt_dlp/extractor/globo.py
26
Python
0.429
refactor
79
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, 'uploader': 'Bom Dia Brasil', 'uploader_id': '810', }, 'params': { 'skip_download': True, }, },...
```suggestion query={ 'operationName': 'getVideoView', 'variables': f'{{"videoId":{video_id}}}', 'query': self._VIDEO_VIEW, }, headers={ 'content-type': 'application/json', 'x-platform-id': 'web', ...
}, 'params': { 'skip_download': True, }, }, { 'url': 'http://globoplay.globo.com/v/4581987/', 'info_dict': { 'id': '4581987', 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP'...
@@ -38,135 +46,65 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom D...
yt_dlp/extractor/globo.py
26
Python
0.929
suggestion
438
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'x-device-id': 'desktop', 'x-client-version': '2024.12-5'})['data']['video'] formats = [] video = self._download_json( 'https://playback.video.globo.com/v4/video-session', video_id, f'Downloading resource info for {video_id}', ...
```suggestion main_source['url'], video_id, 'mp4', m3u8_id='hls') ```
'id': '8013907', 'ext': 'mp4', 'title': 'Capítulo de 14⧸08⧸1989', 'episode_number': 1, }, 'params': { 'skip_download': True, }, }, { 'url': 'globo:12824146', 'info_dict': { 'id': '12824146', ...
@@ -38,135 +46,65 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom D...
yt_dlp/extractor/globo.py
26
Python
0.571
suggestion
83
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'x-platform-id': 'web', 'x-device-id': 'desktop', 'x-client-version': '2024.12-5'})['data']['video'] formats = [] video = self._download_json( 'https://playback.video.globo.com/v4/video-session', video_id, f'Download...
```suggestion formats, subtitles = self._extract_m3u8_formats_and_subtitles( ```
'info_dict': { 'id': '8013907', 'ext': 'mp4', 'title': 'Capítulo de 14⧸08⧸1989', 'episode_number': 1, }, 'params': { 'skip_download': True, }, }, { 'url': 'globo:12824146', 'info_dict': { ...
@@ -38,135 +46,65 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom D...
yt_dlp/extractor/globo.py
26
Python
0.643
refactor
90
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'player_type': 'desktop', 'video_id': video_id, 'quality': 'max', 'content_protection': 'widevine', 'vsid': '2938bc7c-9376-d4b7-ee91-ce46dbbf9f4d', 'tz': '-03:00', 'version': 1, }).encode()) ...
```suggestion 'uploader': ('title', 'headline', {str}), 'uploader_id': ('title', 'originProgramId', {str_or_none}), ```
{ 'url': 'globo:12824146', 'info_dict': { 'id': '12824146', 'ext': 'mp4', 'title': 'Acordo de damas', 'episode_number': 1, 'season_number': 2, }, 'params': { 'skip_download': True, }, }] def ...
@@ -38,135 +46,65 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom D...
yt_dlp/extractor/globo.py
26
Python
0.714
suggestion
154
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'content_protection': 'widevine', 'vsid': '2938bc7c-9376-d4b7-ee91-ce46dbbf9f4d', 'tz': '-03:00', 'version': 1, }).encode()) if traverse_obj(video, ('resource', 'drm_protection_enabled', {bool})): self.report_drm(video_id) ...
use dict key traversal, see `rutube.py` for an example
'id': '12824146', 'ext': 'mp4', 'title': 'Acordo de damas', 'episode_number': 1, 'season_number': 2, }, 'params': { 'skip_download': True, }, }] def _real_extract(self, url): video_id = self._match_id(url) ...
@@ -38,135 +46,65 @@ class GloboIE(InfoExtractor): 'ext': 'mp4', 'title': 'Acidentes de trânsito estão entre as maiores causas de queda de energia em SP', 'duration': 137.973, - 'uploader': 'Rede Globo', - 'uploader_id': '196', + 'uploader': 'Bom D...
yt_dlp/extractor/globo.py
26
Python
0.429
suggestion
54
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
formats, subtitles = self._extract_mpd_formats_and_subtitles( main_source['url'], video_id, 'mp4', fatal=False) else: formats, subtitles = self._extract_m3u8_formats_and_subtitles( main_source['url'], video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=Fa...
```suggestion _VALID_URL = r'https?://(?!globoplay).+?\.globo\.com/(?:[^/?#]+/)*(?P<id>[^/?#.]+)(?:\.html)?' ```
# 4k streams are exclusively outputted in dash, so we need to filter these out if determine_ext(main_source['url']) == 'mpd': formats, subtitles = self._extract_mpd_formats_and_subtitles(main_source['url'], video_id, mpd_id='dash') else: formats, subtitles = self._extrac...
@@ -80,98 +90,71 @@ class GloboIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - self._request_webpage( - HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'), - vide...
yt_dlp/extractor/globo.py
26
Python
0.714
suggestion
118
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
formats = [] video = self._download_json( 'https://playback.video.globo.com/v4/video-session', video_id, f'Downloading resource info for {video_id}', headers={'Content-Type': 'application/json'}, data=json.dumps({ 'player_type': 'mirakulo_8...
```suggestion if determine_ext(main_source['url']) == 'mpd': ```
'x-client-version': '2024.12-5', })['data']['video'] formats = [] video = self._download_json( 'https://playback.video.globo.com/v4/video-session', video_id, f'Downloading resource info for {video_id}', headers={'Content-Type': 'applicatio...
@@ -80,98 +90,71 @@ class GloboIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - self._request_webpage( - HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'), - vide...
yt_dlp/extractor/globo.py
26
Python
0.571
suggestion
74
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'https://playback.video.globo.com/v4/video-session', video_id, f'Downloading resource info for {video_id}', headers={'Content-Type': 'application/json'}, data=json.dumps({ 'player_type': 'mirakulo_8k_hdr', 'video_id': video_id, ...
the 3rd positional argument is `mpd_id` and there's no reason for these to be non-fatal ```suggestion formats, subtitles = self._extract_mpd_formats_and_subtitles(main_source['url'], video_id, mpd_id='dash') ```
formats = [] video = self._download_json( 'https://playback.video.globo.com/v4/video-session', video_id, f'Downloading resource info for {video_id}', headers={'Content-Type': 'application/json'}, data=json.dumps(filter_dict({ 'player_type'...
@@ -80,98 +90,71 @@ class GloboIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - self._request_webpage( - HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'), - vide...
yt_dlp/extractor/globo.py
26
Python
0.857
refactor
226
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
data=json.dumps({ 'player_type': 'mirakulo_8k_hdr', 'video_id': video_id, 'quality': 'max', 'content_protection': 'widevine', 'vsid': f'{uuid.uuid4()}', 'consumption': 'streaming', 'capabilities':...
```suggestion formats, subtitles = self._extract_m3u8_formats_and_subtitles(main_source['url'], video_id, 'mp4', m3u8_id='hls') ```
'https://playback.video.globo.com/v4/video-session', video_id, f'Downloading resource info for {video_id}', headers={'Content-Type': 'application/json'}, data=json.dumps(filter_dict({ 'player_type': 'mirakulo_8k_hdr', 'video_id': video_id, ...
@@ -80,98 +90,71 @@ class GloboIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - self._request_webpage( - HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'), - vide...
yt_dlp/extractor/globo.py
26
Python
0.786
refactor
145
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'quality': 'max', 'content_protection': 'widevine', 'vsid': f'{uuid.uuid4()}', 'consumption': 'streaming', 'capabilities': {'low_latency': True}, 'tz': '-03:00', 'Authorization': try_get(self._get_cookies('ht...
replace `en` if that's not the expected lang of course ```suggestion 'url': ('subtitle', 'srt', 'url', {url_or_none}), }, all, {subs_list_to_dict(lang='en'})), target=subtitles) ```
data=json.dumps(filter_dict({ 'player_type': 'mirakulo_8k_hdr', 'video_id': video_id, 'quality': 'max', 'content_protection': 'widevine', 'vsid': f'{uuid.uuid4()}', 'consumption': 'streaming', 'ca...
@@ -80,98 +90,71 @@ class GloboIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - self._request_webpage( - HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'), - vide...
yt_dlp/extractor/globo.py
26
Python
0.857
suggestion
205
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'operationName': 'getVideoView', 'variables': f'{{"videoId":{video_id}}}', 'query': self._VIDEO_VIEW, }, headers={ 'content-type': 'application/json', 'x-platform-id': 'web', 'x-device-id': 'desktop', ...
weird that this is in the payload instead of the headers? but anyways, maybe call `filter_dict` on the whole payload dict to just remove `Authorization` if the value is `None`?
info = self._download_json( 'https://cloud-jarvis.globo.com/graphql', video_id, query={ 'operationName': 'getVideoView', 'variables': json.dumps({'videoId': video_id}), 'query': self._VIDEO_VIEW, }, headers={ 'co...
@@ -80,98 +90,71 @@ class GloboIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - self._request_webpage( - HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'), - vide...
yt_dlp/extractor/globo.py
26
Python
0.571
security
179
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'params': { 'skip_download': True, }, }, { 'url': 'globo:12824146', 'info_dict': { 'id': '12824146', 'ext': 'mp4', 'title': 'Acordo de damas', 'episode_number': 1, 'season_number': 2, }, '...
maybe overkill but I really hate trying to decipher the `}}}`s use `separators` param if the default whitespace is a problem for the graphql ```suggestion 'variables': json.dumps({'videoId': video_id}), ```
'title': 'Capítulo de 14⧸08⧸1989', 'episode_number': 1, }, 'params': { 'skip_download': True, }, }, { 'url': 'globo:12824146', 'info_dict': { 'id': '12824146', 'ext': 'mp4', 'title': 'Acordo de da...
@@ -80,98 +90,71 @@ class GloboIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - self._request_webpage( - HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'), - vide...
yt_dlp/extractor/globo.py
26
Python
0.857
suggestion
230
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
import json import re import uuid from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, orderedSet, str_or_none, try_get, ) from ..utils.traversal import subs_list_to_dict, traverse_obj class GloboIE(InfoExtractor): _VALID_URL = r'(?:globo:|https?://.+?\.globo\.c...
```suggestion _VALID_URL = r'(?:globo:|https?://[^/?#]+?\.globo\.com/(?:[^/?#]+/))(?P<id>\d{7,})' ```
import json import re import uuid from .common import InfoExtractor from ..utils import ( determine_ext, filter_dict, float_or_none, int_or_none, orderedSet, str_or_none, try_get, url_or_none, ) from ..utils.traversal import subs_list_to_dict, traverse_obj class GloboIE(InfoExtractor)...
@@ -1,32 +1,45 @@ -import base64 -import hashlib import json -import random import re +import uuid from .common import InfoExtractor -from ..networking import HEADRequest from ..utils import ( - ExtractorError, float_or_none, + int_or_none, orderedSet, str_or_none, try_get, ) +from ..ut...
yt_dlp/extractor/globo.py
17
Python
0.714
suggestion
107
42
42
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
'operationName': 'getVideoView', 'variables': json.dumps({'videoId': video_id}), 'query': self._VIDEO_VIEW, }, headers={ 'content-type': 'application/json', 'x-platform-id': 'web', 'x-device-id': 'desktop', ...
```suggestion lambda x: f'Bearer {x["GLBID"].value}'), ```
'operationName': 'getVideoView', 'variables': json.dumps({'videoId': video_id}), 'query': self._VIDEO_VIEW, }, headers={ 'content-type': 'application/json', 'x-platform-id': 'web', 'x-device-id': 'desktop', ...
@@ -120,23 +123,22 @@ def _real_extract(self, url): 'Authorization': try_get(self._get_cookies('https://globo.com'), lambda x: f'Bearer {x["GLBID"].value}') or '',
yt_dlp/extractor/globo.py
26
Python
0.714
suggestion
101
51
51
false
[ie/globo] Fix extractor
11,795
yt-dlp/yt-dlp
132,642
Python
bashonly
slipinthedove
class XiaoHongShuIE(InfoExtractor): _VALID_URL = r'https?://www\.xiaohongshu\.com/(explore|discovery/item)/(?P<id>[\da-f]+)' IE_DESC = '小红书' _TESTS = [{ 'url': 'https://www.xiaohongshu.com/explore/6411cf99000000001300b6d9', 'md5': '2a87a77ddbedcaeeda8d7eae61b61228', 'info_dict': { ...
```suggestion 'thumbnail': r're:https?://sns-webpic-qc\.xhscdn\.com/\d+/[\da-f]+/[^/]+', ```
class XiaoHongShuIE(InfoExtractor): _VALID_URL = r'https?://www\.xiaohongshu\.com/(?:explore|discovery/item)/(?P<id>[\da-f]+)' IE_DESC = '小红书' _TESTS = [{ 'url': 'https://www.xiaohongshu.com/explore/6411cf99000000001300b6d9', 'md5': '2a87a77ddbedcaeeda8d7eae61b61228', 'info_dict': { ...
@@ -25,6 +25,18 @@ class XiaoHongShuIE(InfoExtractor): 'duration': 101.726, 'thumbnail': r're:https?://sns-webpic-qc\.xhscdn\.com/\d+/[a-z0-9]+/[\w]+', }, + }, { + 'url': 'https://www.xiaohongshu.com/discovery/item/674051740000000007027a15?xsec_token=CBgeL8Dxd1ZWBhwqRd568gAZ...
yt_dlp/extractor/xiaohongshu.py
26
Python
0.714
suggestion
106
51
51
false
[ie/XiaoHongShu] Extend `_VALID_URL`
11,806
yt-dlp/yt-dlp
132,642
Python
grqz
HobbyistDev
from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, js_to_json, url_or_none, ) from ..utils.traversal import traverse_obj class XiaoHongShuIE(InfoExtractor): _VALID_URL = r'https?://www\.xiaohongshu\.com/(explore|discovery/item)/(?P<id>[\da-f]+)' IE_DESC = '小红书...
[Don't capture groups you don't use](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#dont-capture-groups-you-dont-use) ```suggestion _VALID_URL = r'https?://www\.xiaohongshu\.com/(?:explore|discovery/item)/(?P<id>[\da-f]+)' ```
from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, js_to_json, url_or_none, ) from ..utils.traversal import traverse_obj class XiaoHongShuIE(InfoExtractor): _VALID_URL = r'https?://www\.xiaohongshu\.com/(?:explore|discovery/item)/(?P<id>[\da-f]+)' IE_DESC = '小...
@@ -10,7 +10,7 @@ class XiaoHongShuIE(InfoExtractor): - _VALID_URL = r'https?://www\.xiaohongshu\.com/explore/(?P<id>[\da-f]+)' + _VALID_URL = r'https?://www\.xiaohongshu\.com/(explore|discovery/item)/(?P<id>[\da-f]+)'
yt_dlp/extractor/xiaohongshu.py
13
Python
0.857
suggestion
247
38
38
false
[ie/XiaoHongShu] Extend `_VALID_URL`
11,806
yt-dlp/yt-dlp
132,642
Python
grqz
HobbyistDev
return { 'comments': [{ 'ext': 'json', 'data': json.dumps(danmaku), }], } class NiconicoPlaylistBaseIE(InfoExtractor): _PAGE_SIZE = 100 _API_HEADERS = { 'X-Frontend-ID': '6', 'X-Frontend-Version': '0', 'X-Niconico...
```suggestion 'uploader': traverse_obj(item, ('owner', ('name', ('user', 'nickname')), {str}, any)), 'uploader_id': traverse_obj(item, ('owner', 'id', {str})), ```
return { 'comments': [{ 'ext': 'json', 'data': json.dumps(danmaku), }], } class NiconicoPlaylistBaseIE(InfoExtractor): _PAGE_SIZE = 100 _API_HEADERS = { 'X-Frontend-ID': '6', 'X-Frontend-Version': '0', 'X-Niconico...
@@ -592,7 +592,8 @@ def _call_api(self, list_id, resource, query): @staticmethod def _parse_owner(item): return { - 'uploader': traverse_obj(item, ('owner', 'name')), + 'uploader': traverse_obj(item, ('owner', 'name')) + or traverse_obj(item, ('owner', 'user', 'nickna...
yt_dlp/extractor/niconico.py
26
Python
0.786
suggestion
190
51
51
false
[niconico:series] Fixed api reander. (temporary repair)
11,822
yt-dlp/yt-dlp
132,642
Python
bashonly
ghost
'url': 'https://www.nicovideo.jp/series/12312/', 'info_dict': { 'id': '12312', 'title': 'バトルスピリッツ お勧めカード紹介(調整中)', 'description': '', 'uploader': '野鳥', 'uploader_id': '2275360', }, 'playlist_mincount': 103, }, { 'url'...
```suggestion series = self._call_api(list_id, 'list', { 'pageSize': 1, })['detail'] ```
'info_dict': { 'id': '12312', 'title': 'バトルスピリッツ お勧めカード紹介(調整中)', 'description': '', 'uploader': '野鳥', 'uploader_id': '2275360', }, 'playlist_mincount': 103, }, { 'url': 'https://nico.ms/series/203559', 'only_matching...
@@ -675,33 +676,41 @@ class NiconicoSeriesIE(InfoExtractor): 'info_dict': { 'id': '110226', 'title': 'ご立派ァ!のシリーズ', + 'description': '楽しそうな外人の吹き替えをさせたら終身名誉ホモガキの右に出る人はいませんね…', + 'uploader': 'アルファるふぁ', + 'uploader_id': '44113208', }, 'pl...
yt_dlp/extractor/niconico.py
26
Python
0.714
suggestion
122
51
51
false
[niconico:series] Fixed api reander. (temporary repair)
11,822
yt-dlp/yt-dlp
132,642
Python
bashonly
ghost
'id': 'BV1TAmBYVEJr', 'ext': 'mp4', 'uploader_id': '1192648858', 'comment_count': int, '_old_archive_ids': ['bilibili 113457567568273_part1'], 'thumbnail': 'http://i2.hdslb.com/bfs/archive/50091efd965d9f13ff6814f7ad374f90ab21e77d.jpg', ...
Support traversal of bangumi ones as well? https://t.bilibili.com/1010093853244391443 https://t.bilibili.com/1007774564482023446 and example of link within the rich text content https://t.bilibili.com/1005193024981958661
'id': 'BV1TAmBYVEJr', 'ext': 'mp4', 'uploader_id': '1192648858', 'comment_count': int, '_old_archive_ids': ['bilibili 113457567568273_part1'], 'thumbnail': 'http://i2.hdslb.com/bfs/archive/50091efd965d9f13ff6814f7ad374f90ab21e77d.jpg', ...
@@ -1861,6 +1862,42 @@ def _real_extract(self, url): ie=BiliBiliIE.ie_key(), video_id=video_id) +class BiliBiliDynamicIE(InfoExtractor): + _VALID_URL = r'https?://(?:t\.bilibili\.com|(?:www\.)?bilibili\.com/opus)/(?P<id>\d+)' + _TESTS = [{ + 'url': 'https://t.bilibili.com/99813428919743285...
yt_dlp/extractor/bilibili.py
26
Python
0.429
suggestion
224
51
51
false
[ie/BiliBiliDynamic] Add extractor
11,838
yt-dlp/yt-dlp
132,642
Python
c-basalt
ghost
'upload_date': '20241110', 'uploader': '何同学工作室', 'like_count': int, 'view_count': int, 'title': '美国小朋友就玩这个?!何同学工作室11月开箱', 'description': '本期产品信息:\n机器狗\n气味模拟器\nCloudboom Strike LS\n无弦吉他\n蓝牙磁带音箱\n神奇画板', 'timestamp': 1731232800, ...
why is the error expected? ```suggestion if not video_url or video_url == url: raise ExtractorError('No valid URL found') ```
'upload_date': '20241110', 'uploader': '何同学工作室', 'like_count': int, 'view_count': int, 'title': '美国小朋友就玩这个?!何同学工作室11月开箱', 'description': '本期产品信息:\n机器狗\n气味模拟器\nCloudboom Strike LS\n无弦吉他\n蓝牙磁带音箱\n神奇画板', 'timestamp': 1731232800, ...
@@ -1861,6 +1862,47 @@ def _real_extract(self, url): ie=BiliBiliIE.ie_key(), video_id=video_id) +class BiliBiliDynamicIE(InfoExtractor): + _VALID_URL = r'https?://(?:t\.bilibili\.com|(?:www\.)?bilibili\.com/opus)/(?P<id>\d+)' + _TESTS = [{ + 'url': 'https://t.bilibili.com/99813428919743285...
yt_dlp/extractor/bilibili.py
26
Python
0.929
refactor
149
51
51
false
[ie/BiliBiliDynamic] Add extractor
11,838
yt-dlp/yt-dlp
132,642
Python
bashonly
ghost
_VALID_URL = r'https?://(?:t\.bilibili\.com|(?:www\.)?bilibili\.com/opus)/(?P<id>\d+)' _TESTS = [{ 'url': 'https://t.bilibili.com/998134289197432852', 'info_dict': { 'id': 'BV1TAmBYVEJr', 'ext': 'mp4', 'uploader_id': '1192648858', 'comment_count': ...
```suggestion # Without the newer chrome UA, the API will return an error (-352) ```
_VALID_URL = r'https?://(?:t\.bilibili\.com|(?:www\.)?bilibili\.com/opus)/(?P<id>\d+)' _TESTS = [{ 'url': 'https://t.bilibili.com/998134289197432852', 'info_dict': { 'id': 'BV1TAmBYVEJr', 'ext': 'mp4', 'uploader_id': '1192648858', 'comment_count': ...
@@ -1861,6 +1862,47 @@ def _real_extract(self, url): ie=BiliBiliIE.ie_key(), video_id=video_id) +class BiliBiliDynamicIE(InfoExtractor): + _VALID_URL = r'https?://(?:t\.bilibili\.com|(?:www\.)?bilibili\.com/opus)/(?P<id>\d+)' + _TESTS = [{ + 'url': 'https://t.bilibili.com/99813428919743285...
yt_dlp/extractor/bilibili.py
26
Python
0.714
suggestion
94
51
51
false
[ie/BiliBiliDynamic] Add extractor
11,838
yt-dlp/yt-dlp
132,642
Python
grqz
ghost
if 'configs' not in self._configuration_arg('player_skip') and client != 'web': player_ytcfg = self._download_ytcfg(client, video_id) or player_ytcfg player_url = player_url or self._extract_player_url(master_ytcfg, player_ytcfg, webpage=webpage) require_js_player = ...
```suggestion f'which may be required for working {client} formats. This client will be deprioritized', only_once=True) ```
if 'configs' not in self._configuration_arg('player_skip') and client != 'web': player_ytcfg = self._download_ytcfg(client, video_id) or player_ytcfg player_url = player_url or self._extract_player_url(master_ytcfg, player_ytcfg, webpage=webpage) require_js_player = ...
@@ -3973,13 +3974,10 @@ def append_client(*client_names): ) require_po_token = self._get_default_ytcfg(client).get('REQUIRE_PO_TOKEN') - if not po_token and require_po_token: + if not po_token and require_po_token and 'missing_pot' in self._configuration_arg('formats'):...
yt_dlp/extractor/youtube.py
26
Python
0.714
suggestion
145
51
51
false
[ie/youtube] Skip iOS formats that require PO Token
11,890
yt-dlp/yt-dlp
132,642
Python
bashonly
coletdjnz
deprioritize_pr = False client, base_client, variant = _split_innertube_client(clients.pop()) player_ytcfg = master_ytcfg if client == 'web' else {} if 'configs' not in self._configuration_arg('player_skip') and client != 'web': player_ytcfg = self._downlo...
the formats are still deprioritized even if `missing_pot` is passed, though, right? we are still setting `'preference': -20`
deprioritize_pr = False client, base_client, variant = _split_innertube_client(clients.pop()) player_ytcfg = master_ytcfg if client == 'web' else {} if 'configs' not in self._configuration_arg('player_skip') and client != 'web': player_ytcfg = self._downlo...
@@ -3973,13 +3974,10 @@ def append_client(*client_names): ) require_po_token = self._get_default_ytcfg(client).get('REQUIRE_PO_TOKEN') - if not po_token and require_po_token: + if not po_token and require_po_token and 'missing_pot' in self._configuration_arg('formats'):
yt_dlp/extractor/youtube.py
26
Python
0.571
suggestion
124
51
51
false
[ie/youtube] Skip iOS formats that require PO Token
11,890
yt-dlp/yt-dlp
132,642
Python
bashonly
coletdjnz
prs.extend(deprioritized_prs) if skipped_clients: self.report_warning( f'Skipping player responses from {"/".join(skipped_clients)} clients ' f'(got player responses for video "{"/".join(set(skipped_clients.values()))}" instead of "{video_id}")') ...
```suggestion 'To enable these broken formats anyway, pass --extractor-args "youtube:formats=missing_pot"') ```
prs.extend(deprioritized_prs) if skipped_clients: self.report_warning( f'Skipping player responses from {"/".join(skipped_clients)} clients ' f'(got player responses for video "{"/".join(set(skipped_clients.values()))}" instead of "{video_id}")') ...
@@ -4053,6 +4051,21 @@ def _needs_live_processing(self, live_status, duration): or (live_status == 'post_live' and (duration or 0) > 2 * 3600)): return live_status + def _report_pot_format_skipped(self, video_id, client_name, proto): + msg = ( + f'{video_id}: {client...
yt_dlp/extractor/youtube.py
26
Python
0.786
bug
125
51
51
false
[ie/youtube] Skip iOS formats that require PO Token
11,890
yt-dlp/yt-dlp
132,642
Python
bashonly
coletdjnz
Return a date object from a string using datetime_from_str @param strict Restrict allowed patterns to "YYYYMMDD" and (now|today|yesterday)(-\d+(day|week|month|year)s?)? """ if strict and not re.fullmatch(r'\d{8}|(now|today|yesterday)(-\d+(day|week|month|year)s?)?', date_str): ...
comment text needs some cleanup to be made coherent
return datetime_round(dt.datetime.strptime(date_str, format), precision) def date_from_str(date_str, format='%Y%m%d', strict=False): R""" Return a date object from a string using datetime_from_str @param strict Restrict allowed patterns to "YYYYMMDD" and (now|today|yesterday)(-\d...
@@ -1364,22 +1364,34 @@ def datetime_add_months(dt_, months): return dt_.replace(year, month, day) +def datetime_from_timestamp(timestamp): + # Working around out-of-range timestamp values (e.g. negative ones on Windows, + # see http://bugs.python.org/issue1646728) + # Using naive datetime here can br...
yt_dlp/utils/_utils.py
26
Python
0.214
suggestion
51
51
51
false
[core] Calculate date by `strftime_or_none`; fix seconds in `datetime_round`
11,902
yt-dlp/yt-dlp
132,642
Python
pukkandan
pzhlkj6612
# Working around out-of-range timestamp values (e.g. negative ones on Windows, # see http://bugs.python.org/issue1646728) # Using naive datetime here can break timestamp() in Windows # Ref: https://github.com/yt-dlp/yt-dlp/issues/5185, https://github.com/python/cpython/issues/94414 # Also, dt.dateti...
isn't this cleaner? ```suggestion timestamp = roundto(calendar.timegm(dt_.timetuple()) + dt_.microsecond / 1E6, unit_seconds[precision]) ```
month = month % 12 + 1 day = min(dt_.day, calendar.monthrange(year, month)[1]) return dt_.replace(year, month, day) def datetime_round(dt_, precision='day'): """ Round a datetime object's time to a specific precision """ if precision == 'microsecond': return dt_ time_scale = 1...
@@ -1364,22 +1364,34 @@ def datetime_add_months(dt_, months): return dt_.replace(year, month, day) +def datetime_from_timestamp(timestamp): + # Working around out-of-range timestamp values (e.g. negative ones on Windows, + # see http://bugs.python.org/issue1646728) + # Using naive datetime here can br...
yt_dlp/utils/_utils.py
26
Python
0.714
question
147
51
51
false
[core] Calculate date by `strftime_or_none`; fix seconds in `datetime_round`
11,902
yt-dlp/yt-dlp
132,642
Python
pukkandan
pzhlkj6612
def date_from_str(date_str, format='%Y%m%d', strict=False): R""" Return a date object from a string using datetime_from_str @param strict Restrict allowed patterns to "YYYYMMDD" and (now|today|yesterday)(-\d+(day|week|month|year)s?)? """ if strict and not re.fullmatch(r'\d{8}|...
```suggestion # Ref: https://github.com/yt-dlp/yt-dlp/issues/5185, https://github.com/python/cpython/issues/81708, ```
return new_date return datetime_round(dt.datetime.strptime(date_str, format), precision) def date_from_str(date_str, format='%Y%m%d', strict=False): R""" Return a date object from a string using datetime_from_str @param strict Restrict allowed patterns to "YYYYMMDD" and (...
@@ -1367,22 +1367,30 @@ def datetime_add_months(dt_, months): return dt_.replace(year, month, day) +def datetime_from_timestamp(timestamp): + # Calling dt.datetime.fromtimestamp with negative timestamps throws error in Windows + # Ref: https://github.com/yt-dlp/yt-dlp/issues/5185, https://github.com/pyth...
yt_dlp/utils/_utils.py
26
Python
0.714
suggestion
122
51
51
false
[core] Calculate date by `strftime_or_none`; fix seconds in `datetime_round`
11,902
yt-dlp/yt-dlp
132,642
Python
seproDev
pzhlkj6612
def bool_or_none(v, default=None): return v if isinstance(v, bool) else default def strip_or_none(v, default=None): return v.strip() if isinstance(v, str) else default def url_or_none(url): if not url or not isinstance(url, str): return None url = url.strip() return url if re.match(r'(?:...
OSError? how? can it be tested?
def bool_or_none(v, default=None): return v if isinstance(v, bool) else default def strip_or_none(v, default=None): return v.strip() if isinstance(v, str) else default def url_or_none(url): if not url or not isinstance(url, str): return None url = url.strip() return url if re.match(r'(?:...
@@ -2050,18 +2058,13 @@ def strftime_or_none(timestamp, date_format='%Y%m%d', default=None): datetime_object = None try: if isinstance(timestamp, (int, float)): # unix timestamp - # Using naive datetime here can break timestamp() in Windows - # Ref: https://github.com/yt-dlp/yt...
yt_dlp/utils/_utils.py
26
Python
0.214
question
31
51
51
false
[core] Calculate date by `strftime_or_none`; fix seconds in `datetime_round`
11,902
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
pzhlkj6612
return { 'id': music_id, 'vcodec': 'none', 'webpage_url': webpage_url, 'extractor_key': EggsIE.ie_key(), 'extractor': EggsIE.IE_NAME, **traverse_obj(data, { 'title': ('musicTitle', {str}), 'url': ('musicData...
```suggestion _VALID_URL = r'https?://eggs\.mu/artist/[^/?#]+/song/(?P<id>[\da-f-]+)' ```
return { 'id': music_id, 'vcodec': 'none', 'webpage_url': webpage_url, 'extractor_key': EggsIE.ie_key(), 'extractor': EggsIE.IE_NAME, **traverse_obj(data, { 'title': ('musicTitle', {str}), 'url': ('musicData...
@@ -0,0 +1,155 @@ +import secrets + +from .common import InfoExtractor +from .youtube import YoutubeIE +from ..utils import ( + int_or_none, + parse_iso8601, + str_or_none, + url_or_none, +) +from ..utils.traversal import traverse_obj + + +class EggsBaseIE(InfoExtractor): + _API_HEADERS = { + 'Acc...
yt_dlp/extractor/eggs.py
26
Python
0.571
suggestion
95
51
51
false
[ie/eggs] Add extractors
11,904
yt-dlp/yt-dlp
132,642
Python
bashonly
subsense
self.assertEqual(sanitize_path('\\\\?\\UNC/ComputerName/abc'), '\\\\?\\UNC\\ComputerName\\abc') self.assertEqual(sanitize_path('\\\\?\\C:\\abc'), '\\\\?\\C:\\abc') self.assertEqual(sanitize_path('\\\\?\\C:/abc'), '\\\\?\\C:\\abc') self.assertEqual(sanitize_path('\\\\?\\C:\\ab?c\\de:f'),...
> ```py > self.assertEqual(sanitize_path('C:abc\\..\\'), 'C:..') > ``` so we were expecting the wrong result here?
self.assertEqual(sanitize_path('\\\\?\\UNC/ComputerName/abc'), '\\\\?\\UNC\\ComputerName\\abc') self.assertEqual(sanitize_path('\\\\?\\C:\\abc'), '\\\\?\\C:\\abc') self.assertEqual(sanitize_path('\\\\?\\C:/abc'), '\\\\?\\C:\\abc') self.assertEqual(sanitize_path('\\\\?\\C:\\ab?c\\de:f'),...
@@ -249,17 +249,36 @@ def _test_sanitize_path(self): self.assertEqual(sanitize_path('abc/def...'), 'abc\\def..#') self.assertEqual(sanitize_path('abc.../def'), 'abc..#\\def') self.assertEqual(sanitize_path('abc.../def...'), 'abc..#\\def..#') - - self.assertEqual(sanitize_path('../abc')...
test/test_utils.py
26
Python
0.714
bug
124
51
51
false
[utils] `sanitize_path`: Fix some incorrect behavior
11,923
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
self.assertEqual(sanitize_path('\\\\?\\UNC/ComputerName/abc'), '\\\\?\\UNC\\ComputerName\\abc') self.assertEqual(sanitize_path('\\\\?\\C:\\abc'), '\\\\?\\C:\\abc') self.assertEqual(sanitize_path('\\\\?\\C:/abc'), '\\\\?\\C:\\abc') self.assertEqual(sanitize_path('\\\\?\\C:\\ab?c\\de:f'),...
In the [CPython source](https://github.com/python/cpython/blob/3.13/Lib/ntpath.py#LC510), a simpler tactic like this (what I would have expected) is used: ```suggestion try: from nt import _path_normpath as nt_path_normpath except ImportError: nt_path_normpath = None ``` B...
self.assertEqual(sanitize_path('\\\\?\\UNC/ComputerName/abc'), '\\\\?\\UNC\\ComputerName\\abc') self.assertEqual(sanitize_path('\\\\?\\C:\\abc'), '\\\\?\\C:\\abc') self.assertEqual(sanitize_path('\\\\?\\C:/abc'), '\\\\?\\C:\\abc') self.assertEqual(sanitize_path('\\\\?\\C:\\ab?c\\de:f'),...
@@ -249,17 +249,36 @@ def _test_sanitize_path(self): self.assertEqual(sanitize_path('abc/def...'), 'abc\\def..#') self.assertEqual(sanitize_path('abc.../def'), 'abc..#\\def') self.assertEqual(sanitize_path('abc.../def...'), 'abc..#\\def..#') - - self.assertEqual(sanitize_path('../abc')...
test/test_utils.py
26
Python
1
security
733
51
51
false
[utils] `sanitize_path`: Fix some incorrect behavior
11,923
yt-dlp/yt-dlp
132,642
Python
dirkf
Grub4K
thumbnails.append(i) else: thumbnails = [{'url': thumbnail}] def extract_count(key): return int_or_none(info.get(f'{key}_count')) return { 'id': track_id, 'uploader': user.get('username'), 'uploader_id': st...
can we move this up so it's below `title` since they are using the same value
thumbnails.append(i) else: thumbnails = [{'url': thumbnail}] def extract_count(key): return int_or_none(info.get(f'{key}_count')) return { 'id': track_id, 'uploader': user.get('username'), 'uploader_id': st...
@@ -372,6 +372,7 @@ def extract_count(key): 'repost_count': extract_count('reposts'), 'genres': traverse_obj(info, ('genre', {str}, filter, all, filter)), 'artists': traverse_obj(info, ('publisher_metadata', 'artist', {str}, filter, all, filter)), + 'track': info.get('t...
yt_dlp/extractor/soundcloud.py
26
Python
0.429
refactor
77
51
51
false
[ie/soundcloud] Add more extracted fields
11,945
yt-dlp/yt-dlp
132,642
Python
bashonly
7x11x13