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
), 'utf8': True, }), ) def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) if '<div id="watch-unauthorized"' in webpage: if self._get_cookies('https://www.softwhiteu...
so it's non-fatal ```suggestion 'thumbnail': update_url(self._og_search_thumbnail(webpage, default=''), query=None) or None, ``` or if you want the warning when it fails ```suggestion 'thumbnail': update_url(self._og_search_thumbnail(webpage) or '', query=None) or None, ```
from .common import InfoExtractor from .vimeo import VHXEmbedIE from ..utils import ( ExtractorError, clean_html, update_url, urlencode_postdata, ) from ..utils.traversal import find_element, traverse_obj class SoftWhiteUnderbellyIE(InfoExtractor): _LOGIN_URL = 'https://www.softwhiteunderbelly.com...
@@ -0,0 +1,95 @@ +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_class, + get_element_by_id, + update_url, + urlencode_postdata, +) + + +class SoftWhiteUnderbellyIE(InfoExtractor): + _LOGIN_URL = 'https://www....
yt_dlp/extractor/softwhiteunderbelly.py
26
Python
0.786
bug
307
28
88
false
[ie/softwhiteunderbelly] Add extractor
12,281
yt-dlp/yt-dlp
132,642
Python
bashonly
benfaerber
r'name=["\']authenticity_token["\'] value=["\'](.+?)["\']', signin_page, 'authenticity_token', ), 'utf8': True, }), ) def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display...
again here depends on if you think the description is worthy of a warning ```suggestion 'description': self._html_search_meta('description', webpage, default=None), ```
from .common import InfoExtractor from .vimeo import VHXEmbedIE from ..utils import ( ExtractorError, clean_html, update_url, urlencode_postdata, ) from ..utils.traversal import find_element, traverse_obj class SoftWhiteUnderbellyIE(InfoExtractor): _LOGIN_URL = 'https://www.softwhiteunderbelly.com...
@@ -0,0 +1,95 @@ +from .common import InfoExtractor +from .vimeo import VHXEmbedIE +from ..utils import ( + ExtractorError, + clean_html, + get_element_by_class, + get_element_by_id, + update_url, + urlencode_postdata, +) + + +class SoftWhiteUnderbellyIE(InfoExtractor): + _LOGIN_URL = 'https://www....
yt_dlp/extractor/softwhiteunderbelly.py
26
Python
0.714
suggestion
184
29
88
false
[ie/softwhiteunderbelly] Add extractor
12,281
yt-dlp/yt-dlp
132,642
Python
bashonly
benfaerber
'ext': 'mp4', 'display_id': 'FBqgOmDxO', 'title': '柴犬柴犬的秒拍视频', 'description': '午睡当然是要甜甜蜜蜜的啦![坏笑] Instagram:shibainu.gaku http://t.cn/RHbmjzW ', 'duration': 53, 'timestamp': 1514264429, 'upload_date': '20171226', 'thumbna...
```suggestion mix_media_info = traverse_obj(meta, ('mix_media_info', 'items', ...)) ```
'like_count': int, 'repost_count': int, }, }, { 'url': 'https://m.weibo.cn/detail/4189191225395228', 'only_matching': True, }, { 'url': 'https://weibo.com/0/4224132150961381', 'note': 'no playback_list example', 'only_matching': True, }...
@@ -192,8 +192,30 @@ class WeiboIE(WeiboBaseIE): def _real_extract(self, url): video_id = self._match_id(url) - return self._parse_video_info(self._weibo_download_json( - f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id)) + meta = self._weibo_download_json(f'https...
yt_dlp/extractor/weibo.py
26
Python
0.571
suggestion
97
51
51
false
[ie/weibo] Support playlists
12,284
yt-dlp/yt-dlp
132,642
Python
bashonly
4ft35t
'timestamp': 1514264429, 'upload_date': '20171226', 'thumbnail': r're:https://.*\.jpg', 'uploader': '柴犬柴犬', 'uploader_id': '5926682210', 'uploader_url': 'https://weibo.com/u/5926682210', 'view_count': int, 'like_count': int,...
I'd rather return just an id and no title instead of arbitrarily using the first entry's title ```suggestion return self.playlist_result(self._entries(mix_media_info), video_id) ```
'only_matching': True, }, { 'url': 'https://weibo.com/0/4224132150961381', 'note': 'no playback_list example', 'only_matching': True, }, { 'url': 'https://m.weibo.cn/detail/5120561132606436', 'info_dict': { 'id': '5120561132606436', }, ...
@@ -192,8 +192,30 @@ class WeiboIE(WeiboBaseIE): def _real_extract(self, url): video_id = self._match_id(url) - return self._parse_video_info(self._weibo_download_json( - f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id)) + meta = self._weibo_download_json(f'https...
yt_dlp/extractor/weibo.py
26
Python
0.786
suggestion
192
51
51
false
[ie/weibo] Support playlists
12,284
yt-dlp/yt-dlp
132,642
Python
bashonly
4ft35t
'view_count': int, 'like_count': int, 'repost_count': int, }, }, { 'url': 'https://weibo.com/0/4224132150961381', 'note': 'no playback_list example', 'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id...
```suggestion for media_info in traverse_obj(mix_media_info, lambda _, v: v['type'] != 'pic'): ```
'url': 'https://m.weibo.cn/detail/5120561132606436', 'info_dict': { 'id': '5120561132606436', }, 'playlist_count': 9, }] def _real_extract(self, url): video_id = self._match_id(url) meta = self._weibo_download_json(f'https://weibo.com/ajax/statuses/s...
@@ -192,8 +192,30 @@ class WeiboIE(WeiboBaseIE): def _real_extract(self, url): video_id = self._match_id(url) - return self._parse_video_info(self._weibo_download_json( - f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id)) + meta = self._weibo_download_json(f'https...
yt_dlp/extractor/weibo.py
26
Python
0.857
suggestion
108
51
51
false
[ie/weibo] Support playlists
12,284
yt-dlp/yt-dlp
132,642
Python
bashonly
4ft35t
'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) meta = self._weibo_download_json(f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id) mix_media_info = traverse_obj(meta, ('mix_media_info', 'items')) if not mix_media_inf...
inline below ```suggestion ```
def _real_extract(self, url): video_id = self._match_id(url) meta = self._weibo_download_json(f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id) mix_media_info = traverse_obj(meta, ('mix_media_info', 'items', ...)) if not mix_media_info: return self._parse_...
@@ -192,8 +192,30 @@ class WeiboIE(WeiboBaseIE): def _real_extract(self, url): video_id = self._match_id(url) - return self._parse_video_info(self._weibo_download_json( - f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id)) + meta = self._weibo_download_json(f'https...
yt_dlp/extractor/weibo.py
26
Python
0.429
suggestion
32
51
51
false
[ie/weibo] Support playlists
12,284
yt-dlp/yt-dlp
132,642
Python
bashonly
4ft35t
def _real_extract(self, url): video_id = self._match_id(url) meta = self._weibo_download_json(f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id) mix_media_info = traverse_obj(meta, ('mix_media_info', 'items')) if not mix_media_info: return self._parse_video...
shouldn't remove data like this ```suggestion ```
meta = self._weibo_download_json(f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id) mix_media_info = traverse_obj(meta, ('mix_media_info', 'items', ...)) if not mix_media_info: return self._parse_video_info(meta) return self.playlist_result(self._entries(mix_me...
@@ -192,8 +192,30 @@ class WeiboIE(WeiboBaseIE): def _real_extract(self, url): video_id = self._match_id(url) - return self._parse_video_info(self._weibo_download_json( - f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id)) + meta = self._weibo_download_json(f'https...
yt_dlp/extractor/weibo.py
26
Python
0.643
suggestion
51
51
51
false
[ie/weibo] Support playlists
12,284
yt-dlp/yt-dlp
132,642
Python
bashonly
4ft35t
video_id = self._match_id(url) meta = self._weibo_download_json(f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id) mix_media_info = traverse_obj(meta, ('mix_media_info', 'items')) if not mix_media_info: return self._parse_video_info(meta) playlist_titl...
```suggestion yield self._parse_video_info(traverse_obj(media_info, { 'id': ('data', 'object_id'), 'page_info': {'media_info': ('data', 'media_info', {dict})}, })) ```
mix_media_info = traverse_obj(meta, ('mix_media_info', 'items', ...)) if not mix_media_info: return self._parse_video_info(meta) return self.playlist_result(self._entries(mix_media_info), video_id) def _entries(self, mix_media_info): for media_info in traverse_obj(mix_m...
@@ -192,8 +192,30 @@ class WeiboIE(WeiboBaseIE): def _real_extract(self, url): video_id = self._match_id(url) - return self._parse_video_info(self._weibo_download_json( - f'https://weibo.com/ajax/statuses/show?id={video_id}', video_id)) + meta = self._weibo_download_json(f'https...
yt_dlp/extractor/weibo.py
26
Python
0.786
suggestion
228
51
51
false
[ie/weibo] Support playlists
12,284
yt-dlp/yt-dlp
132,642
Python
bashonly
4ft35t
'thumbnail': r're:https://.*\.jpg', 'uploader': '柴犬柴犬', 'uploader_id': '5926682210', 'uploader_url': 'https://weibo.com/u/5926682210', 'view_count': int, 'like_count': int, 'repost_count': int, }, }, { 'url': 'https:...
is this a test for a `mix_media_info` playlist? if so, please add as a playlist test (`'playlist_count': 1` etc)
'url': 'https://weibo.com/0/4224132150961381', 'note': 'no playback_list example', 'only_matching': True, }, { 'url': 'https://m.weibo.cn/detail/5120561132606436', 'info_dict': { 'id': '5120561132606436', }, 'playlist_count': 9, }] def _re...
@@ -187,13 +187,46 @@ class WeiboIE(WeiboBaseIE): 'url': 'https://weibo.com/0/4224132150961381', 'note': 'no playback_list example', 'only_matching': True, + }, { + 'url': 'https://m.weibo.cn/detail/5122647953771225', + 'info_dict': { + 'id': '5122647953771225', + ...
yt_dlp/extractor/weibo.py
26
Python
0.5
question
112
51
51
false
[ie/weibo] Support playlists
12,284
yt-dlp/yt-dlp
132,642
Python
bashonly
4ft35t
'view_count': int, 'like_count': int, 'repost_count': int, }, 'playlist_count': 1, }] def _real_extract(self, url): video_id = self._match_id(url) meta = self._weibo_download_json(f'https://weibo.com/ajax/statuses/show?id={video_id}', video_i...
```suggestion for media_info in traverse_obj(mix_media_info, lambda _, v: v['type'] != 'pic'): ```
yield self._parse_video_info(traverse_obj(media_info, { 'id': ('data', 'object_id'), 'page_info': {'media_info': ('data', 'media_info', {dict})}, })) class WeiboVideoIE(WeiboBaseIE): _VALID_URL = r'https?://(?:www\.)?weibo\.com/tv/show/(?P<id>\d+:\d+)' _...
@@ -187,13 +187,44 @@ class WeiboIE(WeiboBaseIE): 'url': 'https://weibo.com/0/4224132150961381', 'note': 'no playback_list example', 'only_matching': True, + }, { + 'url': 'https://m.weibo.cn/detail/5122647953771225', + 'info_dict': { + 'id': '5122647953771225', + ...
yt_dlp/extractor/weibo.py
26
Python
0.857
suggestion
108
51
51
false
[ie/weibo] Support playlists
12,284
yt-dlp/yt-dlp
132,642
Python
bashonly
4ft35t
r'label=(\w+)&template=(\d+x\d+)', url, 'format info', group=(1, 2), default=(None, None)) formats.append({ 'url': url, 'format_id': format_id, **parse_resolution(resolution), ...
if you are gonna truncate the title, we should offer a non-truncated version as `alt_title` ```suggestion 'title': ('page_info', 'media_info', ('video_title', 'kol_title', 'name'), {lambda x: x.replace('\n', ' ')}, {truncate_string(left=50)}, filter), 'alt_t...
format_id, resolution = self._search_regex( r'label=(\w+)&template=(\d+x\d+)', url, 'format info', group=(1, 2), default=(None, None)) formats.append({ 'url': url, 'format_id': format_...
@@ -103,11 +103,10 @@ def _parse_video_info(self, video_info, video_id=None): 'extractor': WeiboIE.IE_NAME, 'formats': self._extract_formats(video_info), 'http_headers': {'Referer': 'https://weibo.com/'}, - '_old_archive_ids': [make_archive_id('WeiboMobile', video_id)],...
yt_dlp/extractor/weibo.py
26
Python
0.857
suggestion
413
51
51
false
[ie/weibo] Support playlists
12,284
yt-dlp/yt-dlp
132,642
Python
bashonly
4ft35t
self.assertFalse(invalid_keys, f'Invalid fields returned by the extractor: {", ".join(invalid_keys)}') missing_keys = sorted( set(test_info_dict.keys()) - set(expected_dict.keys()), key=lambda x: ALLOWED_KEYS_SORT_ORDER.index(x)) if missing_keys: def _repr(v): if isinsta...
While I'm not a fan of alphabetically sorting the *info dict output*, we could revert this to alphabetically sort the one-line error output: ```suggestion 'Missing keys in test definition: {}'.format(', '.join(sorted(missing_keys)))) ```
self.assertFalse(invalid_keys, f'Invalid fields returned by the extractor: {", ".join(invalid_keys)}') missing_keys = sorted( test_info_dict.keys() - expected_dict.keys(), key=lambda x: ALLOWED_KEYS_SORT_ORDER.index(x)) if missing_keys: def _repr(v): if isinstance(v, str...
@@ -273,7 +293,7 @@ def _repr(v): write_string(info_dict_str.replace('\n', '\n '), out=sys.stderr) self.assertFalse( missing_keys, - 'Missing keys in test definition: {}'.format(', '.join(sorted(missing_keys)))) + 'Missing keys in test definition: {}'.format('...
test/helper.py
26
Python
1
suggestion
252
51
51
false
[test:download] Validate and sort info dict fields
12,299
yt-dlp/yt-dlp
132,642
Python
bashonly
pzhlkj6612
'like_count', 'dislike_count', 'repost_count', 'average_rating', 'age_limit', 'duration', 'thumbnail', 'heatmap', 'chapters', 'chapter', 'chapter_number', 'chapter_id', 'start_time', 'end_time', 'section_start', 'section_end', 'categories', 'tags', 'cast', 'composers', 'artists', 'album_artists'...
```suggestion invalid_keys = sorted(test_info_dict.keys() - ALLOWED_KEYS_SORT_ORDER) ```
'like_count', 'dislike_count', 'repost_count', 'average_rating', 'age_limit', 'duration', 'thumbnail', 'heatmap', 'chapters', 'chapter', 'chapter_number', 'chapter_id', 'start_time', 'end_time', 'section_start', 'section_end', 'categories', 'tags', 'cast', 'composers', 'artists', 'album_artists'...
@@ -252,7 +266,13 @@ def expect_info_dict(self, got_dict, expected_dict): test_info_dict = sanitize_got_info_dict(got_dict) - missing_keys = set(test_info_dict.keys()) - set(expected_dict.keys()) + # Check for invalid/misspelled field names being returned by the extractor + invalid_keys = sorted(set(t...
test/helper.py
26
Python
0.571
suggestion
94
51
51
false
[test:download] Validate and sort info dict fields
12,299
yt-dlp/yt-dlp
132,642
Python
Grub4K
pzhlkj6612
# r'#EXT-X-MAP:', # media initialization [5] # 1. https://tools.ietf.org/html/draft-pantos-http-live-streaming-17#section-4.3.2.4 # 2. https://tools.ietf.org/html/draft-pantos-http-live-streaming-17#section-4.3.2.2 # 3. https://tools.ietf.org/html/draft-pantos-http-live-...
? I wasn't sure of the best wording ```suggestion self.to_screen(f'[{self.FD_NAME}] Loading saved m3u8 manifest') ```
# r'#EXT-X-MAP:', # media initialization [5] # 1. https://tools.ietf.org/html/draft-pantos-http-live-streaming-17#section-4.3.2.4 # 2. https://tools.ietf.org/html/draft-pantos-http-live-streaming-17#section-4.3.2.2 # 3. https://tools.ietf.org/html/draft-pantos-http-live-...
@@ -72,11 +72,15 @@ def check_results(): def real_download(self, filename, info_dict): man_url = info_dict['url'] - self.to_screen(f'[{self.FD_NAME}] Downloading m3u8 manifest') - urlh = self.ydl.urlopen(self._prepare_url(info_dict, man_url)) - man_url = urlh.url - s = urlh...
yt_dlp/downloader/hls.py
26
Python
0.714
suggestion
132
51
51
false
[fd/hls] Support `hls_media_playlist_data` format field
12,322
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
from worst to best quality. Potential fields: * url The mandatory URL representing the media: for plain file media - HTTP URL of this file, for RTMP - RTMP URL, ...
for consistency with above ```suggestion The M3U8 media playlist data as a string, ```
from worst to best quality. Potential fields: * url The mandatory URL representing the media: for plain file media - HTTP URL of this file, for RTMP - RTMP URL, ...
@@ -151,6 +151,11 @@ class InfoExtractor: for HDS - URL of the F4M manifest, for DASH - URL of the MPD manifest, for MSS - URL of the ISM manifest. + * manifest_data + ...
yt_dlp/extractor/common.py
26
Python
0.714
suggestion
121
51
51
false
[fd/hls] Support `hls_media_playlist_data` format field
12,322
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
* url The mandatory URL representing the media: for plain file media - HTTP URL of this file, for RTMP - RTMP URL, for HLS - URL of the M3U8 media playlist, ...
This is incorrect, I guess. It really only doesn't apply to ffmpeg ```suggestion Only applicable for HLS formats; does not apply to ffmpeg ```
* url The mandatory URL representing the media: for plain file media - HTTP URL of this file, for RTMP - RTMP URL, for HLS - URL of the M3U8 media playlist, ...
@@ -151,6 +151,11 @@ class InfoExtractor: for HDS - URL of the F4M manifest, for DASH - URL of the MPD manifest, for MSS - URL of the ISM manifest. + * manifest_data + ...
yt_dlp/extractor/common.py
26
Python
0.714
bug
177
51
51
false
[fd/hls] Support `hls_media_playlist_data` format field
12,322
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
formats: A list of dictionaries for each format available, ordered from worst to best quality. Potential fields: * url The mandatory URL representing the media: for plain file media - HTTP URL of this file,...
```suggestion * hls_media_playlist_data ```
formats: A list of dictionaries for each format available, ordered from worst to best quality. Potential fields: * url The mandatory URL representing the media: for plain file media - HTTP URL of this file,...
@@ -151,6 +151,11 @@ class InfoExtractor: for HDS - URL of the F4M manifest, for DASH - URL of the MPD manifest, for MSS - URL of the ISM manifest. + * manifest_data
yt_dlp/extractor/common.py
26
Python
0.571
suggestion
65
51
51
false
[fd/hls] Support `hls_media_playlist_data` format field
12,322
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
# r'#EXT-X-PLAYLIST-TYPE:EVENT', # media segments may be appended to the end of # # event media playlists [4] # r'#EXT-X-MAP:', # media initialization [5] # 1. https://tools.ietf.org/html/draft-pantos-http-live-streaming-17#section-4.3.2....
```suggestion s = info_dict.get('hls_media_playlist_data') ```
# r'#EXT-X-PLAYLIST-TYPE:EVENT', # media segments may be appended to the end of # # event media playlists [4] # r'#EXT-X-MAP:', # media initialization [5] # 1. https://tools.ietf.org/html/draft-pantos-http-live-streaming-17#section-4.3.2....
@@ -72,11 +72,15 @@ def check_results(): def real_download(self, filename, info_dict): man_url = info_dict['url'] - self.to_screen(f'[{self.FD_NAME}] Downloading m3u8 manifest') - urlh = self.ydl.urlopen(self._prepare_url(info_dict, man_url)) - man_url = urlh.url - s = urlh...
yt_dlp/downloader/hls.py
26
Python
0.571
suggestion
72
51
51
false
[fd/hls] Support `hls_media_playlist_data` format field
12,322
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
care about DASH. (only for youtube) youtube_include_hls_manifest: - Use extractor_args If True (default), HLS manifests and related data will be downloaded and processed by extractor. You can reduce network I/O by disabling ...
```suggestion 'url', 'manifest_url', 'manifest_stream_number', 'ext', 'format', 'format_id', 'format_note', 'width', 'height', 'aspect_ratio', 'resolution', 'dynamic_range', 'tbr', 'abr', 'acodec', 'asr', 'audio_channels', 'vbr', 'fps', 'vcodec', 'container', 'filesize', 'filesize_approx', 'r...
care about DASH. (only for youtube) youtube_include_hls_manifest: - Use extractor_args If True (default), HLS manifests and related data will be downloaded and processed by extractor. You can reduce network I/O by disabling ...
@@ -596,7 +596,7 @@ class YoutubeDL: _format_fields = { # NB: Keep in sync with the docstring of extractor/common.py - 'url', 'manifest_url', 'manifest_stream_number', 'ext', 'format', 'format_id', 'format_note', + 'url', 'manifest_url', 'manifest_data', 'manifest_stream_number', 'ext', 'f...
yt_dlp/YoutubeDL.py
26
Python
0.786
suggestion
369
51
51
false
[fd/hls] Support `hls_media_playlist_data` format field
12,322
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
Potential fields: * url The mandatory URL representing the media: for plain file media - HTTP URL of this file, for RTMP - RTMP URL, for HLS - URL of the M3U8 media pla...
```suggestion The M3U8 media playlist data as a string. Only use if the data must be modified before download. ```
Potential fields: * url The mandatory URL representing the media: for plain file media - HTTP URL of this file, for RTMP - RTMP URL, for HLS - URL of the M3U8 media pla...
@@ -151,6 +151,11 @@ class InfoExtractor: for HDS - URL of the F4M manifest, for DASH - URL of the MPD manifest, for MSS - URL of the ISM manifest. + * hls_media_playlist_data + ...
yt_dlp/extractor/common.py
26
Python
0.786
suggestion
181
51
51
false
[fd/hls] Support `hls_media_playlist_data` format field
12,322
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
care about DASH. (only for youtube) youtube_include_hls_manifest: - Use extractor_args If True (default), HLS manifests and related data will be downloaded and processed by extractor. You can reduce network I/O by disabling ...
```suggestion 'vbr', 'fps', 'vcodec', 'container', 'filesize', 'filesize_approx', 'rows', 'columns', 'hls_media_playlist_data', ```
care about DASH. (only for youtube) youtube_include_hls_manifest: - Use extractor_args If True (default), HLS manifests and related data will be downloaded and processed by extractor. You can reduce network I/O by disabling ...
@@ -598,7 +598,7 @@ class YoutubeDL: # NB: Keep in sync with the docstring of extractor/common.py 'url', 'manifest_url', 'manifest_stream_number', 'ext', 'format', 'format_id', 'format_note', 'width', 'height', 'aspect_ratio', 'resolution', 'dynamic_range', 'tbr', 'abr', 'acodec', 'asr', 'aud...
yt_dlp/YoutubeDL.py
26
Python
0.714
suggestion
141
51
51
false
[fd/hls] Support `hls_media_playlist_data` format field
12,322
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
def _perform_login(self, username, password): captcha = self._download_json( 'https://www.reddit.com/api/requires_captcha/login.json', None, 'Checking login requirement')['required'] if captcha: raise ExtractorError('Reddit is requiring captcha before login', exp...
```suggestion options = traverse_obj(self._get_cookies('https://www.reddit.com/'), ( '_options', 'value', {urllib.parse.unquote}, {json.loads}, {dict})) or {} ```
def _perform_login(self, username, password): captcha = self._download_json( 'https://www.reddit.com/api/requires_captcha/login.json', None, 'Checking login requirement')['required'] if captcha: raise ExtractorError('Reddit is requiring captcha before login', exp...
@@ -245,6 +264,15 @@ def _perform_login(self, username, password): elif not traverse_obj(login, ('json', 'data', 'cookie', {str})): raise ExtractorError('Unable to login, no cookie was returned') + def _real_initialize(self): + # Set cookie to opt-in to age-restricted subreddits + ...
yt_dlp/extractor/reddit.py
26
Python
0.714
suggestion
185
51
51
false
[ie/reddit] Bypass gated subreddit warning
12,335
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
return filter_dict(headers) def _download_ytcfg(self, client, video_id): url = { 'web': 'https://www.youtube.com', 'web_music': 'https://music.youtube.com', 'web_embedded': f'https://www.youtube.com/embed/{video_id}?html5=1', 'tv': 'https://www.youtub...
Couldn't this pattern be a function? ```py def _download_webpage_with_retries(*args, **kwargs): for retry in self.RetryManager(fatal=False): try: return self._download_webpage(*args, **kwargs}) except ExtractorError as e: if isinstance(e.cause, ...
return filter_dict(headers) def _download_webpage_with_retries(self, *args, retry_fatal=False, retry_on_status=None, **kwargs): for retry in self.RetryManager(fatal=retry_fatal): try: return self._download_webpage(*args, **kwargs) except ExtractorError as e: ...
@@ -866,11 +866,21 @@ def _download_ytcfg(self, client, video_id): }.get(client) if not url: return {} - webpage = self._download_webpage( - url, video_id, fatal=False, note=f'Downloading {client.replace("_", " ").strip()} client config', - headers=traverse_ob...
yt_dlp/extractor/youtube.py
26
Python
1
refactor
780
51
51
false
[ie/youtube] Retry on more critical requests
12,339
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
visitor_data=None, api_hostname=None, default_client='web', **kwargs): origin = 'https://' + (self._select_api_hostname(api_hostname, default_client)) headers = { 'X-YouTube-Client-Name': str( self._ytcfg_get_safe(ytcfg, lambda x: x['INNERTUBE_CONTEXT_CLIENT_NAME...
should we exclude `400` too? since it usually means broken client config
visitor_data=None, api_hostname=None, default_client='web', **kwargs): origin = 'https://' + (self._select_api_hostname(api_hostname, default_client)) headers = { 'X-YouTube-Client-Name': str( self._ytcfg_get_safe(ytcfg, lambda x: x['INNERTUBE_CONTEXT_CLIENT_NAME...
@@ -857,6 +857,18 @@ def generate_api_headers( } return filter_dict(headers) + def _download_webpage_with_retries(self, *args, retry_fatal=False, retry_on_status=None, **kwargs): + for retry in self.RetryManager(fatal=retry_fatal): + try: + return self._download_w...
yt_dlp/extractor/youtube.py
26
Python
0.429
bug
72
51
51
false
[ie/youtube] Retry on more critical requests
12,339
yt-dlp/yt-dlp
132,642
Python
bashonly
coletdjnz
from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, decode_base_n, encode_base_n, filter_dict, float_or_none, format_field, get_element_by_attribute, int_or_none, lowercase_escape, str_or_none, str_to_int, ...
Not a big fan of doing the type checking/conversion inside the method. Can you give an example where we pass `media_id` as an `int`?
from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, decode_base_n, encode_base_n, filter_dict, float_or_none, format_field, get_element_by_attribute, int_or_none, lowercase_escape, str_or_none, str_to_int, ...
@@ -28,7 +28,8 @@ def _pk_to_id(media_id): """Source: https://stackoverflow.com/questions/24437823/getting-instagram-post-url-from-media-id""" - return encode_base_n(int(media_id.split('_')[0]), table=_ENCODING_CHARS) + pk = int(media_id.split('_')[0]) if type(media_id) is str else media_id + return en...
yt_dlp/extractor/instagram.py
26
Python
0.643
question
132
51
51
false
[ie/instagram] Add `app_id` extractor-arg
12,359
yt-dlp/yt-dlp
132,642
Python
bashonly
chrisellsworth
def _id_to_pk(shortcode): """Covert a shortcode to a numeric value""" return decode_base_n(shortcode[:11], table=_ENCODING_CHARS) class InstagramBaseIE(InfoExtractor): _NETRC_MACHINE = 'instagram' _IS_LOGGED_IN = False _API_BASE_URL = 'https://i.instagram.com/api/v1' _LOGIN_URL = 'https://ww...
this will overwrite the `Accept` header every time
def _id_to_pk(shortcode): """Covert a shortcode to a numeric value""" return decode_base_n(shortcode[:11], table=_ENCODING_CHARS) class InstagramBaseIE(InfoExtractor): _NETRC_MACHINE = 'instagram' _IS_LOGGED_IN = False _API_BASE_URL = 'https://i.instagram.com/api/v1' _LOGIN_URL = 'https://ww...
@@ -42,13 +43,23 @@ class InstagramBaseIE(InfoExtractor): _API_BASE_URL = 'https://i.instagram.com/api/v1' _LOGIN_URL = 'https://www.instagram.com/accounts/login' - _API_HEADERS = { - 'X-IG-App-ID': '936619743392459', - 'X-ASBD-ID': '198387', - 'X-IG-WWW-Claim': '0', - 'Origin...
yt_dlp/extractor/instagram.py
26
Python
0.357
suggestion
50
51
51
false
[ie/instagram] Add `app_id` extractor-arg
12,359
yt-dlp/yt-dlp
132,642
Python
bashonly
chrisellsworth
ExtractorError, decode_base_n, encode_base_n, filter_dict, float_or_none, format_field, get_element_by_attribute, int_or_none, lowercase_escape, str_or_none, str_to_int, traverse_obj, url_or_none, urlencode_postdata, ) _ENCODING_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXY...
Pretty sure `_id_to_pk` actually needs to be this or else it will convert incorrectly for private shortcodes from years ago ```diff def _id_to_pk(shortcode): - """Covert a shortcode to a numeric value""" + """Convert a shortcode to a numeric value""" + if len(shortcode) > 28: + shortcode = shortc...
ExtractorError, decode_base_n, encode_base_n, filter_dict, float_or_none, format_field, get_element_by_attribute, int_or_none, lowercase_escape, str_or_none, str_to_int, traverse_obj, url_or_none, urlencode_postdata, ) _ENCODING_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXY...
@@ -28,7 +28,8 @@ def _pk_to_id(media_id): """Source: https://stackoverflow.com/questions/24437823/getting-instagram-post-url-from-media-id""" - return encode_base_n(int(media_id.split('_')[0]), table=_ENCODING_CHARS) + pk = int(media_id.split('_')[0]) if type(media_id) is str else media_id + return en...
yt_dlp/extractor/instagram.py
26
Python
0.786
bug
461
51
51
false
[ie/instagram] Add `app_id` extractor-arg
12,359
yt-dlp/yt-dlp
132,642
Python
bashonly
chrisellsworth
) _ENCODING_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_' def _pk_to_id(media_id): """Source: https://stackoverflow.com/questions/24437823/getting-instagram-post-url-from-media-id""" pk = int(str(media_id).split('_')[0]) return encode_base_n(pk, table=_ENCODING_CHARS) def _...
- default value needs to be a list with 1 string element or else we are slicing the string - this is in the baseclass, so let's lock in the `ie_key` (or else we'd have to document `instagramstory:` etc) ```suggestion 'X-IG-App-ID': self._configuration_arg('app_id', ['936619743392459'], ie_key=InstagramIE...
) _ENCODING_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_' def _pk_to_id(media_id): """Source: https://stackoverflow.com/questions/24437823/getting-instagram-post-url-from-media-id""" pk = int(str(media_id).split('_')[0]) return encode_base_n(pk, table=_ENCODING_CHARS) def _...
@@ -42,13 +43,15 @@ class InstagramBaseIE(InfoExtractor): _API_BASE_URL = 'https://i.instagram.com/api/v1' _LOGIN_URL = 'https://www.instagram.com/accounts/login' - _API_HEADERS = { - 'X-IG-App-ID': '936619743392459', - 'X-ASBD-ID': '198387', - 'X-IG-WWW-Claim': '0', - 'Origin...
yt_dlp/extractor/instagram.py
26
Python
0.857
question
530
51
51
false
[ie/instagram] Add `app_id` extractor-arg
12,359
yt-dlp/yt-dlp
132,642
Python
bashonly
chrisellsworth
urlencode_postdata, ) _ENCODING_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_' def _pk_to_id(media_id): """Source: https://stackoverflow.com/questions/24437823/getting-instagram-post-url-from-media-id""" pk = int(str(media_id).split('_')[0]) return encode_base_n(pk, table=...
I'd prefer to do this, and then remove all the `()`s below ```suggestion @property def _api_headers(self): ```
urlencode_postdata, ) _ENCODING_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_' def _pk_to_id(media_id): """Source: https://stackoverflow.com/questions/24437823/getting-instagram-post-url-from-media-id""" pk = int(str(media_id).split('_')[0]) return encode_base_n(pk, table=...
@@ -42,13 +43,15 @@ class InstagramBaseIE(InfoExtractor): _API_BASE_URL = 'https://i.instagram.com/api/v1' _LOGIN_URL = 'https://www.instagram.com/accounts/login' - _API_HEADERS = { - 'X-IG-App-ID': '936619743392459', - 'X-ASBD-ID': '198387', - 'X-IG-WWW-Claim': '0', - 'Origin...
yt_dlp/extractor/instagram.py
26
Python
0.786
suggestion
122
51
51
false
[ie/instagram] Add `app_id` extractor-arg
12,359
yt-dlp/yt-dlp
132,642
Python
bashonly
chrisellsworth
from .common import InfoExtractor from .kaltura import KalturaIE from ..utils import ( ExtractorError, traverse_obj, ) class AZMedienIE(InfoExtractor): IE_DESC = 'AZ Medien videos' _VALID_URL = r'''(?x) https?:// (?:www\.|tv\.)? (?: ...
```suggestion [^/?#]+/ ```
from .common import InfoExtractor from .kaltura import KalturaIE from ..utils.traversal import require, traverse_obj class AZMedienIE(InfoExtractor): IE_DESC = 'AZ Medien videos' _VALID_URL = r'''(?x) https?:// (?:www\.|tv\.)? (?: ...
@@ -1,23 +1,25 @@ -import json - from .common import InfoExtractor from .kaltura import KalturaIE +from ..utils import ( + ExtractorError, + traverse_obj, +) class AZMedienIE(InfoExtractor): IE_DESC = 'AZ Medien videos' _VALID_URL = r'''(?x) https?:// ...
yt_dlp/extractor/azmedien.py
20
Python
0.571
suggestion
52
45
45
false
[ie/azmedien] Fix extractor
12,375
yt-dlp/yt-dlp
132,642
Python
bashonly
goggle
from .common import InfoExtractor from .kaltura import KalturaIE from ..utils import ( ExtractorError, traverse_obj, ) class AZMedienIE(InfoExtractor): IE_DESC = 'AZ Medien videos' _VALID_URL = r'''(?x) https?:// (?:www\.|tv\.)? (?: ...
```suggestion [^/?#]+-\d+ ```
from .common import InfoExtractor from .kaltura import KalturaIE from ..utils.traversal import require, traverse_obj class AZMedienIE(InfoExtractor): IE_DESC = 'AZ Medien videos' _VALID_URL = r'''(?x) https?:// (?:www\.|tv\.)? (?: ...
@@ -1,23 +1,25 @@ -import json - from .common import InfoExtractor from .kaltura import KalturaIE +from ..utils import ( + ExtractorError, + traverse_obj, +) class AZMedienIE(InfoExtractor): IE_DESC = 'AZ Medien videos' _VALID_URL = r'''(?x) https?:// ...
yt_dlp/extractor/azmedien.py
22
Python
0.571
suggestion
59
47
47
false
[ie/azmedien] Fix extractor
12,375
yt-dlp/yt-dlp
132,642
Python
bashonly
goggle
'ext': 'mp4', 'title': 'Bundesrats-Vakanzen / EU-Rahmenabkommen', 'uploader_id': 'TVOnline', 'upload_date': '20180930', 'timestamp': 1538328802, 'view_count': int, 'thumbnail': 'http://cfvod.kaltura.com/p/1719221/sp/171922100/thumbnail/...
just formatting ```suggestion data = self._search_json( r'window\.__APOLLO_STATE__\s*=', webpage, 'video data', display_id) ```
'upload_date': '20180930', 'timestamp': 1538328802, 'view_count': int, 'thumbnail': 'http://cfvod.kaltura.com/p/1719221/sp/171922100/thumbnail/entry_id/1_anruz3wy/version/100031', 'duration': 1930, }, 'params': { 'skip_download': Tr...
@@ -47,19 +49,22 @@ class AZMedienIE(InfoExtractor): 'url': 'https://www.telebaern.tv/telebaern-news/montag-1-oktober-2018-ganze-sendung-133531189#video=0_7xjo9lf1', 'only_matching': True, }] - _API_TEMPL = 'https://www.%s/api/pub/gql/%s/NewsArticleTeaser/a4016f65fe62b81dc6664dd9f4910e4ab40383...
yt_dlp/extractor/azmedien.py
26
Python
0.714
suggestion
159
37
29
false
[ie/azmedien] Fix extractor
12,375
yt-dlp/yt-dlp
132,642
Python
bashonly
goggle
'thumbnail': 'http://cfvod.kaltura.com/p/1719221/sp/171922100/thumbnail/entry_id/1_anruz3wy/version/100031', 'duration': 1930, }, 'params': { 'skip_download': True, }, }, { 'url': 'https://www.telebaern.tv/telebaern-news/montag-1-oktober-2018-ganze...
```suggestion entry_id = traverse_obj(data, ( lambda _, v: v['__typename'] == 'KalturaData', 'kalturaId', any, {require('kaltura id')})) ```
from .common import InfoExtractor from .kaltura import KalturaIE from ..utils.traversal import require, traverse_obj class AZMedienIE(InfoExtractor): IE_DESC = 'AZ Medien videos' _VALID_URL = r'''(?x) https?:// (?:www\.|tv\.)? (?: ...
@@ -47,19 +49,22 @@ class AZMedienIE(InfoExtractor): 'url': 'https://www.telebaern.tv/telebaern-news/montag-1-oktober-2018-ganze-sendung-133531189#video=0_7xjo9lf1', 'only_matching': True, }] - _API_TEMPL = 'https://www.%s/api/pub/gql/%s/NewsArticleTeaser/a4016f65fe62b81dc6664dd9f4910e4ab40383...
yt_dlp/extractor/azmedien.py
26
Python
0.857
suggestion
171
31
64
false
[ie/azmedien] Fix extractor
12,375
yt-dlp/yt-dlp
132,642
Python
bashonly
goggle
from .common import InfoExtractor from .kaltura import KalturaIE from ..utils import ( ExtractorError, traverse_obj, ) class AZMedienIE(InfoExtractor): IE_DESC = 'AZ Medien videos' _VALID_URL = r'''(?x) https?:// (?:www\.|tv\.)? (?: ...
```suggestion from ..utils.traversal import require, traverse_obj ```
from .common import InfoExtractor from .kaltura import KalturaIE from ..utils.traversal import require, traverse_obj class AZMedienIE(InfoExtractor): IE_DESC = 'AZ Medien videos' _VALID_URL = r'''(?x) https?:// (?:www\.|tv\.)? (?: ...
@@ -1,23 +1,25 @@ -import json - from .common import InfoExtractor from .kaltura import KalturaIE +from ..utils import ( + ExtractorError, + traverse_obj, +)
yt_dlp/extractor/azmedien.py
6
Python
0.571
suggestion
71
31
31
false
[ie/azmedien] Fix extractor
12,375
yt-dlp/yt-dlp
132,642
Python
bashonly
goggle
#!/usr/bin/env python3 # Allow direct execution import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from devscripts.utils import get_filename_args, write_file from yt_dlp.extractor import list_extractor_classes TEMPLATE = '''\ # Supported sites Below is a list of a...
```suggestion If a site is not listed here, it might still be supported by yt-dlp's embed extraction or generic extractor. ```
#!/usr/bin/env python3 # Allow direct execution import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from devscripts.utils import get_filename_args, write_file from yt_dlp.extractor import list_extractor_classes TEMPLATE = '''\ # Supported sites Below is a list of a...
@@ -10,10 +10,21 @@ from devscripts.utils import get_filename_args, write_file from yt_dlp.extractor import list_extractor_classes +TEMPLATE = '''\ +# Supported sites + +Below is a list of all extractors that are currently part of yt-dlp. +If a site is not listed here, it might still be supported by yt-dlp due to e...
devscripts/make_supportedsites.py
17
Python
0.786
refactor
128
32
32
false
[docs] Add note to `supportedsites.md`
12,382
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
#!/usr/bin/env python3 # Allow direct execution import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from devscripts.utils import get_filename_args, write_file from yt_dlp.extractor import list_extractor_classes TEMPLATE = '''\ # Supported sites Below is a list of a...
```suggestion Not all sites listed here are guaranteed to work; websites are constantly changing and sometimes this breaks yt-dlp's support for them. ```
#!/usr/bin/env python3 # Allow direct execution import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from devscripts.utils import get_filename_args, write_file from yt_dlp.extractor import list_extractor_classes TEMPLATE = '''\ # Supported sites Below is a list of a...
@@ -10,10 +10,21 @@ from devscripts.utils import get_filename_args, write_file from yt_dlp.extractor import list_extractor_classes +TEMPLATE = '''\ +# Supported sites + +Below is a list of all extractors that are currently part of yt-dlp. +If a site is not listed here, it might still be supported by yt-dlp due to e...
devscripts/make_supportedsites.py
18
Python
0.714
suggestion
155
32
32
false
[docs] Add note to `supportedsites.md`
12,382
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
#!/usr/bin/env python3 # Allow direct execution import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from devscripts.utils import get_filename_args, write_file from yt_dlp.extractor import list_extractor_classes TEMPLATE = '''\ # Supported sites Below is a list of a...
```suggestion Below is a list of all extractors that are currently included with yt-dlp. ```
#!/usr/bin/env python3 # Allow direct execution import os import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from devscripts.utils import get_filename_args, write_file from yt_dlp.extractor import list_extractor_classes TEMPLATE = '''\ # Supported sites Below is a list of a...
@@ -10,10 +10,21 @@ from devscripts.utils import get_filename_args, write_file from yt_dlp.extractor import list_extractor_classes +TEMPLATE = '''\ +# Supported sites + +Below is a list of all extractors that are currently part of yt-dlp.
devscripts/make_supportedsites.py
16
Python
0.643
refactor
94
32
32
false
[docs] Add note to `supportedsites.md`
12,382
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'tag_name': data['entry_data']['TagPage'][0]['graphql']['hashtag']['name'], } class InstagramStoryIE(InstagramBaseIE): _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/]+)(?:/(?P<id>\d+))?' IE_NAME = 'instagram:story' _TESTS = [{ 'url': 'htt...
Let's set a `display_id` var so we don't have to use `story_id or username` all over the place ```suggestion username, story_id = self._match_valid_url(url).group('user', 'id') display_id = story_id or username ```
'tag_name': data['entry_data']['TagPage'][0]['graphql']['hashtag']['name'], } class InstagramStoryIE(InstagramBaseIE): _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/?#]+)(?:/(?P<id>\d+))?' IE_NAME = 'instagram:story' _TESTS = [{ 'url': 'h...
@@ -699,23 +699,34 @@ class InstagramStoryIE(InstagramBaseIE): 'title': 'Rare', }, 'playlist_mincount': 50, + }, { + 'url': 'https://www.instagram.com/stories/fruits_zipper/3570766765028588805/', + 'only_matching': True, + }, { + 'url': 'https://www.instagram.co...
yt_dlp/extractor/instagram.py
26
Python
0.857
suggestion
234
51
51
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
} class InstagramStoryIE(InstagramBaseIE): _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/]+)(?:/(?P<id>\d+))?' IE_NAME = 'instagram:story' _TESTS = [{ 'url': 'https://www.instagram.com/stories/highlights/18090946048123978/', 'info_dict': { 'id': ...
```suggestion story_info = self._download_webpage(url, display_id) user_info = self._search_json(r'"user":', story_info, 'user info', display_id, fatal=False) ```
} class InstagramStoryIE(InstagramBaseIE): _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/?#]+)(?:/(?P<id>\d+))?' IE_NAME = 'instagram:story' _TESTS = [{ 'url': 'https://www.instagram.com/stories/highlights/18090946048123978/', 'info_dict': { 'id'...
@@ -699,23 +699,34 @@ class InstagramStoryIE(InstagramBaseIE): 'title': 'Rare', }, 'playlist_mincount': 50, + }, { + 'url': 'https://www.instagram.com/stories/fruits_zipper/3570766765028588805/', + 'only_matching': True, + }, { + 'url': 'https://www.instagram.co...
yt_dlp/extractor/instagram.py
26
Python
0.786
suggestion
181
51
51
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
'url': 'https://www.instagram.com/stories/highlights/18090946048123978/', 'info_dict': { 'id': '18090946048123978', 'title': 'Rare', }, 'playlist_mincount': 50, }, { 'url': 'https://www.instagram.com/stories/fruits_zipper/3570766765028588805/', ...
Let's move these two lines up before the webpage request; we should raise before making a pointless request
'url': 'https://www.instagram.com/stories/highlights/18090946048123978/', 'info_dict': { 'id': '18090946048123978', 'title': 'Rare', }, 'playlist_mincount': 50, }, { 'url': 'https://www.instagram.com/stories/fruits_zipper/3570766765028588805/', ...
@@ -699,23 +699,34 @@ class InstagramStoryIE(InstagramBaseIE): 'title': 'Rare', }, 'playlist_mincount': 50, + }, { + 'url': 'https://www.instagram.com/stories/fruits_zipper/3570766765028588805/', + 'only_matching': True, + }, { + 'url': 'https://www.instagram.co...
yt_dlp/extractor/instagram.py
26
Python
0.429
suggestion
107
51
51
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
user_id = traverse_obj(user_info, 'pk', 'id', expected_type=str) if username == 'highlights': story_info_url = f'highlight:{story_id}' if not story_id: # story id is only mandatory for highlights raise ExtractorError('Missing highlight id') else: ...
Not sure I like this; for users with an output template of `%(title)s.%(ext)s` this would be a breaking change... our autogenerated generic titles include id
user_info = self._search_json(r'"user":', story_info, 'user info', display_id, fatal=False) if not user_info: self.raise_login_required('This content is unreachable') user_id = traverse_obj(user_info, 'pk', 'id', expected_type=str) if username == 'highlights': st...
@@ -727,11 +738,15 @@ def _real_extract(self, url): highlights = traverse_obj(videos, (f'highlight:{story_id}', 'items'), (user_id, 'items')) info_data = [] for highlight in highlights: + highlight['title'] = story_title
yt_dlp/extractor/instagram.py
26
Python
0.571
suggestion
157
38
40
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
raise ExtractorError('Unable to extract user id') story_info_url = user_id videos = traverse_obj(self._download_json( f'{self._API_BASE_URL}/feed/reels_media/?reel_ids={story_info_url}', story_id or username, errnote=False, fatal=False, headers=self._API_HEAD...
since this is only for stories and not highlights, just `username` looks better in the output msgs IMO ```suggestion if username != 'highlights' and story_id and not self._yes_playlist(username, story_id): ```
if not user_id: # user id is only mandatory for non-highlights raise ExtractorError('Unable to extract user id') story_info_url = user_id videos = traverse_obj(self._download_json( f'{self._API_BASE_URL}/feed/reels_media/?reel_ids={story_info_url}', ...
@@ -727,11 +738,15 @@ def _real_extract(self, url): highlights = traverse_obj(videos, (f'highlight:{story_id}', 'items'), (user_id, 'items')) info_data = [] for highlight in highlights: + highlight['title'] = story_title highlight_data = self._extract_product(highlight...
yt_dlp/extractor/instagram.py
26
Python
0.857
suggestion
220
30
32
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
'only_matching': True, }, { 'url': 'https://www.instagram.com/stories/fruits_zipper', 'only_matching': True, }] def _real_extract(self, url): username, story_id = self._match_valid_url(url).groups() story_info = self._download_webpage(url, story_id or username) ...
```suggestion display_id, errnote=False, fatal=False, headers=self._API_HEADERS), 'reels') ```
'only_matching': True, }, { 'url': 'https://www.instagram.com/stories/fruits_zipper', 'only_matching': True, }] def _real_extract(self, url): username, story_id = self._match_valid_url(url).group('user', 'id') if username == 'highlights' and not story_id: # story id...
@@ -699,23 +699,34 @@ class InstagramStoryIE(InstagramBaseIE): 'title': 'Rare', }, 'playlist_mincount': 50, + }, { + 'url': 'https://www.instagram.com/stories/fruits_zipper/3570766765028588805/', + 'only_matching': True, + }, { + 'url': 'https://www.instagram.co...
yt_dlp/extractor/instagram.py
26
Python
0.714
suggestion
108
50
51
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
} class InstagramStoryIE(InstagramBaseIE): _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/]+)(?:/(?P<id>\d+))?' IE_NAME = 'instagram:story' _TESTS = [{ 'url': 'https://www.instagram.com/stories/highlights/18090946048123978/', 'info_dict': { 'id': ...
```suggestion raise ExtractorError('Input URL is missing a highlight ID', expected=True) ```
} class InstagramStoryIE(InstagramBaseIE): _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/?#]+)(?:/(?P<id>\d+))?' IE_NAME = 'instagram:story' _TESTS = [{ 'url': 'https://www.instagram.com/stories/highlights/18090946048123978/', 'info_dict': { 'id'...
@@ -699,23 +699,35 @@ class InstagramStoryIE(InstagramBaseIE): 'title': 'Rare', }, 'playlist_mincount': 50, + }, { + 'url': 'https://www.instagram.com/stories/fruits_zipper/3570766765028588805/', + 'only_matching': True, + }, { + 'url': 'https://www.instagram.co...
yt_dlp/extractor/instagram.py
26
Python
0.929
refactor
106
51
51
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
def _real_extract(self, url): username, story_id = self._match_valid_url(url).group('user', 'id') if username == 'highlights' and not story_id: # story id is only mandatory for highlights raise ExtractorError('Missing highlight id') display_id = story_id or username sto...
```suggestion user_info = traverse_obj(videos, (user_id, 'user', {dict})) or {} ```
def _real_extract(self, url): username, story_id = self._match_valid_url(url).group('user', 'id') if username == 'highlights' and not story_id: # story id is only mandatory for highlights raise ExtractorError('Input URL is missing a highlight ID', expected=True) display_id = st...
@@ -699,23 +699,35 @@ class InstagramStoryIE(InstagramBaseIE): 'title': 'Rare', }, 'playlist_mincount': 50, + }, { + 'url': 'https://www.instagram.com/stories/fruits_zipper/3570766765028588805/', + 'only_matching': True, + }, { + 'url': 'https://www.instagram.co...
yt_dlp/extractor/instagram.py
26
Python
0.643
suggestion
95
47
47
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
self.raise_login_required('This content is unreachable') user_id = traverse_obj(user_info, 'pk', 'id', expected_type=str) if username == 'highlights': story_info_url = f'highlight:{story_id}' else: if not user_id: # user id is only mandatory for non-highligh...
```suggestion highlight.setdefault('user', {}) highlight['user'].update(user_info) ```
self.raise_login_required('This content is unreachable') user_id = traverse_obj(user_info, 'pk', 'id', expected_type=str) if username == 'highlights': story_info_url = f'highlight:{story_id}' else: if not user_id: # user id is only mandatory for non-highligh...
@@ -727,11 +739,16 @@ def _real_extract(self, url): highlights = traverse_obj(videos, (f'highlight:{story_id}', 'items'), (user_id, 'items')) info_data = [] for highlight in highlights: + if user_info := traverse_obj(videos, (user_id, 'user')): + highlight['user'].up...
yt_dlp/extractor/instagram.py
26
Python
0.786
suggestion
113
38
38
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
'params': { 'extract_flat': True, 'skip_download': True, 'playlistend': 50, }, }] _QUERY_HASH = ('f92f56d47dc7a55b606908374b43a314',) @staticmethod def _parse_timeline_from(data): # extracts the media timeline data from a GraphQL result ...
```suggestion _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/?#]+)(?:/(?P<id>\d+))?' ```
'params': { 'extract_flat': True, 'skip_download': True, 'playlistend': 50, }, }] _QUERY_HASH = ('f92f56d47dc7a55b606908374b43a314',) @staticmethod def _parse_timeline_from(data): # extracts the media timeline data from a GraphQL result ...
@@ -689,7 +689,7 @@ def _query_vars_for(data): class InstagramStoryIE(InstagramBaseIE): - _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/]+)/(?P<id>\d+)' + _VALID_URL = r'https?://(?:www\.)?instagram\.com/stories/(?P<user>[^/]+)(?:/(?P<id>\d+))?'
yt_dlp/extractor/instagram.py
26
Python
0.786
suggestion
116
51
51
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
user_id = traverse_obj(user_info, 'pk', 'id', expected_type=str) if username == 'highlights': story_info_url = f'highlight:{story_id}' else: if not user_id: # user id is only mandatory for non-highlights raise ExtractorError('Unable to extract user id') ...
```suggestion highlight.setdefault('user', {}).update(user_info) ```
user_id = traverse_obj(user_info, 'pk', 'id', expected_type=str) if username == 'highlights': story_info_url = f'highlight:{story_id}' else: if not user_id: # user id is only mandatory for non-highlights raise ExtractorError('Unable to extract user id') ...
@@ -727,11 +740,16 @@ def _real_extract(self, url): highlights = traverse_obj(videos, (f'highlight:{story_id}', 'items'), (user_id, 'items')) info_data = [] for highlight in highlights: + highlight.setdefault('user', {}) + highlight['user'].update(user_info)
yt_dlp/extractor/instagram.py
26
Python
0.643
suggestion
82
38
37
false
[ie/instagram:story] Support `--no-playlist`
12,397
yt-dlp/yt-dlp
132,642
Python
bashonly
fireattack
def _pk_to_id(media_id): """Source: https://stackoverflow.com/questions/24437823/getting-instagram-post-url-from-media-id""" return encode_base_n(int(media_id.split('_')[0]), table=_ENCODING_CHARS) def _id_to_pk(shortcode): """Covert a shortcode to a numeric value""" return decode_base_n(shortcode[:1...
let's not keep dead code in the extractor
"""Source: https://stackoverflow.com/questions/24437823/getting-instagram-post-url-from-media-id""" pk = int(str(media_id).split('_')[0]) return encode_base_n(pk, table=_ENCODING_CHARS) def _id_to_pk(shortcode): """Convert a shortcode to a numeric value""" if len(shortcode) > 28: shortcode...
@@ -50,7 +52,7 @@ class InstagramBaseIE(InfoExtractor): 'Accept': '*/*', } - def _perform_login(self, username, password): + def _dont_perform_login(self, username, password): # Login is broken, disabling until it is fixed
yt_dlp/extractor/instagram.py
26
Python
0.143
refactor
41
51
51
false
[ie/instagram] Improve error handling
12,410
yt-dlp/yt-dlp
132,642
Python
seproDev
bashonly
'height': int_or_none(v.get('height')), 'fps': float_or_none(v.get('fps')), }) return { 'id': video_id, 'formats': formats, # Thumbnails are conveniently in the correct format already 'thumbnails': info.get('thumbnailLi...
revert this the regex pattern is not being changed so keep the diff minimal comment not necessary; the impersonation warning will raise if curl-cffi isn't present, and eventually we'll have a hatch testing env with curl-cffi ```suggestion ```
}) return { 'id': video_id, 'formats': formats, # Thumbnails are conveniently in the correct format already 'thumbnails': info.get('thumbnailList'), 'creator': info.get('author'), 'uploader_id': info.get('editor'), ...
@@ -100,8 +102,13 @@ def _real_extract(self, url): class WSJArticleIE(InfoExtractor): - _VALID_URL = r'(?i)https?://(?:www\.)?wsj\.com/articles/(?P<id>[^/?#&]+)' - _TEST = { + _VALID_URL = r'(?i)https?://(?:www\.)?wsj\.com/(?:articles|opinion)/(?P<id>[^/?#&]+)' + _WEBPAGE_RE = ( + re.compile(r'(...
yt_dlp/extractor/wsj.py
26
Python
0.857
suggestion
250
51
47
false
[ie/wsj] Support impersonation and opinion URLs
12,431
yt-dlp/yt-dlp
132,642
Python
bashonly
refack
# WSJ started using CloudFront's bot-wall, so this works iff there's a hydrated cookiejar _TESTS = [{ 'url': 'https://www.wsj.com/articles/dont-like-china-no-pandas-for-you-1490366939?', 'info_dict': { 'id': '4B13FA62-1D8C-45DB-8EA1-4105CB20B362', 'ext': 'mp4', ...
revert pt.2 ```suggestion video_id = self._search_regex( r'(?:id=["\']video|video-|iframe\.html\?guid=|data-src=["\'])([a-fA-F0-9-]{36})', webpage, 'video id') ```
from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, join_nonempty, unified_strdate, ) class WSJIE(InfoExtractor): _VALID_URL = r'''(?x) (?: https?://video-api\.wsj\.com/api-video/player/iframe\.html\?.*?\bguid=| ...
@@ -110,12 +117,19 @@ class WSJArticleIE(InfoExtractor): 'uploader_id': 'ralcaraz', 'title': 'Bao Bao the Panda Leaves for China', }, - } + }, { + 'url': 'https://www.wsj.com/opinion/hamas-hostages-caskets-bibas-family-israel-gaza-29da083b', + 'info_dict': { + ...
yt_dlp/extractor/wsj.py
26
Python
0.786
suggestion
200
28
131
false
[ie/wsj] Support impersonation and opinion URLs
12,431
yt-dlp/yt-dlp
132,642
Python
bashonly
refack
import re from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, join_nonempty, unified_strdate, ) class WSJIE(InfoExtractor): _VALID_URL = r'''(?x) (?: https?://video-api\.wsj\.com/api-video/player/iframe\.html\?.*?...
revert pt.3 ```suggestion from .common import InfoExtractor ```
from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, join_nonempty, unified_strdate, ) class WSJIE(InfoExtractor): _VALID_URL = r'''(?x) (?: https?://video-api\.wsj\.com/api-video/player/iframe\.html\?.*?\bguid=| ...
@@ -1,3 +1,5 @@ +import re + from .common import InfoExtractor
yt_dlp/extractor/wsj.py
3
Python
0.643
refactor
66
28
28
false
[ie/wsj] Support impersonation and opinion URLs
12,431
yt-dlp/yt-dlp
132,642
Python
bashonly
refack
}).encode(), headers=self._HEADERS) obj = resp['data'][object_type] if not obj: raise ExtractorError(resp['errors'][0]['message'], expected=True) return obj class DailymotionIE(DailymotionBaseInfoExtractor): _VALID_URL = r'''(?ix) https?:// ...
`[5:]` is a bit obscure? Maybe s/5/len('(?ix)')/ but constructing `_VALID_URL = f'(?ix){VALID_URL_TAIL}'` with the obvious definition of `_VALID_URL_TAIL` would be clearer. Or `re.sub(r'^\(\?[^)]*\)\s*', '', _VALID_URL)` would cater for any or no flag group (probably put that RE in utils as `FLAG_GROUP_RE`, say; and...
}).encode(), headers=self._HEADERS) obj = resp['data'][object_type] if not obj: raise ExtractorError(resp['errors'][0]['message'], expected=True) return obj class DailymotionIE(DailymotionBaseInfoExtractor): _VALID_URL = r'''(?ix) (?:https?:)?// ...
@@ -116,7 +116,7 @@ class DailymotionIE(DailymotionBaseInfoExtractor): (?P<id>[^/?_&#]+)(?:[\w-]*\?playlist=(?P<playlist_id>x[0-9a-z]+))? ''' IE_NAME = 'dailymotion' - _EMBED_REGEX = [r'<(?:(?:embed|iframe)[^>]+?src=|input[^>]+id=[\'"]dmcloudUrlEmissionSelect[\'"][^>]+value=)(["\'])(?P...
yt_dlp/extractor/dailymotion.py
26
Python
0.571
nitpick
389
51
51
false
[ie/Dailymotion] Improve embed detection
12,464
yt-dlp/yt-dlp
132,642
Python
dirkf
seproDev
}, ] _GRAPHQL_QUERY = ''' query AssetWatch($assetId: ID!) { assetV2(id: $assetId) { ...Asset episodes { ...Asset } } } fragment Asset on AssetV2 { id name ...
yt-dlp's graphql queries are intentionally kept as lean as possible. Don't add fields we aren't using in the extractor code ```suggestion descriptionLong year contentTypes directors mainCast productionCountries ```
'episode': 'Folge 3', 'episode_number': 3, 'id': '1112664', 'season': 'Season 1', 'season_number': 1, 'series': 'They all came out to Montreux', 'thumbnail': 're:https://playsuisse...
@@ -120,6 +120,16 @@ class PlaySuisseIE(InfoExtractor): id name description + descriptionLong + year + contentTypes + countries + composers + directors + writers + mainCast + product...
yt_dlp/extractor/playsuisse.py
26
Python
1
refactor
294
51
51
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
bashonly
v3DJG6GL
self.raise_login_required(method='password') media_id = self._match_id(url) query = parse_qs(url) locale_param = (query.get('locale') or ['de'])[0].lower() locale = locale_param if locale_param in {'de', 'fr', 'it', 'rm'} else 'de' media_data = self._get_media_data(m...
Keep the diff as minimal as possible, don't move the method down here for no reason. Also, is the (removed) comment no longer accurate?
})['id_token'] if not self._ID_TOKEN: raise ExtractorError('Login failed') def _get_media_data(self, media_id, locale=None): response = self._download_json( 'https://www.playsuisse.ch/api/graphql', media_id, data=json.dumps({ 'operati...
@@ -243,6 +242,17 @@ def _real_extract(self, url): }) return info + def _get_media_data(self, media_id, locale): + response = self._download_json( + 'https://www.playsuisse.ch/api/graphql', + media_id, data=json.dumps({ + 'operationName': 'AssetWatc...
yt_dlp/extractor/playsuisse.py
26
Python
0.429
question
135
51
51
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
bashonly
v3DJG6GL
'rememberMe': True, 'lat': '', 'lon': '', })).url)['code'][0] self._ID_TOKEN = self._download_json( f'{self._LOGIN_BASE}/proxy/token', None, 'Downloading token', data=b'', query={ 'client_id': self._CLIENT_ID, ...
```suggestion media_data = self._get_media_data(media_id, traverse_obj(parse_qs(url), ('locale', '0'), default='de')) ```
f'{self._LOGIN_BASE}/login-srv/verification/login', None, 'Logging in', data=urlencode_postdata({ 'requestId': request_id, 'exchange_id': login_data['exchange_id']['exchange_id'], 'verificationType': 'password', 'sub': login_data['s...
@@ -215,26 +225,15 @@ def _perform_login(self, username, password): if not self._ID_TOKEN: raise ExtractorError('Login failed') - def _get_media_data(self, media_id): - # NOTE In the web app, the "locale" header is used to switch between languages, - # However this doesn't seem ...
yt_dlp/extractor/playsuisse.py
26
Python
0.714
suggestion
131
51
51
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
bashonly
v3DJG6GL
def _extract_single(self, media_data): thumbnails = traverse_obj(media_data, lambda k, _: k.startswith('thumbnail')) formats, subtitles = [], {} for media in traverse_obj(media_data, 'medias', default=[]): if not media.get('url') or media.get('type') != 'HLS': c...
I would rewrite this using `traverse_obj`
info.update({ '_type': 'playlist', 'entries': map(self._extract_single, media_data['episodes']), }) return info def _extract_single(self, media_data): thumbnails = traverse_obj(media_data, lambda k, _: k.startswith('thumbnail')) forma...
@@ -259,7 +269,12 @@ def _extract_single(self, media_data): return { 'id': media_data['id'], 'title': media_data.get('name'), - 'description': media_data.get('description'), + 'description': media_data.get('descriptionLong') or media_data.get('description'), + ...
yt_dlp/extractor/playsuisse.py
26
Python
0.214
suggestion
41
33
40
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
bashonly
v3DJG6GL
for media in traverse_obj(media_data, 'medias', default=[]): if not media.get('url') or media.get('type') != 'HLS': continue f, subs = self._extract_m3u8_formats_and_subtitles( update_url_query(media['url'], {'id_token': self._ID_TOKEN}), m...
Something like this: ```py return { 'thumbnails': thumbnails, 'formats': formats, 'subtitles': subtitles, **traverse_obj(media_data, { 'id': ('id', {str}), 'title': ('name', {str}), 'description': (('descrip...
info = self._extract_single(media_data) if media_data.get('episodes'): info.update({ '_type': 'playlist', 'entries': map(self._extract_single, media_data['episodes']), }) return info def _extract_single(self, media_data): thumb...
@@ -257,15 +260,20 @@ def _extract_single(self, media_data): self._merge_subtitles(subs, target=subtitles) return { - 'id': media_data['id'], - 'title': media_data.get('name'), - 'description': media_data.get('description'), + 'id': traverse_obj(media_...
yt_dlp/extractor/playsuisse.py
26
Python
0.929
style
996
28
42
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
seproDev
v3DJG6GL
{ # Old URL 'url': 'https://www.playsuisse.ch/watch/763211/0', 'only_matching': True, }, { # episode in a series 'url': 'https://www.playsuisse.ch/watch/763182?episodeId=763211', 'md5': '82df2a470b2dfa60c2d33772a8a60cf8', ...
The old movie/URL was dead, I added an available movie. But since idk how this md5 is generated, i left it as it is: ``` 'md5': '818b94c1d2d7c4beef953f12cb8f3e75', ```
_VALID_URL = r'https?://(?:www\.)?playsuisse\.ch/(?:watch|detail)/(?:[^#]*[?&]episodeId=)?(?P<id>[0-9]+)' _TESTS = [ { # Old URL 'url': 'https://www.playsuisse.ch/watch/763211/0', 'only_matching': True, }, { # episode in a series ...
@@ -42,24 +42,33 @@ class PlaySuisseIE(InfoExtractor): }, }, { # film - 'url': 'https://www.playsuisse.ch/watch/808675', + 'url': 'https://www.playsuisse.ch/detail/2573198', 'md5': '818b94c1d2d7c4beef953f12cb8f3e75',
yt_dlp/extractor/playsuisse.py
26
Python
0.714
suggestion
171
51
51
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
v3DJG6GL
v3DJG6GL
'rememberMe': True, 'lat': '', 'lon': '', })).url)['code'][0] self._ID_TOKEN = self._download_json( f'{self._LOGIN_BASE}/proxy/token', None, 'Downloading token', data=b'', query={ 'client_id': self._CLIENT_ID, ...
```suggestion headers={'Content-Type': 'application/json', 'locale': locale or 'de'}) ```
'sub': login_data['sub'], 'status_id': login_data['status_id'], 'rememberMe': True, 'lat': '', 'lon': '', })).url)['code'][0] self._ID_TOKEN = self._download_json( f'{self._LOGIN_BASE}/proxy/token', None, 'D...
@@ -215,26 +230,23 @@ def _perform_login(self, username, password): if not self._ID_TOKEN: raise ExtractorError('Login failed') - def _get_media_data(self, media_id): - # NOTE In the web app, the "locale" header is used to switch between languages, - # However this doesn't seem ...
yt_dlp/extractor/playsuisse.py
26
Python
0.857
suggestion
105
51
51
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
bashonly
v3DJG6GL
'redirect_uri': 'https://www.playsuisse.ch/auth', 'code': authorization_code, 'code_verifier': code_verifier, 'grant_type': 'authorization_code', })['id_token'] if not self._ID_TOKEN: raise ExtractorError('Login failed') ...
```suggestion media_data = self._get_media_data(media_id, traverse_obj(parse_qs(url), ('locale', 0))) ```
f'{self._LOGIN_BASE}/proxy/token', None, 'Downloading token', data=b'', query={ 'client_id': self._CLIENT_ID, 'redirect_uri': 'https://www.playsuisse.ch/auth', 'code': authorization_code, 'code_verifier': code_verifier, 'grant_t...
@@ -215,26 +230,23 @@ def _perform_login(self, username, password): if not self._ID_TOKEN: raise ExtractorError('Login failed') - def _get_media_data(self, media_id): - # NOTE In the web app, the "locale" header is used to switch between languages, - # However this doesn't seem ...
yt_dlp/extractor/playsuisse.py
26
Python
0.714
suggestion
115
51
51
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
bashonly
v3DJG6GL
authorization_code = parse_qs(self._request_webpage( f'{self._LOGIN_BASE}/login-srv/verification/login', None, 'Logging in', data=urlencode_postdata({ 'requestId': request_id, 'exchange_id': login_data['exchange_id']['exchange_id'], 'verifi...
```suggestion def _get_media_data(self, media_id, locale=None): ```
raise ExtractorError('Invalid password', expected=True) authorization_code = parse_qs(self._request_webpage( f'{self._LOGIN_BASE}/login-srv/verification/login', None, 'Logging in', data=urlencode_postdata({ 'requestId': request_id, 'exchange_i...
@@ -215,26 +230,23 @@ def _perform_login(self, username, password): if not self._ID_TOKEN: raise ExtractorError('Login failed') - def _get_media_data(self, media_id): - # NOTE In the web app, the "locale" header is used to switch between languages, - # However this doesn't seem ...
yt_dlp/extractor/playsuisse.py
26
Python
0.571
suggestion
73
51
51
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
bashonly
v3DJG6GL
def _extract_single(self, media_data): thumbnails = traverse_obj(media_data, lambda k, _: k.startswith('thumbnail')) formats, subtitles = [], {} for media in traverse_obj(media_data, 'medias', default=[]): if not media.get('url') or media.get('type') != 'HLS': c...
```suggestion 'location': ('productionCountries', ..., {str}, all, {unpack(join_nonempty, delim='; ')}, filter), ``` and then above, import `join_nonempty` from `utils`, and: ```py from ..utils.traversal import unpack ```
'entries': map(self._extract_single, media_data['episodes']), }) return info def _extract_single(self, media_data): thumbnails = traverse_obj(media_data, lambda k, _: k.startswith('thumbnail')) formats, subtitles = [], {} for media in traverse_obj(media_...
@@ -257,15 +269,22 @@ def _extract_single(self, media_data): self._merge_subtitles(subs, target=subtitles) return { - 'id': media_data['id'], - 'title': media_data.get('name'), - 'description': media_data.get('description'), 'thumbnails': thumbnails,...
yt_dlp/extractor/playsuisse.py
26
Python
0.786
suggestion
245
35
38
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
bashonly
v3DJG6GL
for media in traverse_obj(media_data, 'medias', default=[]): if not media.get('url') or media.get('type') != 'HLS': continue f, subs = self._extract_m3u8_formats_and_subtitles( update_url_query(media['url'], {'id_token': self._ID_TOKEN}), m...
```suggestion 'episode': ('name', {str}, {lambda x: x if media_data['episodeNumber'] is not None else None}), ```
thumbnails = traverse_obj(media_data, lambda k, _: k.startswith('thumbnail')) formats, subtitles = [], {} for media in traverse_obj(media_data, 'medias', default=[]): if not media.get('url') or media.get('type') != 'HLS': continue f, subs = self._extract_...
@@ -257,15 +269,22 @@ def _extract_single(self, media_data): self._merge_subtitles(subs, target=subtitles) return { - 'id': media_data['id'], - 'title': media_data.get('name'), - 'description': media_data.get('description'), 'thumbnails': thumbnails,...
yt_dlp/extractor/playsuisse.py
26
Python
0.714
suggestion
131
30
33
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
bashonly
v3DJG6GL
return info def _extract_single(self, media_data): thumbnails = traverse_obj(media_data, lambda k, _: k.startswith('thumbnail')) formats, subtitles = [], {} for media in traverse_obj(media_data, 'medias', default=[]): if not media.get('url') or media.get('type') != 'HLS...
No, these 3 fields need to be a `list`, not `str`. `location` needs to be `str`, which is why I suggested the `join_nonempty` transformation there but not here. Revert and please re-run tests and update them again ```suggestion 'genres': ('contentTypes', ..., {str}), 'creators': ('dir...
return info def _extract_single(self, media_data): thumbnails = traverse_obj(media_data, lambda k, _: k.startswith('thumbnail')) formats, subtitles = [], {} for media in traverse_obj(media_data, 'medias', default=[]): if not media.get('url') or media.get('type') != 'HLS...
@@ -257,15 +272,22 @@ def _extract_single(self, media_data): self._merge_subtitles(subs, target=subtitles) return { - 'id': media_data['id'], - 'title': media_data.get('name'), - 'description': media_data.get('description'), 'thumbnails': thumbnails,...
yt_dlp/extractor/playsuisse.py
26
Python
0.929
suggestion
397
36
36
false
[ie/playsuisse] Improve metadata extraction
12,466
yt-dlp/yt-dlp
132,642
Python
bashonly
v3DJG6GL
'subtitles': { 'en': 'mincount:1', 'live_chat': 'mincount:1', }, }, }, { 'url': 'https://us.bbcollab.com/collab/ui/session/playback/load/76761522adfe4345a0dee6794bbcabda', 'only_matching': True, ...
No such comments. Code should be its own documentation. The same below.
'subtitles': { 'en': 'mincount:1', 'live_chat': 'mincount:1', }, }, }, { 'url': 'https://us.bbcollab.com/collab/ui/session/playback/load/76761522adfe4345a0dee6794bbcabda', 'only_matching': True, ...
@@ -43,21 +100,82 @@ class BlackboardCollaborateIE(InfoExtractor): ] def _real_extract(self, url): + # Prepare for requests
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.286
suggestion
71
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
flanter21
'url': 'https://ca.bbcollab.com/collab/ui/session/playback/load/b6399dcb44df4f21b29ebe581e22479d', 'only_matching': True, }, { 'url': 'https://eu.bbcollab.com/recording/51ed7b50810c4444a106e48cefb3e6b5', 'only_matching': True, }, { ...
- Looks like authorization is not always required, yes? Get token by `parse_qs()` and clean the headers dict by `filter_dict()`. - The `base_url` is used multiple times. Let's make a `_call_api` function to be more Object-Oriented.
'url': 'https://ca.bbcollab.com/collab/ui/session/playback/load/b6399dcb44df4f21b29ebe581e22479d', 'only_matching': True, }, { 'url': 'https://eu.bbcollab.com/recording/51ed7b50810c4444a106e48cefb3e6b5', 'only_matching': True, }, { ...
@@ -43,21 +100,82 @@ class BlackboardCollaborateIE(InfoExtractor): ] def _real_extract(self, url): + # Prepare for requests mobj = self._match_valid_url(url) region = mobj.group('region') video_id = mobj.group('id') - info = self._download_json( - f'https:...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.643
security
232
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
flanter21
if video_info := self._download_json(f'{base_url}/data/secure', video_id, 'Trying auth token', headers=headers, fatal=False): video_extra = self._download_json(f'{base_url}', video_id, 'Retrieving extra attributes', ...
Try to use more `traverse_obj()` and other util functions. For example: ```diff -duration = video_info.get('duration') / 1000 +duration = int_or_none(video_info.get('duration'), 1000) ``` . ```diff -stream_formats = [] -... -for current_stream in streams: +formats = traverse_obj(video_info, ('extStrea...
token = parse_qs(url).get('authToken', [None])[-1] video_info = self._call_api(region, video_id, path='data/secure', token=token, note='Trying auth token') if video_info: video_extra = self._call_api(region, video_id, token=token, note='Retrieving extra attributes') else: ...
@@ -43,21 +100,82 @@ class BlackboardCollaborateIE(InfoExtractor): ] def _real_extract(self, url): + # Prepare for requests mobj = self._match_valid_url(url) region = mobj.group('region') video_id = mobj.group('id') - info = self._download_json( - f'https:...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
1
suggestion
454
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
pzhlkj6612
flanter21
for cur_format in formats: cur_format['filesize'] = int_or_none(video_extra.get('storageSize')) subtitles = {} for current_subs in video_info.get('subtitles'): lang_code = current_subs.get('lang') subtitles.setdefault(lang_code, []).append({ '...
some other `only_matching` URLs would be nice to test/demonstrate the other possible subdomains ```suggestion _VALID_URL = r'https?://[a-z]+\.bbcollab\.com/launch/(?P<id>[^/?#]+)' ```
for subs in traverse_obj(video_info, ('subtitles', lambda _, v: url_or_none(v['url']))): subtitles.setdefault(subs.get('lang') or 'und', []).append({ 'name': traverse_obj(subs, ('label', {str})), 'url': subs['url'], }) for live_chat_url in travers...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.714
suggestion
190
42
48
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
for current_chat in video_info.get('chats'): subtitles.setdefault('live_chat', []).append({'url': url_or_none(current_chat['url'])}) return { 'duration': duration, 'formats': formats, 'id': video_id, 'timestamp': parse_iso8601(upload_date), ...
- use `..utils.jwt_decode_hs256` - it's ok to make this fatal since it's assumed the url isn't valid if the token doesn't decode (or doesn't decode into the expected json structure) ```suggestion token = self._match_id(url) video_id = jwt_decode_hs256(token)['resourceAccessTicket']['resourceId'] `...
'title': ('name', {str}), 'timestamp': ('created', {parse_iso8601}), 'duration': ('duration', {int_or_none(scale=1000)}), }), 'formats': formats, 'id': video_id, 'subtitles': subtitles, } class BlackboardCollaborat...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.857
suggestion
322
31
37
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
'duration': duration, 'formats': formats, 'id': video_id, 'timestamp': parse_iso8601(upload_date), 'subtitles': subtitles, 'title': title, } class BlackboardCollaborateLaunchIE(InfoExtractor): _VALID_URL = r'https?://[a-z]+\.bbcollab\...
```suggestion redirect_url = self._request_webpage(url, video_id).url if self.suitable(redirect_url): raise UnsupportedError(redirect_url) return self.url_result(redirect_url, BlackboardCollaborateIE, video_id) ```
'formats': formats, 'id': video_id, 'subtitles': subtitles, } class BlackboardCollaborateLaunchIE(InfoExtractor): _VALID_URL = r'https?://[a-z]+\.bbcollab\.com/launch/(?P<id>[^/?#]+)' _TESTS = [ { 'url': 'https://au.bbcollab.com/launch/eyJhbGciO...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.929
suggestion
255
27
33
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
import base64 import json from .common import InfoExtractor from ..utils import ( int_or_none, mimetype2ext, parse_iso8601, parse_qs, str_or_none, url_or_none, ) from ..utils.traversal import traverse_obj '''APIs references - Blackboard Learn: https://developer.blackboard.com/portal/displayApi...
It's not clear what "Blackboard Learn" is; if this is for a future PR please remove this and save it for the future PR I'd move the "Blackboard Collaborate" ref as a comment on the `_call_api` method
from .common import InfoExtractor from ..utils import ( UnsupportedError, float_or_none, int_or_none, join_nonempty, jwt_decode_hs256, mimetype2ext, parse_iso8601, parse_qs, url_or_none, ) from ..utils.traversal import traverse_obj class BlackboardCollaborateIE(InfoExtractor): ...
@@ -1,16 +1,31 @@ +import base64 +import json + from .common import InfoExtractor -from ..utils import parse_iso8601 +from ..utils import ( + int_or_none, + mimetype2ext, + parse_iso8601, + parse_qs, + str_or_none, + url_or_none, +) +from ..utils.traversal import traverse_obj + +'''APIs references - ...
yt_dlp/extractor/blackboardcollaborate.py
16
Python
0.643
refactor
202
41
41
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
from .common import InfoExtractor from ..utils import ( int_or_none, mimetype2ext, parse_iso8601, parse_qs, str_or_none, url_or_none, ) from ..utils.traversal import traverse_obj '''APIs references - Blackboard Learn: https://developer.blackboard.com/portal/displayApi - Blac...
I'd prefer to only use `parse_qs` to get the token. The `_VALID_URL` pattern is `re.match`ed, not `re.fullmatch`ed, so we don't need to include the token here ```suggestion (?P<id>[^/?#]+)''' ```
UnsupportedError, float_or_none, int_or_none, join_nonempty, jwt_decode_hs256, mimetype2ext, parse_iso8601, parse_qs, url_or_none, ) from ..utils.traversal import traverse_obj class BlackboardCollaborateIE(InfoExtractor): _VALID_URL = r'''(?x) https?:// ...
@@ -1,16 +1,31 @@ +import base64 +import json + from .common import InfoExtractor -from ..utils import parse_iso8601 +from ..utils import ( + int_or_none, + mimetype2ext, + parse_iso8601, + parse_qs, + str_or_none, + url_or_none, +) +from ..utils.traversal import traverse_obj + +'''APIs references - ...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.857
suggestion
222
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
'only_matching': True, }, { 'url': 'https://ca.bbcollab.com/collab/ui/session/playback/load/b6399dcb44df4f21b29ebe581e22479d', 'only_matching': True, }, { 'url': 'https://eu.bbcollab.com/recording/51ed7b50810c4444a106e48cefb3e6b5', ...
`parse_qs(url).get('authToken')` will return a list of string(s), not a string ```suggestion token = parse_qs(url).get('authToken', [None])[-1] ```
'only_matching': True, }, { 'url': 'https://eu.bbcollab.com/recording/51ed7b50810c4444a106e48cefb3e6b5', 'only_matching': True, }, { 'url': 'https://au.bbcollab.com/collab/ui/session/playback/load/2bccf7165d7c419ab87afc1ec3f3bb15', ...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.714
security
158
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
{ 'url': 'https://au.bbcollab.com/collab/ui/session/playback/load/2bccf7165d7c419ab87afc1ec3f3bb15', 'only_matching': True, }, ] def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): return self._download_j...
these should be inlined in the return, and use `traverse_obj`, e.g.: ```py return { **traverse_obj(video_info, { 'title': ('name', {str}), 'timestamp': ('created', {parse_iso8601}), 'duration': ('duration', {int_or_none(scale=1000)}), ...
] def _call_api(self, region, video_id, path=None, token=None, note=None, fatal=False): # Ref: https://github.com/blackboard/BBDN-Collab-Postman-REST return self._download_json( join_nonempty(f'https://{region}.bbcollab.com/collab/api/csa/recordings', video_id, path, delim='/'), ...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.857
suggestion
369
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}', video_id, note=note, ...
better to filter for the url in advance ```suggestion formats = traverse_obj(video_info, ('extStreams', lambda _, v: url_or_none(v['streamUrl']), { 'url': 'streamUrl', 'ext': ('contentType', {mimetype2ext}), 'aspect_ratio': ('aspectRatio', {float_or_none}), })) ...
video_id, note or 'Downloading JSON metadata', fatal=fatal, headers={'Authorization': f'Bearer {token}'} if token else None) def _real_extract(self, url): mobj = self._match_valid_url(url) region = mobj.group('region') video_id = mobj.group('id') token = pars...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
1
suggestion
324
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
headers={'Authorization': f'Bearer {token}'} if token else '', fatal=fatal) def _real_extract(self, url): mobj = self._match_valid_url(url) region = mobj.group('region') video_id = mobj.group('id') token = mobj.group('token') or parse_qs(url).get('...
Since `video_extra` is optional, let's only do this if we have a `filesize` value ```suggestion if filesize := traverse_obj(video_extract, ('storageSize', {int_or_none})): for fmt in formats: fmt['filesize'] = filesize ```
def _real_extract(self, url): mobj = self._match_valid_url(url) region = mobj.group('region') video_id = mobj.group('id') token = parse_qs(url).get('authToken', [None])[-1] video_info = self._call_api(region, video_id, path='data/secure', token=token, note='Trying auth token...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.857
refactor
263
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
if video_info := self._call_api(region, video_id, 'data/secure', token, 'Trying auth token'): video_extra = self._call_api(region, video_id, token=token, note='Retrieving extra attributes') else: video_info = self._call_api(region, video_id, 'data', note='Trying fallback', fatal...
- metadata/subtitles extraction should always strive to be non-fatal - avoid using `str_or_none` except when you actually want to stringify non-string data (e.g. `int`=>`str`) ```suggestion for subs in traverse_obj(video_info, ('subtitles', lambda _, v: url_or_none(v['url']))): subtitles.setdefa...
if video_info: video_extra = self._call_api(region, video_id, token=token, note='Retrieving extra attributes') else: video_info = self._call_api(region, video_id, path='data', note='Trying fallback', fatal=True) video_extra = {} formats = traverse_obj(video_i...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.857
refactor
468
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
video_info = self._call_api(region, video_id, 'data', note='Trying fallback', fatal=True) video_extra = {} duration = int_or_none(video_info.get('duration'), 1000) title = video_info.get('name') upload_date = video_info.get('created') formats = traverse_obj(vide...
```suggestion for live_chat_url in traverse_obj(video_info, ('chats', ..., 'url', {url_or_none})): subtitles.setdefault('live_chat', []).append({'url': live_chat_url}) ```
video_extra = {} formats = traverse_obj(video_info, ('extStreams', lambda _, v: url_or_none(v['streamUrl']), { 'url': 'streamUrl', 'ext': ('contentType', {mimetype2ext}), 'aspect_ratio': ('aspectRatio', {float_or_none}), })) if filesize := traver...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.714
suggestion
194
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
'live_chat': 'mincount:1', }, }, }, { 'url': 'https://us.bbcollab.com/collab/ui/session/playback/load/76761522adfe4345a0dee6794bbcabda', 'only_matching': True, }, { 'url': 'https://ca.bbcollab.com/collab/...
`headers` should always be a dict or `None` ```suggestion def _call_api(self, region, video_id, path=None, token=None, note=None, fatal=False): # Ref: https://github.com/blackboard/BBDN-Collab-Postman-REST return self._download_json( join_nonempty(f'https://{region}.bbcollab.com/col...
{ 'url': 'https://us.bbcollab.com/collab/ui/session/playback/load/76761522adfe4345a0dee6794bbcabda', 'only_matching': True, }, { 'url': 'https://ca.bbcollab.com/collab/ui/session/playback/load/b6399dcb44df4f21b29ebe581e22479d', 'only_matching': Tru...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.857
security
528
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
{ 'url': 'https://eu.bbcollab.com/recording/51ed7b50810c4444a106e48cefb3e6b5', 'only_matching': True, }, { 'url': 'https://au.bbcollab.com/collab/ui/session/playback/load/2bccf7165d7c419ab87afc1ec3f3bb15', 'only_matching': True, }, ] ...
I don't like using assignment expressions when the variable being assigned to is later used outside of the conditional ```suggestion video_info = self._call_api(region, video_id, path='data/secure', token=token, note='Trying auth token') if video_info: video_extra = self._call_api(region...
{ 'url': 'https://au.bbcollab.com/collab/ui/session/playback/load/2bccf7165d7c419ab87afc1ec3f3bb15', 'only_matching': True, }, ] def _call_api(self, region, video_id, path=None, token=None, note=None, fatal=False): # Ref: https://github.com/blackboard/BBDN-Collab...
@@ -42,22 +103,71 @@ class BlackboardCollaborateIE(InfoExtractor): }, ] + def _call_api(self, region, video_id, api_call='', token=None, note='Downloading JSON metadata', fatal=False): + return self._download_json(f'https://{region}.bbcollab.com/collab/api/csa/recordings/{video_id}/{api_call}'...
yt_dlp/extractor/blackboardcollaborate.py
26
Python
0.857
security
538
51
51
false
[ie/blackboardcollaborate] Support subtitles and authwalled videos
12,473
yt-dlp/yt-dlp
132,642
Python
bashonly
flanter21
'duration': 33.08, 'episode': '0', 'episode_id': '3179360900145', 'episode_number': 0, 'ext': 'mp4', 'id': 'pbs-pub-aa9397e9-ec2b-45f9-9148-7ce71b690b45$vid-04c67438-4866-4f5c-8978-51d173c0074b', 'release_timestamp': 1699160400, ...
All `/vrtnu/a-z` links are redirecting to `/vrtmax/a-z`, so if wanted I can fully remove support for those URLs as well
if has_credentials: self.cache.store(self._NETRC_MACHINE, 'token_data', (access_token, video_token)) return access_token, video_token def _get_vrt_cookie(self, cookie_name): # Refresh token cookie is scoped to /vrtmax/sso, others are scoped to / return try_call(lambda: ...
@@ -176,157 +279,154 @@ def _real_extract(self, url): } -class VrtNUIE(VRTBaseIE): +class VRTMAXIE(VRTMAXBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _NETRC_MACHINE = 'vrtmax' _TESTS = [{ - # CONTENT_IS_AGE_RESTRI...
yt_dlp/extractor/vrt.py
26
Python
0.571
suggestion
119
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
MichaelDeBoey
MichaelDeBoey
return formats, subtitles def _call_api(self, video_id, client='null', id_token=None, version='v2'): player_info = {'exp': (round(time.time(), 3) + 900), **self._PLAYER_INFO} vrt_player_token = self._download_json( f'https://media-services-public.vrt.be/vualto-video-aggregator-...
@bergoid's version used `f'https://media-services-public.vrt.be/vualto-video-aggregator-web/rest/external/{version}/videos/{video_id}',`, which seems to be the correct call that's made when looking at the Network tab ```suggestion f'https://media-services-public.vrt.be/vualto-video-aggregator-web/rest/e...
subtitles.setdefault('nl', []).append({'url': sub['url']}) return formats, subtitles def _call_api(self, video_id, client='null', id_token=None, version='v2'): player_info = {'exp': (round(time.time(), 3) + 900), **self._PLAYER_INFO} player_token = self._download_json( ...
@@ -89,24 +90,36 @@ def _extract_formats_and_subtitles(self, data, video_id): def _call_api(self, video_id, client='null', id_token=None, version='v2'): player_info = {'exp': (round(time.time(), 3) + 900), **self._PLAYER_INFO} - player_token = self._download_json( - 'https://media-serv...
yt_dlp/extractor/vrt.py
26
Python
0.857
suggestion
362
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
MichaelDeBoey
MichaelDeBoey
if login_data.get('errorCode'): raise ExtractorError(f'Login failed: {login_data.get("errorMessage")}', expected=True) self._download_webpage( login_data['redirectUrl'], None, note='Getting access token', errnote='Failed to get access token', ...
These don't really seem to be necessary ```suggestion ```
if not all((access_token, video_token, refresh_token)): raise ExtractorError('Unable to extract token cookie values') self.cache.store(self._NETRC_MACHINE, 'token_data', (access_token, video_token)) self.cache.store(self._NETRC_MACHINE, 'refresh_token', refresh_token) retur...
@@ -176,156 +189,257 @@ def _real_extract(self, url): } +def jwt_is_expired(token): + return jwt_decode_hs256(token)['exp'] - time.time() < 300 + + class VrtNUIE(VRTBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _VALID_URL ...
yt_dlp/extractor/vrt.py
26
Python
0.571
suggestion
61
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
MichaelDeBoey
MichaelDeBoey
elif code in ('CONTENT_AVAILABLE_ONLY_FOR_BE_RESIDENTS_AND_EXPATS', 'CONTENT_IS_AGE_RESTRICTED', 'CONTENT_REQUIRES_AUTHENTICATION'): self.raise_login_required() else: raise ExtractorError(f'Unable to extract formats: {code}') return { **self._...
In my previous version, `channel` was taken from `episode`'s `brand` instead of hard-coded `'VRT'`. Should we use `brand` instead? This will make sure that the actual TV channel is used instead of the generic `'VRT'`, which is actually the company name instead of the actual TV channel ```py **traverse_obj(metadata,...
**traverse_obj(metadata, ('episode', { 'title': ('title', {str}), 'description': ('description', {str}), 'timestamp': ('onTimeRaw', {parse_iso8601}), 'series': ('program', 'title', {str}), 'season': ('season', 'titleRaw', {str})...
@@ -176,156 +189,257 @@ def _real_extract(self, url): } +def jwt_is_expired(token): + return jwt_decode_hs256(token)['exp'] - time.time() < 300 + + class VrtNUIE(VRTBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _VALID_URL ...
yt_dlp/extractor/vrt.py
26
Python
0.857
suggestion
369
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
MichaelDeBoey
MichaelDeBoey
}).encode(), headers={ 'content-type': 'application/json', 'x-vrt-client-name': 'WEB', 'x-vrt-client-version': '1.5.9', 'x-vrt-zone': 'default', }, )['data']['page'] video_id = metadata['player']['modes'...
@bergoid's version also had `release_date`, `release_timestamp` & `upload_date`, so maybe we should add these as well? ```py **traverse_obj(metadata, { 'release_date': ('episode', 'onTimeRaw', {unified_strdate}), 'release_timestamp': ('episode', 'onTimeRaw', {parse_iso8601}), 'upload_date': ('episo...
video_id = metadata['player']['modes'][0]['streamId'] try: streaming_info = self._call_api(video_id, 'vrtnu-web@PROD', id_token=video_token) except ExtractorError as e: if not video_token and isinstance(e.cause, HTTPError) and e.cause.status == 404: self...
@@ -176,156 +189,257 @@ def _real_extract(self, url): } +def jwt_is_expired(token): + return jwt_decode_hs256(token)['exp'] - time.time() < 300 + + class VrtNUIE(VRTBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _VALID_URL ...
yt_dlp/extractor/vrt.py
26
Python
0.857
suggestion
366
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
MichaelDeBoey
MichaelDeBoey
asset_id = attrs.get('data-video-id') or attrs['data-videoid'] publication_id = traverse_obj(attrs, 'data-publication-id', 'data-publicationid') if publication_id: asset_id = f'{publication_id}${asset_id}' client = traverse_obj(attrs, 'data-client-code', 'data-client') or se...
All `/vrtnu/a-z` links are redirecting to `/vrtmax/a-z`, so maybe we can fully remove support for those URLs as well?
description = self._html_search_meta( ['og:description', 'twitter:description', 'description'], webpage) if description == '…': description = None return { 'id': asset_id, 'formats': formats, 'subtitles': subtitles, 'descri...
@@ -176,156 +189,257 @@ def _real_extract(self, url): } +def jwt_is_expired(token): + return jwt_decode_hs256(token)['exp'] - time.time() < 300 + + class VrtNUIE(VRTBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _VALID_URL ...
yt_dlp/extractor/vrt.py
26
Python
0.571
question
117
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
MichaelDeBoey
MichaelDeBoey
headers={ 'Content-Type': 'application/json', 'Oidcxsrf': self._get_cookies('https://login.vrt.be').get('OIDCXSRF').value, }, note='Logging in', errnote='Login failed', expected_status=403, ) if login_data.get('e...
VRT MAX seems to send requests to `/graphql/v1` ```suggestion 'https://www.vrt.be/vrtnu-api/graphql/v1', ```
self._request_webpage( login_data['redirectUrl'], None, note='Getting access token', errnote='Failed to get access token') access_token = self._get_vrt_cookie(self._ACCESS_TOKEN_COOKIE_NAME) video_token = self._get_vrt_cookie(self._VIDEO_TOKEN_COOKIE_NAME) refres...
@@ -176,156 +189,257 @@ def _real_extract(self, url): } +def jwt_is_expired(token): + return jwt_decode_hs256(token)['exp'] - time.time() < 300 + + class VrtNUIE(VRTBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _VALID_URL ...
yt_dlp/extractor/vrt.py
26
Python
0.714
suggestion
125
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
MichaelDeBoey
MichaelDeBoey
format_url, video_id, mpd_id=format_type, fatal=False) formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) elif format_type == 'HSS': fmts, subs = self._extract_ism_formats_and_subtitles( format_url, video...
Don't change the formatting here. The previous formatting was the desired way to write this https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#long-lines-policy
fmts, subs = self._extract_mpd_formats_and_subtitles( format_url, video_id, mpd_id=format_type, fatal=False) formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) elif format_type == 'HSS': fmts, subs = self._ex...
@@ -89,24 +90,36 @@ def _extract_formats_and_subtitles(self, data, video_id): def _call_api(self, video_id, client='null', id_token=None, version='v2'): player_info = {'exp': (round(time.time(), 3) + 900), **self._PLAYER_INFO} - player_token = self._download_json( - 'https://media-serv...
yt_dlp/extractor/vrt.py
26
Python
0.429
style
170
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
seproDev
MichaelDeBoey
data = self._call_api(asset_id, client) formats, subtitles = self._extract_formats_and_subtitles(data, asset_id) description = self._html_search_meta( ['og:description', 'twitter:description', 'description'], webpage) if description == '…': description = None ...
By convention ids are written first and usually extensions second. Do not change this order.
'formats': formats, 'subtitles': subtitles, 'description': description, 'thumbnail': url_or_none(attrs.get('data-posterimage')), 'duration': float_or_none(attrs.get('data-duration'), 1000), '_old_archive_ids': [make_archive_id('Canvas', asset_id)],...
@@ -176,156 +189,257 @@ def _real_extract(self, url): } +def jwt_is_expired(token): + return jwt_decode_hs256(token)['exp'] - time.time() < 300 + + class VrtNUIE(VRTBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _VALID_URL ...
yt_dlp/extractor/vrt.py
26
Python
0.286
style
92
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
seproDev
MichaelDeBoey
data = self._call_api(asset_id, client) formats, subtitles = self._extract_formats_and_subtitles(data, asset_id) description = self._html_search_meta( ['og:description', 'twitter:description', 'description'], webpage) if description == '…': description = None ...
Arguably this should be moved in to the `InfoExtractor` base class. Please do not move it out of `VrtNUIE`.
'formats': formats, 'subtitles': subtitles, 'description': description, 'thumbnail': url_or_none(attrs.get('data-posterimage')), 'duration': float_or_none(attrs.get('data-duration'), 1000), '_old_archive_ids': [make_archive_id('Canvas', asset_id)],...
@@ -176,156 +189,257 @@ def _real_extract(self, url): } +def jwt_is_expired(token):
yt_dlp/extractor/vrt.py
26
Python
0.571
refactor
107
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
seproDev
MichaelDeBoey
encoding=encoding, data=data) if content is False: assert not fatal return False return (content, urlh) @staticmethod def _guess_encoding_from_content(content_type, webpage_bytes): m = re.match(r'[a-zA-Z0-9_.-]+/[a-zA-...
Can we please keep this in `VrtNUIE`. Yes the function should be either in the InfoExtractor base class or utils, but that shouldn't be done as part of this extractor PR.
if content is False: assert not fatal return False return (content, urlh) @staticmethod def _guess_encoding_from_content(content_type, webpage_bytes): m = re.match(r'[a-zA-Z0-9_.-]+/[a-zA-Z0-9_.-]+\s*;\s*charset=(.+)', content_type) if m: enco...
@@ -994,6 +995,10 @@ def _guess_encoding_from_content(content_type, webpage_bytes): return encoding + @staticmethod + def _is_jwt_token_expired(token): + return jwt_decode_hs256(token)['exp'] - time.time() < 300
yt_dlp/extractor/common.py
26
Python
0.571
refactor
170
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
seproDev
MichaelDeBoey
refresh_token = self.cache.load(self._NETRC_MACHINE, 'refresh_token', default=None) if refresh_token and not self._is_jwt_token_expired(refresh_token): self.write_debug('Restored refresh token from cache') self._set_cookie('.www.vrt.be', 'vrtnu-site_profile_rt', refresh_token, p...
I noticed this doesn't actually work. Should be ```suggestion self._download_json( 'https://www.vrt.be/vrtmax/sso/refresh', None, note='Refreshing video token', errnote='Failed to refresh video token') ```
''' def _fetch_tokens(self): has_credentials = self._get_login_info()[0] access_token = self._get_vrt_cookie(self._ACCESS_TOKEN_COOKIE_NAME) video_token = self._get_vrt_cookie(self._VIDEO_TOKEN_COOKIE_NAME) if (access_token and not self._is_jwt_token_expired(access_token) ...
@@ -178,154 +178,224 @@ def _real_extract(self, url): class VrtNUIE(VRTBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' _TESTS = [{ - ...
yt_dlp/extractor/vrt.py
26
Python
0.857
bug
242
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
seproDev
MichaelDeBoey
}).encode(), headers={ 'Content-Type': 'application/json', 'Oidcxsrf': self._get_cookies('https://login.vrt.be').get('OIDCXSRF').value, }, note='Logging in', errnote='Login failed', expected_status=403) if login_data.get('errorCode'): raise Ext...
While this does work, the site uses the access token, not the refresh token. Is there any reason to not just always use the public api? i.e. do any videos exist for which metadata can not be fetched without an account?
if refresh_token and not self._is_jwt_token_expired(refresh_token): self.write_debug('Using refresh token from logged-in cookies; skipping login with credentials') return refresh_token = self.cache.load(self._NETRC_MACHINE, 'refresh_token', default=None) if refresh_token...
@@ -336,17 +336,19 @@ def _perform_login(self, username, password): def _real_extract(self, url): display_id = self._match_id(url) + refresh_token = self._fetch_refresh_token() metadata = self._download_json( - f'https://www.vrt.be/vrtnu-api/graphql{"" if self._fetch_refresh...
yt_dlp/extractor/vrt.py
26
Python
0.5
question
218
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
seproDev
MichaelDeBoey
formats.extend(self._extract_f4m_formats( format_url, video_id, f4m_id=format_type, fatal=False)) elif format_type == 'MPEG_DASH': fmts, subs = self._extract_mpd_formats_and_subtitles( format_url, video_id, mpd_id=format_type, fatal=Fal...
minimize diff ```suggestion player_token = self._download_json( ```
elif format_type == 'HDS': formats.extend(self._extract_f4m_formats( format_url, video_id, f4m_id=format_type, fatal=False)) elif format_type == 'MPEG_DASH': fmts, subs = self._extract_mpd_formats_and_subtitles( format_url, ...
@@ -89,23 +90,23 @@ def _extract_formats_and_subtitles(self, data, video_id): def _call_api(self, video_id, client='null', id_token=None, version='v2'): player_info = {'exp': (round(time.time(), 3) + 900), **self._PLAYER_INFO} - player_token = self._download_json( - 'https://media-serv...
yt_dlp/extractor/vrt.py
26
Python
0.571
suggestion
78
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
bashonly
MichaelDeBoey
}) for sub in traverse_obj(data, ('subtitleUrls', lambda _, v: v['url'] and v['type'] == 'CLOSED')): subtitles.setdefault('nl', []).append({'url': sub['url']}) return formats, subtitles def _call_api(self, video_id, client='null', id_token=None, version='v2'): ...
minimize diff ```suggestion 'vrtPlayerToken': player_token, 'client': client, ```
'url': format_url, }) for sub in traverse_obj(data, ('subtitleUrls', lambda _, v: v['url'] and v['type'] == 'CLOSED')): subtitles.setdefault('nl', []).append({'url': sub['url']}) return formats, subtitles def _call_api(self, video_id, client='null',...
@@ -89,23 +90,23 @@ def _extract_formats_and_subtitles(self, data, video_id): def _call_api(self, video_id, client='null', id_token=None, version='v2'): player_info = {'exp': (round(time.time(), 3) + 900), **self._PLAYER_INFO} - player_token = self._download_json( - 'https://media-serv...
yt_dlp/extractor/vrt.py
26
Python
0.714
suggestion
117
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
bashonly
MichaelDeBoey
'url': format_url, }) for sub in traverse_obj(data, ('subtitleUrls', lambda _, v: v['url'] and v['type'] == 'CLOSED')): subtitles.setdefault('nl', []).append({'url': sub['url']}) return formats, subtitles def _call_api(self, video_id, client='null',...
if this URL just redirects to the URL we were using in the old code, I would prefer to minimize the diff here too ```suggestion f'https://media-services-public.vrt.be/media-aggregator/{version}/media-items/{video_id}', ``` But I see there was some disagreement about doing that. IMO at the very least w...
'format_id': format_type, 'url': format_url, }) for sub in traverse_obj(data, ('subtitleUrls', lambda _, v: v['url'] and v['type'] == 'CLOSED')): subtitles.setdefault('nl', []).append({'url': sub['url']}) return formats, subtitles ...
@@ -89,23 +90,23 @@ def _extract_formats_and_subtitles(self, data, video_id): def _call_api(self, video_id, client='null', id_token=None, version='v2'): player_info = {'exp': (round(time.time(), 3) + 900), **self._PLAYER_INFO} - player_token = self._download_json( - 'https://media-serv...
yt_dlp/extractor/vrt.py
26
Python
0.857
suggestion
655
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
bashonly
MichaelDeBoey
'query': self._VIDEO_PAGE_QUERY, 'variables': {'pageId': urllib.parse.urlparse(url).path}, }).encode(), headers={ 'Authorization': f'Bearer {access_token}' if access_token else None, 'Content-Type': 'application/json', ...
```suggestion self.raise_geo_restricted(countries=['BE']) ```
if not all((access_token, video_token, refresh_token)): raise ExtractorError('Unable to extract token cookie values') self.cache.store(self._NETRC_MACHINE, 'token_data', (access_token, video_token)) self.cache.store(self._NETRC_MACHINE, 'refresh_token', refresh_token) retu...
@@ -178,154 +179,236 @@ def _real_extract(self, url): class VrtNUIE(VRTBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' _TESTS = [{ - ...
yt_dlp/extractor/vrt.py
26
Python
0.571
suggestion
79
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
bashonly
MichaelDeBoey
'Authorization': f'Bearer {access_token}' if access_token else None, 'Content-Type': 'application/json', 'x-vrt-client-name': 'WEB', 'x-vrt-client-version': '1.5.9', 'x-vrt-zone': 'default', })['data']['page'] video_id ...
```suggestion self.raise_no_formats(f'Unable to extract formats: {code}') ```
self.cache.store(self._NETRC_MACHINE, 'token_data', (access_token, video_token)) self.cache.store(self._NETRC_MACHINE, 'refresh_token', refresh_token) return access_token, video_token def _real_extract(self, url): display_id = self._match_id(url) access_token, video_token =...
@@ -178,154 +179,236 @@ def _real_extract(self, url): class VrtNUIE(VRTBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' _TESTS = [{ - ...
yt_dlp/extractor/vrt.py
26
Python
0.643
refactor
95
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
bashonly
MichaelDeBoey
raise ExtractorError(f'Login failed: {login_data.get("errorMessage")}', expected=True) self._download_webpage( login_data['redirectUrl'], None, note='Getting access token', errnote='Failed to get access token') self.cache.store( self._NETRC_MACHINE, 'tok...
We don't want to send `Authorization: None` ```suggestion headers=filter_dict{ 'Authorization': f'Bearer {access_token}' if access_token else None, ```
note='Getting session cookies', errnote='Failed to get session cookies') login_data = self._download_json( 'https://login.vrt.be/perform_login', None, data=json.dumps({ 'clientId': 'vrtnu-site', 'loginID': username, 'password': password, ...
@@ -178,154 +179,236 @@ def _real_extract(self, url): class VrtNUIE(VRTBaseIE): IE_DESC = 'VRT MAX' - _VALID_URL = r'https?://(?:www\.)?vrt\.be/vrtnu/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' + _VALID_URL = r'https?://(?:www\.)?vrt\.be/(?:vrtnu|vrtmax)/a-z/(?:[^/]+/){2}(?P<id>[^/?#&]+)' _TESTS = [{ - ...
yt_dlp/extractor/vrt.py
26
Python
0.714
security
183
51
51
false
[ie/VRTMax] Rework Extractor
12,479
yt-dlp/yt-dlp
132,642
Python
bashonly
MichaelDeBoey