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
'catchstory/a/view', video_id, headers={'Referer': url}, query={'aStoryListIdx': '', 'nStoryIdx': video_id}) return self.playlist_result(self._entries(data), video_id) @staticmethod def _entries(data): # 'files' is always a list with 1 element yield from travers...
support both domains ```suggestion _VALID_URL = r'https?://play\.(?:sooplive\.co\.kr|afreecatv\.com)/(?P<id>[^/?#]+)(?:/(?P<bno>\d+))?' ```
'gs_cdn_chromecast', # chromecast.stream.sooplive.co.kr (HTTP Error 400) 'azure_cdn', # live-global-cdn-v01.sooplive.co.kr (cannot resolve) 'aws_cf', # live-global-cdn-v03.sooplive.co.kr (cannot resolve) 'kt_cdn', # kt.stream.sooplive.co.kr (HTTP Error 400) ] def _extract_fo...
@@ -299,11 +299,11 @@ def _entries(data): class AfreecaTVLiveIE(AfreecaTVBaseIE): - IE_NAME = 'afreecatv:live' - IE_DESC = 'afreecatv.com livestreams' - _VALID_URL = r'https?://play\.afreeca(?:tv)?\.com/(?P<id>[^/]+)(?:/(?P<bno>\d+))?' + IE_NAME = 'soop:live' + IE_DESC = 'sooplive.co.kr livestreams'...
yt_dlp/extractor/afreecatv.py
26
Python
0.714
suggestion
146
51
51
false
[ie/afreecatv] Adapt extractors to sooplive.co.kr domain
11,266
yt-dlp/yt-dlp
132,642
Python
bashonly
63427083
elif result == -6: self.raise_login_required('This livestream is for subscribers only', method='password') raise ExtractorError('Unable to extract access token') formats = self._extract_formats(channel_info, broadcast_no, aid) station_info = traverse_obj(self._d...
support both domains ```suggestion _VALID_URL = r'https?://ch\.(?:sooplive\.co\.kr|afreecatv\.com)/(?P<id>[^/?#]+)/vods/?(?P<slug_type>[^/?#]+)?' ```
'playlist_count': 221, }, { 'url': 'https://ch.sooplive.co.kr/ryuryu24/vods/balloonclip', 'info_dict': { '_type': 'playlist', 'id': 'ryuryu24', 'title': 'ryuryu24 - balloonclip', }, 'playlist_count': 0, }] _PER_PAGE = 60 def _f...
@@ -420,34 +420,34 @@ def _real_extract(self, url): class AfreecaTVUserIE(InfoExtractor): - IE_NAME = 'afreecatv:user' - _VALID_URL = r'https?://bj\.afreeca(?:tv)?\.com/(?P<id>[^/]+)/vods/?(?P<slug_type>[^/]+)?' + IE_NAME = 'soop:user' + _VALID_URL = r'https?://ch\.sooplive\.co\.kr/(?P<id>[^/]+)/vods/?...
yt_dlp/extractor/afreecatv.py
26
Python
0.857
suggestion
156
51
27
false
[ie/afreecatv] Adapt extractors to sooplive.co.kr domain
11,266
yt-dlp/yt-dlp
132,642
Python
bashonly
63427083
-10: 'Sorry for the inconvenience. \nYour account has been blocked due to an unauthorized access. \nPlease contact our Help Center for assistance.', -32008: 'You have failed to log in. Please contact our Help Center.', } result = int_or_none(response.get('RESULT')) if re...
```suggestion (?:(?:live|afbbs|www)\.)?afreecatv\.com(?::\d+)? ```
-10: 'Sorry for the inconvenience. \nYour account has been blocked due to an unauthorized access. \nPlease contact our Help Center for assistance.', -32008: 'You have failed to log in. Please contact our Help Center.', } result = int_or_none(response.get('RESULT')) if re...
@@ -61,24 +61,24 @@ def _perform_login(self, username, password): def _call_api(self, endpoint, display_id, data=None, headers=None, query=None): return self._download_json(Request( - f'https://api.m.afreecatv.com/{endpoint}', + f'https://api.m.sooplive.co.kr/{endpoint}', ...
yt_dlp/extractor/afreecatv.py
26
Python
0.571
suggestion
96
51
51
false
[ie/afreecatv] Adapt extractors to sooplive.co.kr domain
11,266
yt-dlp/yt-dlp
132,642
Python
bashonly
63427083
IE_DESC = 'sooplive.co.kr' _VALID_URL = r'https?://vod\.(?:sooplive\.co\.kr|afreecatv\.com)/(?:PLAYER/STATION|player)/(?P<id>\d+)/?(?:$|[?#&])' _TESTS = [{ 'url': 'https://vod.sooplive.co.kr/player/96753363', 'info_dict': { 'id': '20230108_9FF5BEE1_244432674_1', 'ext'...
```suggestion 'thumbnail': r're:https?://(?:video|st)img\.sooplive\.co\.kr/.+', ```
IE_DESC = 'sooplive.co.kr' _VALID_URL = r'https?://vod\.(?:sooplive\.co\.kr|afreecatv\.com)/(?:PLAYER/STATION|player)/(?P<id>\d+)/?(?:$|[?#&])' _TESTS = [{ 'url': 'https://vod.sooplive.co.kr/player/96753363', 'info_dict': { 'id': '20230108_9FF5BEE1_244432674_1', 'ext'...
@@ -61,76 +61,40 @@ def _perform_login(self, username, password): def _call_api(self, endpoint, display_id, data=None, headers=None, query=None): return self._download_json(Request( - f'https://api.m.afreecatv.com/{endpoint}', + f'https://api.m.sooplive.co.kr/{endpoint}', ...
yt_dlp/extractor/afreecatv.py
26
Python
0.571
suggestion
97
51
51
false
[ie/afreecatv] Adapt extractors to sooplive.co.kr domain
11,266
yt-dlp/yt-dlp
132,642
Python
bashonly
63427083
}, }, { # non standard key 'url': 'http://vod.sooplive.co.kr/PLAYER/STATION/20515605', 'info_dict': { 'id': '20170411_BE689A0E_190960999_1_2_h', 'ext': 'mp4', 'title': '혼자사는여자집', 'thumbnail': 're:https?://(?:video|st)img\.sooplive\.co\....
```suggestion 'thumbnail': r're:https?://(?:video|st)img\.sooplive\.co\.kr/.+', ```
}, }, { # non standard key 'url': 'http://vod.sooplive.co.kr/PLAYER/STATION/20515605', 'info_dict': { 'id': '20170411_BE689A0E_190960999_1_2_h', 'ext': 'mp4', 'title': '혼자사는여자집', 'thumbnail': r're:https?://(?:video|st)img\.sooplive\.co\...
@@ -142,12 +106,12 @@ class AfreecaTVIE(AfreecaTVBaseIE): }, }, { # adult content - 'url': 'https://vod.afreecatv.com/player/97267690', + 'url': 'https://vod.sooplive.co.kr/player/97267690', 'info_dict': { 'id': '20180327_27901457_202289533_1', 'ex...
yt_dlp/extractor/afreecatv.py
26
Python
0.571
suggestion
97
51
51
false
[ie/afreecatv] Adapt extractors to sooplive.co.kr domain
11,266
yt-dlp/yt-dlp
132,642
Python
bashonly
63427083
'ext': video_format, }) return formats, subtitles def _real_extract(self, url): display_id, username = self._match_valid_url(url).group('id', 'username') webpage = self._download_webpage(url, display_id) webpage_info = self._parse_json(self._sea...
```suggestion # The redirected format URL expires but the original URL doesn't, # so we only want to extract the extension from this request fmt['ext'] = determine_ext(self._request_webpage( ```
'ext': video_format, }) return formats, subtitles def _real_extract(self, url): display_id, username = self._match_valid_url(url).group('id', 'username') webpage = self._download_webpage(url, display_id) webpage_info = self._parse_json(self._sea...
@@ -89,7 +108,13 @@ def _real_extract(self, url): post_type = webpage_info['post']['type'] formats, subtitles = [], {} if post_type == 'podcast': - formats, subtitles = [{'url': webpage_info['post']['podcast_url']}], {} + fmt = {'url': webpage_info['post']['podcast_url']...
yt_dlp/extractor/substack.py
26
Python
0.857
refactor
246
45
47
false
[ie/substack] Resolve podcast file extensions
11,275
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
'E.g. "gvsearch2:python" downloads two videos from google videos for the search term "python". ' 'Use the value "auto" to let yt-dlp guess ("auto_warning" to emit a warning when guessing). ' '"error" just throws an error. The default value "fixup_error" repairs broken URLs, ' ...
I think this should also sognify its internal state by having an underscore prefix ```suggestion dest='_plugin_locations', metavar='PATH', action='append', ```
'E.g. "gvsearch2:python" downloads two videos from google videos for the search term "python". ' 'Use the value "auto" to let yt-dlp guess ("auto_warning" to emit a warning when guessing). ' '"error" just throws an error. The default value "fixup_error" repairs broken URLs, ' ...
@@ -408,6 +408,10 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs): help=( 'Location of the main configuration file; either the path to the config or its containing directory ' '("-" for stdin). Can be used multiple times and inside other configuration files')) + ...
yt_dlp/options.py
26
Python
0.786
suggestion
170
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
Grub4K
imranh2
'E.g. "gvsearch2:python" downloads two videos from google videos for the search term "python". ' 'Use the value "auto" to let yt-dlp guess ("auto_warning" to emit a warning when guessing). ' '"error" just throws an error. The default value "fixup_error" repairs broken URLs, ' ...
I understand that the naming of this option was following the convention of `--ffmpeg-location`, `--netrc-location` and `--config-location`, but I think following that convention is wrong to do here. Those other three options allow the user to also specify the path to the **file**, not only the directory. Using the `-l...
'E.g. "gvsearch2:python" downloads two videos from google videos for the search term "python". ' 'Use the value "auto" to let yt-dlp guess ("auto_warning" to emit a warning when guessing). ' '"error" just throws an error. The default value "fixup_error" repairs broken URLs, ' ...
@@ -408,6 +408,10 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs): help=( 'Location of the main configuration file; either the path to the config or its containing directory ' '("-" for stdin). Can be used multiple times and inside other configuration files')) + ...
yt_dlp/options.py
26
Python
0.857
bug
630
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
'Use the value "auto" to let yt-dlp guess ("auto_warning" to emit a warning when guessing). ' '"error" just throws an error. The default value "fixup_error" repairs broken URLs, ' 'but emits an error if this is not possible instead of searching')) general.add_option( '--i...
Similarly, here we should clarify that the PATH **needs** to be a directory But more importantly: until the globals proposal is implemented, this option will only work with **extractor** plugins, and **not** postprocessor plugins (they are loaded too early). This needs to be documented in the help string for now ...
'Use the value "auto" to let yt-dlp guess ("auto_warning" to emit a warning when guessing). ' '"error" just throws an error. The default value "fixup_error" repairs broken URLs, ' 'but emits an error if this is not possible instead of searching')) general.add_option( '--i...
@@ -408,6 +408,10 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs): help=( 'Location of the main configuration file; either the path to the config or its containing directory ' '("-" for stdin). Can be used multiple times and inside other configuration files')) + ...
yt_dlp/options.py
26
Python
0.857
refactor
725
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
'plugin_locations': opts.plugin_locations, 'ffmpeg_location': opts.ffmpeg_location, 'hls_prefer_native': opts.hls_prefer_native, 'hls_use_mpegts': opts.hls_use_mpegts, 'hls_split_discontinuity': opts.hls_split_discontinuity, 'external_downloader_args': opts.external_downl...
```suggestion Config._plugin_locations = opts.plugin_dirs ```
'ffmpeg_location': opts.ffmpeg_location, 'hls_prefer_native': opts.hls_prefer_native, 'hls_use_mpegts': opts.hls_use_mpegts, 'hls_split_discontinuity': opts.hls_split_discontinuity, 'external_downloader_args': opts.external_downloader_args, 'postprocessor_args': opts.post...
@@ -967,6 +969,10 @@ def _real_main(argv=None): parser, opts, all_urls, ydl_opts = parse_options(argv) + # HACK: Set the plugins location early on + # TODO(coletdjnz): remove when plugin globals system is implemented + Config._plugin_locations = opts.plugin_locations
yt_dlp/__init__.py
26
Python
0.571
suggestion
67
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
'youtube_include_hls_manifest': opts.youtube_include_hls_manifest, 'encoding': opts.encoding, 'extract_flat': opts.extract_flat, 'live_from_start': opts.live_from_start, 'wait_for_video': opts.wait_for_video, 'mark_watched': opts.mark_watched, 'merge_output_format...
```suggestion 'plugin_dirs': opts.plugin_dirs, ```
'youtube_include_hls_manifest': opts.youtube_include_hls_manifest, 'encoding': opts.encoding, 'extract_flat': opts.extract_flat, 'live_from_start': opts.live_from_start, 'wait_for_video': opts.wait_for_video, 'mark_watched': opts.mark_watched, 'merge_output_format...
@@ -945,6 +946,7 @@ def parse_options(argv=None): 'xattr_set_filesize': opts.xattr_set_filesize, 'match_filter': opts.match_filter, 'color': opts.color, + 'plugin_locations': opts.plugin_locations,
yt_dlp/__init__.py
26
Python
0.571
suggestion
60
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
'youtube_include_hls_manifest': opts.youtube_include_hls_manifest, 'encoding': opts.encoding, 'extract_flat': opts.extract_flat, 'live_from_start': opts.live_from_start, 'wait_for_video': opts.wait_for_video, 'mark_watched': opts.mark_watched, 'merge_output_format...
```suggestion ``` as this is not a `YoutubeDL` opt
'youtube_include_hls_manifest': opts.youtube_include_hls_manifest, 'encoding': opts.encoding, 'extract_flat': opts.extract_flat, 'live_from_start': opts.live_from_start, 'wait_for_video': opts.wait_for_video, 'mark_watched': opts.mark_watched, 'merge_output_format...
@@ -945,6 +946,7 @@ def parse_options(argv=None): 'xattr_set_filesize': opts.xattr_set_filesize, 'match_filter': opts.match_filter, 'color': opts.color, + 'plugin_dirs': opts.plugin_dirs,
yt_dlp/__init__.py
26
Python
0.571
suggestion
54
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
coletdjnz
imranh2
import importlib import os import shutil import sys import unittest from pathlib import Path from yt_dlp import Config sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) TEST_DATA_DIR = Path(os.path.dirname(os.path.abspath(__file__)), 'testdata') sys.path.append(str(TEST_DATA_DIR)) importl...
should this be moved below where we import from `yt_dlp.plugins`?
import importlib import os import shutil import sys import unittest from pathlib import Path sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) TEST_DATA_DIR = Path(os.path.dirname(os.path.abspath(__file__)), 'testdata') sys.path.append(str(TEST_DATA_DIR)) importlib.invalidate_caches() fr...
@@ -4,6 +4,7 @@ import sys import unittest from pathlib import Path +from yt_dlp import Config
test/test_plugins.py
7
Python
0.429
question
65
32
32
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
DownloadCancelled, DownloadError, FormatSorter, GeoUtils, PlaylistEntries, SameFileError, decodeOption, download_range_func, expand_path, float_or_none, format_field, int_or_none, join_nonempty, match_filter_func, parse_bytes, parse_duration, preferred...
this needs to be moved up with the classes
DateRange, DownloadCancelled, DownloadError, FormatSorter, GeoUtils, PlaylistEntries, SameFileError, decodeOption, download_range_func, expand_path, float_or_none, format_field, int_or_none, join_nonempty, match_filter_func, parse_bytes, parse_duration...
@@ -62,6 +62,7 @@ traverse_obj, variadic, write_string, + Config,
yt_dlp/__init__.py
26
Python
0.143
suggestion
42
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
'"error" just throws an error. The default value "fixup_error" repairs broken URLs, ' 'but emits an error if this is not possible instead of searching')) general.add_option( '--ignore-config', '--no-config', action='store_true', dest='ignoreconfig', help=( ...
I dont like this wording. How about sth like "path to an additional plugin directory"/"path to an additional directory to search for plugins"?
'"error" just throws an error. The default value "fixup_error" repairs broken URLs, ' 'but emits an error if this is not possible instead of searching')) general.add_option( '--ignore-config', '--no-config', action='store_true', dest='ignoreconfig', help=( ...
@@ -408,6 +408,14 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs): help=( 'Location of the main configuration file; either the path to the config or its containing directory ' '("-" for stdin). Can be used multiple times and inside other configuration files')) + ...
yt_dlp/options.py
26
Python
0.357
question
142
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
Grub4K
imranh2
import importlib import os import shutil import sys import unittest from pathlib import Path sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) TEST_DATA_DIR = Path(os.path.dirname(os.path.abspath(__file__)), 'testdata') sys.path.append(str(TEST_DATA_DIR)) importlib.invalidate_caches() fr...
```suggestion from yt_dlp import Config from yt_dlp.plugins import PACKAGE_NAME, directories, load_plugins ```
import importlib import os import shutil import sys import unittest from pathlib import Path sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) TEST_DATA_DIR = Path(os.path.dirname(os.path.abspath(__file__)), 'testdata') sys.path.append(str(TEST_DATA_DIR)) importlib.invalidate_caches() fr...
@@ -10,7 +10,7 @@ sys.path.append(str(TEST_DATA_DIR)) importlib.invalidate_caches() -from yt_dlp.plugins import PACKAGE_NAME, directories, load_plugins +from yt_dlp.plugins import Config, PACKAGE_NAME, directories, load_plugins
test/test_plugins.py
13
Python
0.714
suggestion
113
38
38
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
plugins_pp = load_plugins('postprocessor', 'PP') self.assertIn('NormalPluginPP', plugins_pp.keys()) def test_importing_zipped_module(self): zip_path = TEST_DATA_DIR / 'zipped_plugins.zip' shutil.make_archive(str(zip_path)[:-4], 'zip', str(zip_path)[:-4]) sys.path.append(str(...
if we're renaming the `Config` var too, then let's go all out ```suggestion def test_plugin_dirs(self): ```
def test_postprocessor_classes(self): plugins_pp = load_plugins('postprocessor', 'PP') self.assertIn('NormalPluginPP', plugins_pp.keys()) def test_importing_zipped_module(self): zip_path = TEST_DATA_DIR / 'zipped_plugins.zip' shutil.make_archive(str(zip_path)[:-4], 'zip', str(zi...
@@ -68,6 +68,24 @@ def test_importing_zipped_module(self): os.remove(zip_path) importlib.invalidate_caches() # reset the import caches + def test_plugin_locations(self):
test/test_plugins.py
26
Python
0.714
suggestion
114
47
48
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
zip_path = TEST_DATA_DIR / 'zipped_plugins.zip' shutil.make_archive(str(zip_path)[:-4], 'zip', str(zip_path)[:-4]) sys.path.append(str(zip_path)) # add zip to search paths importlib.invalidate_caches() # reset the import caches try: for plugin_type in ('extractor',...
```suggestion # Internal plugin dirs hack for CLI --plugin-dirs # To be replaced with proper system later custom_plugin_dir = TEST_DATA_DIR / 'plugin_packages' Config._plugin_dirs = [str(custom_plugin_dir)] ```
def test_importing_zipped_module(self): zip_path = TEST_DATA_DIR / 'zipped_plugins.zip' shutil.make_archive(str(zip_path)[:-4], 'zip', str(zip_path)[:-4]) sys.path.append(str(zip_path)) # add zip to search paths importlib.invalidate_caches() # reset the import caches try: ...
@@ -68,6 +68,24 @@ def test_importing_zipped_module(self): os.remove(zip_path) importlib.invalidate_caches() # reset the import caches + def test_plugin_locations(self): + # Internal plugin locations hack for CLI --plugin-dirs + # To be replaced with proper system later + ...
test/test_plugins.py
26
Python
0.857
suggestion
247
43
44
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
try: for plugin_type in ('extractor', 'postprocessor'): package = importlib.import_module(f'{PACKAGE_NAME}.{plugin_type}') self.assertIn(zip_path / PACKAGE_NAME / plugin_type, map(Path, package.__path__)) plugins_ie = load_plugins('extractor', 'IE') ...
```suggestion self.assertIn(custom_plugin_dir / 'testpackage' / PACKAGE_NAME / 'extractor', map(Path, package.__path__)) ```
try: for plugin_type in ('extractor', 'postprocessor'): package = importlib.import_module(f'{PACKAGE_NAME}.{plugin_type}') self.assertIn(zip_path / PACKAGE_NAME / plugin_type, map(Path, package.__path__)) plugins_ie = load_plugins('extractor', 'IE') ...
@@ -68,6 +68,24 @@ def test_importing_zipped_module(self): os.remove(zip_path) importlib.invalidate_caches() # reset the import caches + def test_plugin_locations(self): + # Internal plugin locations hack for CLI --plugin-dirs + # To be replaced with proper system later + ...
test/test_plugins.py
26
Python
0.786
refactor
138
38
39
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
'xattr_set_filesize': opts.xattr_set_filesize, 'match_filter': opts.match_filter, 'color': opts.color, 'ffmpeg_location': opts.ffmpeg_location, 'hls_prefer_native': opts.hls_prefer_native, 'hls_use_mpegts': opts.hls_use_mpegts, 'hls_split_discontinuity': opts.hls_...
```suggestion # HACK: Set the plugin dirs early on ```
'xattr_set_filesize': opts.xattr_set_filesize, 'match_filter': opts.match_filter, 'color': opts.color, 'ffmpeg_location': opts.ffmpeg_location, 'hls_prefer_native': opts.hls_prefer_native, 'hls_use_mpegts': opts.hls_use_mpegts, 'hls_split_discontinuity': opts.hls_...
@@ -967,6 +968,10 @@ def _real_main(argv=None): parser, opts, all_urls, ydl_opts = parse_options(argv) + # HACK: Set the plugins location early on
yt_dlp/__init__.py
26
Python
0.571
suggestion
60
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
'--ignore-config', '--no-config', action='store_true', dest='ignoreconfig', help=( 'Don\'t load any more configuration files except those given to --config-locations. ' 'For backward compatibility, if this option is found inside the system configuration file, the user con...
I liked Grub's suggestion better ```suggestion help=( 'Path to an additional directory to search for plugins. ' 'Note that this currently only works for extractor plugins; ' 'postprocessor plugins can only be loaded from the default plugin directories. ' 'Th...
'--ignore-config', '--no-config', action='store_true', dest='ignoreconfig', help=( 'Don\'t load any more configuration files except those given to --config-locations. ' 'For backward compatibility, if this option is found inside the system configuration file, the user con...
@@ -408,6 +408,14 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs): help=( 'Location of the main configuration file; either the path to the config or its containing directory ' '("-" for stdin). Can be used multiple times and inside other configuration files')) + ...
yt_dlp/options.py
26
Python
0.857
refactor
392
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
def determine_file_encoding(data): """ Detect the text encoding used @returns (encoding, bytes to skip) """ # BOM marks are given priority over declarations for bom, enc in BOMS: if data.startswith(bom): return enc, len(bom) # Strip off all null bytes to match even whe...
```suggestion # Internal only, do not use! Hack to enable --plugin-dirs ```
def determine_file_encoding(data): """ Detect the text encoding used @returns (encoding, bytes to skip) """ # BOM marks are given priority over declarations for bom, enc in BOMS: if data.startswith(bom): return enc, len(bom) # Strip off all null bytes to match even whe...
@@ -4897,6 +4897,10 @@ class Config: filename = None __initialized = False + # Internal only, do not use! Hack to enable --plugin-dir
yt_dlp/utils/_utils.py
26
Python
0.643
suggestion
81
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
import importlib import os import shutil import sys import unittest from pathlib import Path sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) TEST_DATA_DIR = Path(os.path.dirname(os.path.abspath(__file__)), 'testdata') sys.path.append(str(TEST_DATA_DIR)) importlib.invalidate_caches() fr...
```suggestion from yt_dlp.utils import Config ```
import importlib import os import shutil import sys import unittest from pathlib import Path sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) TEST_DATA_DIR = Path(os.path.dirname(os.path.abspath(__file__)), 'testdata') sys.path.append(str(TEST_DATA_DIR)) importlib.invalidate_caches() fr...
@@ -10,6 +10,7 @@ sys.path.append(str(TEST_DATA_DIR)) importlib.invalidate_caches() +from yt_dlp import Config
test/test_plugins.py
13
Python
0.571
suggestion
51
38
38
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
'--ignore-config', '--no-config', action='store_true', dest='ignoreconfig', help=( 'Don\'t load any more configuration files except those given to --config-locations. ' 'For backward compatibility, if this option is found inside the system configuration file, the user con...
```suggestion 'This option can be used multiple times to add multiple directories. ' 'Note that this currently only works for extractor plugins; ' 'postprocessor plugins can only be loaded from the default plugin directories')) ```
'--ignore-config', '--no-config', action='store_true', dest='ignoreconfig', help=( 'Don\'t load any more configuration files except those given to --config-locations. ' 'For backward compatibility, if this option is found inside the system configuration file, the user con...
@@ -408,6 +408,14 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs): help=( 'Location of the main configuration file; either the path to the config or its containing directory ' '("-" for stdin). Can be used multiple times and inside other configuration files')) + ...
yt_dlp/options.py
26
Python
0.857
refactor
271
51
51
false
Add option for specifying plugins directories
11,277
yt-dlp/yt-dlp
132,642
Python
bashonly
imranh2
], [..., { 'id': 'name', 'data': 'content', 'url': 'url', }, all, {subs_list_to_dict}]) == { 'de': [{'url': 'https://example.com/subs/de.ass'}], 'en': [{'data': 'content'}], }, 'subs with mandatory items missing should be filtered' ...
do we want to change the test? we would no longer only be testing `subs_list_to_dict` if we do; we'd also be testing `partial_application` @Grub4K
}, all, {subs_list_to_dict}]) == { 'de': [{'url': 'https://example.com/subs/de.vtt'}], 'en': [ {'url': 'https://example.com/subs/en1.ass'}, {'url': 'https://example.com/subs/en2.ass'}, ], }, 'function should build subtitle dict from lis...
@@ -478,7 +478,7 @@ def test_subs_list_to_dict(self): {'url': 'https://example.com/subs/en', 'name': 'en'}, ], [..., { 'id': 'name', - 'ext': ['url', {lambda x: determine_ext(x, default_ext=None)}], + 'ext': ['url', {determine_ext(default_ext=None)}],
test/test_traversal.py
26
Python
0.571
question
150
51
51
false
[cleanup] Misc
11,347
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
format['video_ext'] = format['ext'] format['audio_ext'] = 'none' # if format.get('preference') is None and format.get('ext') in ('f4f', 'f4m'): # Not supported? # format['preference'] = -1000 if format.get('preference') is None and format.get('ext') == 'flv' and re.m...
This is a bit awkward, but the function is public so we need to keep compatibility this way
else: format['video_ext'] = format['ext'] format['audio_ext'] = 'none' # if format.get('preference') is None and format.get('ext') in ('f4f', 'f4m'): # Not supported? # format['preference'] = -1000 if format.get('preference') is None and format.get('ext') == ...
@@ -5613,6 +5614,8 @@ def calculate_preference(self, format): if not format.get('tbr'): format['tbr'] = try_call(lambda: format['vbr'] + format['abr']) or None + def calculate_preference(self, format): + self._fill_sorting_fields(format)
yt_dlp/utils/_utils.py
26
Python
0.214
suggestion
91
51
51
false
[core] Populate format sorting fields before dependent fields
11,353
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
description = traverse_obj(video_data, ('data', 'ongoing_ondemand', 'description', 'fin'), expected_type=str) subtitles = {} for sub in traverse_obj(video_data, ('data', 'ongoing_ondemand', 'subtitles', ...)): if url_or_none(sub.get('uri')): subtitles.setdefault(sub....
I'd do this, and then also set `is_live = False` before the `if is_podcast:` line up above, as well as returning `'is_live': is_live` in the info dict below ```suggestion if traverse_obj(video_data, ('data', 'ongoing_ondemand', 'manifest_url', {url_or_none})): manifest_url = video_data['d...
'episode': 'Episode 1', 'episode_number': 1, 'release_date': '20240607', 'release_timestamp': 1717736400, 'duration': 442, }, }, ] def _real_extract(self, url): video_id, is_podcast = self._match_valid_u...
@@ -114,8 +114,12 @@ def _real_extract(self, url): 'ie_key': KalturaIE.ie_key(), } else: + try: + ongoing = video_data['data']['ongoing_ondemand'] + except KeyError: + ongoing = video_data['data']['ongoing_event']
yt_dlp/extractor/yle_areena.py
26
Python
1
refactor
857
49
51
false
[ie/yle_areena] Fix live events
11,358
yt-dlp/yt-dlp
132,642
Python
bashonly
CounterPillow
subtitles = {} for sub in traverse_obj(video_data, ('data', 'ongoing_ondemand', 'subtitles', ...)): if url_or_none(sub.get('uri')): subtitles.setdefault(sub.get('language') or 'und', []).append({ 'url': sub['uri'], 'ext': 'srt', ...
```suggestion manifest_url, video_id, 'mp4', m3u8_id='hls', live=is_live) ```
'release_date': '20240607', 'release_timestamp': 1717736400, 'duration': 442, }, }, ] def _real_extract(self, url): video_id, is_podcast = self._match_valid_url(url).group('id', 'podcast') json_ld = self._search_json_ld(self._d...
@@ -114,8 +114,12 @@ def _real_extract(self, url): 'ie_key': KalturaIE.ie_key(), } else: + try: + ongoing = video_data['data']['ongoing_ondemand'] + except KeyError: + ongoing = video_data['data']['ongoing_event'] fo...
yt_dlp/extractor/yle_areena.py
26
Python
0.571
suggestion
95
47
51
false
[ie/yle_areena] Fix live events
11,358
yt-dlp/yt-dlp
132,642
Python
bashonly
CounterPillow
@classmethod @lru_cache def group_lookup(cls): result = { 'fd': cls.DOWNLOADER, 'ie': cls.EXTRACTOR, 'pp': cls.POSTPROCESSOR, 'upstream': cls.CORE, } result.update({item.name.lower(): item for item in iter(cls)}) return result ...
Added in version 3.10, has to be reverted. My bad
@classmethod @lru_cache def group_lookup(cls): result = { 'fd': cls.DOWNLOADER, 'ie': cls.EXTRACTOR, 'pp': cls.POSTPROCESSOR, 'upstream': cls.CORE, } result.update({item.name.lower(): item for item in iter(cls)}) return result ...
@@ -71,17 +71,16 @@ def group_lookup(cls): def get(cls, value: str) -> tuple[CommitGroup | None, str | None]: group, _, subgroup = (group.strip().lower() for group in value.partition('/')) - result = cls.group_lookup().get(group) - if not result: - if subgroup: - ...
devscripts/make_changelog.py
26
Python
0.071
suggestion
49
51
51
false
[devscripts] `make_changelog`: Parse full commit message for fixes
11,366
yt-dlp/yt-dlp
132,642
Python
Grub4K
bashonly
import json from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, clean_html, int_or_none, join_nonempty, parse_iso8601, str_or_none, url_or_none, ) from ..utils.traversal import traverse_obj class GameDevTVDashboardIE(InfoEx...
Imo. the extractor should support individual videos as well. Given that only the course api request is needed, I think a single extractor is fine. Just add an optional sub_id to the regex and, if present, only return a single video.
import json from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, clean_html, int_or_none, join_nonempty, parse_iso8601, str_or_none, url_or_none, ) from ..utils.traversal import traverse_obj class GameDevTVDashboardIE(InfoEx...
@@ -0,0 +1,108 @@ +import json + +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + int_or_none, + join_nonempty, + parse_iso8601, + str_or_none, + url_or_none, +) +from ..utils.traversal import traverse_obj + +...
yt_dlp/extractor/gamedevtv.py
18
Python
0.5
refactor
233
43
43
false
[ie/GameDevTV] Add extractor
11,368
yt-dlp/yt-dlp
132,642
Python
seproDev
stratus-ss
import json from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, clean_html, int_or_none, join_nonempty, parse_iso8601, str_or_none, url_or_none, ) from ..utils.traversal import traverse_obj class GameDevTVDashboardIE(InfoEx...
```suggestion _VALID_URL = r'https?://(?:www\.)?gamedev\.tv/dashboard/courses/(?P<course_id>\d+)(?:/(?P<lecture_id>\d+))?' ```
import json from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, clean_html, int_or_none, join_nonempty, parse_iso8601, str_or_none, url_or_none, ) from ..utils.traversal import traverse_obj class GameDevTVDashboardIE(InfoEx...
@@ -0,0 +1,108 @@ +import json + +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + int_or_none, + join_nonempty, + parse_iso8601, + str_or_none, + url_or_none, +) +from ..utils.traversal import traverse_obj + +...
yt_dlp/extractor/gamedevtv.py
18
Python
0.714
suggestion
132
43
43
false
[ie/GameDevTV] Add extractor
11,368
yt-dlp/yt-dlp
132,642
Python
seproDev
stratus-ss
lecture['video']['playListUrl'], display_id, 'mp4', m3u8_id='hls') yield { **course_info, **section_info, 'id': display_id, # fallback 'display_id': display_id, 'formats': formats, ...
```suggestion course_id, lecture_id = self._match_valid_url(url).group('course_id', 'lecture_id') ```
'password': password, 'cart_items': [], }).encode()) except ExtractorError as e: if isinstance(e.cause, HTTPError) and e.cause.status == 401: raise ExtractorError('Invalid username/password', expected=True) raise ...
@@ -0,0 +1,108 @@ +import json + +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + int_or_none, + join_nonempty, + parse_iso8601, + str_or_none, + url_or_none, +) +from ..utils.traversal import traverse_obj + +...
yt_dlp/extractor/gamedevtv.py
26
Python
0.714
suggestion
111
41
51
false
[ie/GameDevTV] Add extractor
11,368
yt-dlp/yt-dlp
132,642
Python
seproDev
stratus-ss
'description': ('description', {clean_html}), 'episode': ('title', {str}), 'episode_number': ('order', {int_or_none}), 'duration': ('video', 'duration_in_sec', {int_or_none}), 'timestamp': ('video', '...
```suggestion entries = self._entries(data, course_id, course_info, lecture_id) if lecture_id: lecture = next(entries, None) if not lecture: raise ExtractorError('Lecture not found') return lecture return self.playlist_result(entries, ...
def _entries(self, data, course_id, course_info, selected_lecture): for section in traverse_obj(data, ('sections', ..., {dict})): section_info = traverse_obj(section, { 'season_id': ('id', {str_or_none}), 'season': ('title', {str}), 'season_number...
@@ -0,0 +1,108 @@ +import json + +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + int_or_none, + join_nonempty, + parse_iso8601, + str_or_none, + url_or_none, +) +from ..utils.traversal import traverse_obj + +...
yt_dlp/extractor/gamedevtv.py
26
Python
1
refactor
350
27
51
false
[ie/GameDevTV] Add extractor
11,368
yt-dlp/yt-dlp
132,642
Python
seproDev
stratus-ss
lecture['video']['playListUrl'], display_id, 'mp4', m3u8_id='hls') yield { **course_info, **section_info, 'id': display_id, # fallback 'display_id': display_id, 'formats': formats, ...
```suggestion if lecture_id and str(lecture.get('id')) != lecture_id: continue display_id = join_nonempty(course_id, section_info.get('season_id'), lecture.get('id')) ```
'password': password, 'cart_items': [], }).encode()) except ExtractorError as e: if isinstance(e.cause, HTTPError) and e.cause.status == 401: raise ExtractorError('Invalid username/password', expected=True) raise ...
@@ -0,0 +1,108 @@ +import json + +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + int_or_none, + join_nonempty, + parse_iso8601, + str_or_none, + url_or_none, +) +from ..utils.traversal import traverse_obj + +...
yt_dlp/extractor/gamedevtv.py
26
Python
0.786
suggestion
226
41
51
false
[ie/GameDevTV] Add extractor
11,368
yt-dlp/yt-dlp
132,642
Python
seproDev
stratus-ss
}] _API_HEADERS = {} def _perform_login(self, username, password): try: response = self._download_json( 'https://api.gamedev.tv/api/students/login', None, 'Logging in', headers={'Content-Type': 'application/json'}, data=json.dumps({ ...
```suggestion def _entries(self, data, course_id, course_info, lecture_id): ```
}, { 'url': 'https://www.gamedev.tv/dashboard/courses/63/2279', 'info_dict': { 'id': 'df04f4d8-68a4-4756-a71b-9ca9446c3a01', 'ext': 'mp4', 'modified_timestamp': 1701695752, 'upload_date': '20230504', 'episode': 'MagicaVoxel Community Course...
@@ -0,0 +1,108 @@ +import json + +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + int_or_none, + join_nonempty, + parse_iso8601, + str_or_none, + url_or_none, +) +from ..utils.traversal import traverse_obj + +...
yt_dlp/extractor/gamedevtv.py
26
Python
0.571
suggestion
85
51
51
false
[ie/GameDevTV] Add extractor
11,368
yt-dlp/yt-dlp
132,642
Python
seproDev
stratus-ss
}] _API_HEADERS = {} def _perform_login(self, username, password): try: response = self._download_json( 'https://api.gamedev.tv/api/students/login', None, 'Logging in', headers={'Content-Type': 'application/json'}, data=json.dumps({ ...
```suggestion def _entries(self, data, course_id, course_info, selected_lecture): ```
}, { 'url': 'https://www.gamedev.tv/dashboard/courses/63/2279', 'info_dict': { 'id': 'df04f4d8-68a4-4756-a71b-9ca9446c3a01', 'ext': 'mp4', 'modified_timestamp': 1701695752, 'upload_date': '20230504', 'episode': 'MagicaVoxel Community Course...
@@ -56,14 +56,16 @@ def _real_initialize(self): self.raise_login_required( 'This content is only available with purchase', method='password') - def _entries(self, data, course_id, course_info): + def _entries(self, data, course_id, course_info, lecture_id):
yt_dlp/extractor/gamedevtv.py
26
Python
0.571
suggestion
91
51
51
false
[ie/GameDevTV] Add extractor
11,368
yt-dlp/yt-dlp
132,642
Python
bashonly
stratus-ss
data=json.dumps({ 'email': username, 'password': password, 'cart_items': [], }).encode()) except ExtractorError as e: if isinstance(e.cause, HTTPError) and e.cause.status == 401: raise Extract...
```suggestion if selected_lecture and str(lecture.get('id')) != selected_lecture: ```
'series_id': '63', 'title': 'MagicaVoxel Community Course Introduction', 'timestamp': 1683195397, 'modified_date': '20231204', 'categories': ['3D Art', 'MagicaVoxel'], 'season': 'MagicaVoxel Community Course', 'tags': ['MagicaVoxel', 'a...
@@ -56,14 +56,16 @@ def _real_initialize(self): self.raise_login_required( 'This content is only available with purchase', method='password') - def _entries(self, data, course_id, course_info): + def _entries(self, data, course_id, course_info, lecture_id): for section in ...
yt_dlp/extractor/gamedevtv.py
26
Python
0.714
suggestion
103
51
51
false
[ie/GameDevTV] Add extractor
11,368
yt-dlp/yt-dlp
132,642
Python
bashonly
stratus-ss
import urllib.parse from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, float_or_none, int_or_none, parse_age_limit, url_or_none, urlencode_postdata, ) from ..utils.traversal import traverse_obj class AtresPlayerIE(InfoExtracto...
```suggestion _VALID_URL = r'https?://(?:www\.)?atresplayer\.com/(?:[^/?#]+/){4}(?P<display_id>.+?)_(?P<id>[0-9a-f]{24})' ```
import urllib.parse from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, int_or_none, parse_age_limit, url_or_none, urlencode_postdata, ) from ..utils.traversal import traverse_obj class AtresPlayerIE(InfoExtractor): _VALID_URL ...
@@ -1,64 +1,108 @@ +import urllib.parse + from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, + float_or_none, int_or_none, + parse_age_limit, + url_or_none, urlencode_postdata, ) +from ..utils.traversal import traverse_obj ...
yt_dlp/extractor/atresplayer.py
17
Python
0.714
suggestion
131
42
42
false
[ie/AtresPlayer] Rework extractor
11,424
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) return { 'display_id': display_id, 'id': video_id, 'formats': formats, 'subtitles': subtitles, **traverse_obj(video_data, { 'title': ('titulo', ...
```suggestion 'timestamp': ('publicationDate', {int_or_none(scale=1000)}), ```
return { 'display_id': display_id, 'id': video_id, 'formats': formats, 'subtitles': subtitles, **traverse_obj(video_data, { 'title': ('titulo', {str}), 'description': ('descripcion', {str}), 'duration': (...
@@ -67,37 +111,45 @@ def _real_extract(self, url): raise ExtractorError(error['error_description'], expected=True) raise - title = episode['titulo'] - formats = [] subtitles = {} - for source in episode.get('sources', []): - src = source.get('sr...
yt_dlp/extractor/atresplayer.py
26
Python
0.571
suggestion
96
30
27
false
[ie/AtresPlayer] Rework extractor
11,424
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
'channel': 'Flooxer', 'duration': 1196, 'thumbnail': 'https://imagenes.atresplayer.com/atp/clipping/cmsimages01/2025/02/14/17CF90D3-FE67-40C5-A941-7825B3E13992/1920x1080.jpg', 'tags': ['Juvenil', 'Terror', 'Piel de gallina', 'Te sigo', 'Un break', 'Del tirón'], ...
```suggestion 'Logging in', 'Failed to log in', data=urlencode_postdata({ ```
'duration': 1196, 'thumbnail': 'https://imagenes.atresplayer.com/atp/clipping/cmsimages01/2025/02/14/17CF90D3-FE67-40C5-A941-7825B3E13992/1920x1080.jpg', 'tags': ['Juvenil', 'Terror', 'Piel de gallina', 'Te sigo', 'Un break', 'Del tirón'], 'series': 'BIARA: Proyecto Lázar...
@@ -1,64 +1,108 @@ +import urllib.parse + from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, + float_or_none, int_or_none, + parse_age_limit, + url_or_none, urlencode_postdata, ) +from ..utils.traversal import traverse_obj ...
yt_dlp/extractor/atresplayer.py
26
Python
0.571
bug
95
51
51
false
[ie/AtresPlayer] Rework extractor
11,424
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
'only_matching': True, }] _API_BASE = 'https://api.atresplayer.com/' def _perform_login(self, username, password): try: self._download_webpage( 'https://account.atresplayer.com/auth/v1/login', None, 'Logging in', data=urlencode_postdata({ ...
```suggestion metadata_url = self._download_json( self._API_BASE + 'client/v1/url', video_id, 'Downloading API endpoint data', query={'href': urllib.parse.urlparse(url).path})['href'] metadata = self._download_json(metadata_url, video_id) ```
}] _API_BASE = 'https://api.atresplayer.com/' def _perform_login(self, username, password): try: self._download_webpage( 'https://account.atresplayer.com/auth/v1/login', None, 'Logging in', 'Failed to log in', data=urlencode_postdata({ ...
@@ -1,64 +1,108 @@ +import urllib.parse + from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, + float_or_none, int_or_none, + parse_age_limit, + url_or_none, urlencode_postdata, ) +from ..utils.traversal import traverse_obj ...
yt_dlp/extractor/atresplayer.py
26
Python
0.786
suggestion
287
51
51
false
[ie/AtresPlayer] Rework extractor
11,424
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
def _perform_login(self, username, password): try: self._download_webpage( 'https://account.atresplayer.com/auth/v1/login', None, 'Logging in', data=urlencode_postdata({ 'username': username, 'password': password, ...
```suggestion video_data = self._download_json(metadata['urlVideo'], video_id, 'Downloading video data') ```
def _perform_login(self, username, password): try: self._download_webpage( 'https://account.atresplayer.com/auth/v1/login', None, 'Logging in', 'Failed to log in', data=urlencode_postdata({ 'username': username, 'password': ...
@@ -1,64 +1,108 @@ +import urllib.parse + from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, + float_or_none, int_or_none, + parse_age_limit, + url_or_none, urlencode_postdata, ) +from ..utils.traversal import traverse_obj ...
yt_dlp/extractor/atresplayer.py
26
Python
0.714
suggestion
122
51
51
false
[ie/AtresPlayer] Rework extractor
11,424
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
if profile is None: search_root = config['browser_dir'] elif _is_path(profile): search_root = profile config['browser_dir'] = os.path.dirname(profile) if config['supports_profiles'] else profile else: if config['supports_profiles']: search_root = os.path.join(con...
```suggestion # meta_version is necessary to determine if we need to trim the hash prefix from the cookies # Ref: https://github.com/yt-dlp/yt-dlp/issues/6564#issuecomment-2428437307 meta_version = int(cursor.execute('SELECT value FROM meta WHERE key = "version"').fetchone()[0]) ...
if profile is None: search_root = config['browser_dir'] elif _is_path(profile): search_root = profile config['browser_dir'] = os.path.dirname(profile) if config['supports_profiles'] else profile else: if config['supports_profiles']: search_root = os.path.join(con...
@@ -302,12 +302,16 @@ def _extract_chrome_cookies(browser_name, profile, keyring, logger): raise FileNotFoundError(f'could not find {browser_name} cookies database in "{search_root}"') logger.debug(f'Extracting cookies from: "{cookie_database_path}"') - decryptor = get_cookie_decryptor(config['browse...
yt_dlp/cookies.py
26
Python
0.786
suggestion
323
51
51
false
[cookies] Support chrome table version 24
11,425
yt-dlp/yt-dlp
132,642
Python
bashonly
kesor
config = _get_chromium_based_browser_settings(browser_name) if profile is None: search_root = config['browser_dir'] elif _is_path(profile): search_root = profile config['browser_dir'] = os.path.dirname(profile) if config['supports_profiles'] else profile else: if config[...
```suggestion # Ref: https://chromium.googlesource.com/chromium/src/+/b02dcebd7cafab92770734dc2bc317bd07f1d891/net/extras/sqlite/sqlite_persistent_cookie_store.cc#223 ```
config = _get_chromium_based_browser_settings(browser_name) if profile is None: search_root = config['browser_dir'] elif _is_path(profile): search_root = profile config['browser_dir'] = os.path.dirname(profile) if config['supports_profiles'] else profile else: if config[...
@@ -302,12 +302,18 @@ def _extract_chrome_cookies(browser_name, profile, keyring, logger): raise FileNotFoundError(f'could not find {browser_name} cookies database in "{search_root}"') logger.debug(f'Extracting cookies from: "{cookie_database_path}"') - decryptor = get_cookie_decryptor(config['browse...
yt_dlp/cookies.py
26
Python
0.714
suggestion
184
51
51
false
[cookies] Support chrome table version 24
11,425
yt-dlp/yt-dlp
132,642
Python
seproDev
kesor
data = bytes_to_intlist(self.secret_msg) encrypted = intlist_to_bytes(aes_ctr_encrypt(data, self.key, self.iv)) self.assertEqual( encrypted, b'\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xaf\x08') def test_gcm_decrypt(self): data = b'\x159Y\xcf...
This should maybe be removed? Its probably a relic from before we had a shim? EDIT: Maybe its to not run the same function tests twice, ignore this
data = bytes_to_intlist(self.secret_msg) encrypted = intlist_to_bytes(aes_ctr_encrypt(data, self.key, self.iv)) self.assertEqual( encrypted, b'\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xaf\x08') def test_gcm_decrypt(self): data = b'\x159Y\xcf...
@@ -83,6 +83,18 @@ def test_gcm_decrypt(self): data, intlist_to_bytes(self.key), authentication_tag, intlist_to_bytes(self.iv[:12])) self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg) + def test_gcm_aligned_decrypt(self): + data = b'\x159Y\xcf5eud\x90\x9c\x85&]\x14\x1...
test/test_aes.py
26
Python
0.429
suggestion
150
51
51
false
[aes] Fix gcm pad length calculation
11,438
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
self.assertEqual( encrypted, b'\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xaf\x08') def test_gcm_decrypt(self): data = b'\x159Y\xcf5eud\x90\x9c\x85&]\x14\x1d\x0f.\x08\xb4T\xe4/\x17\xbd' authentication_tag = b'\xe8&I\x80rI\x07\x9d}YWuU@:e' dec...
I don't like using `intlist_to_bytes` and `bytes_to_intlist` in new code: ```suggestion decrypted = intlist_to_bytes(aes_gcm_decrypt_and_verify( list(data), self.key, list(authentication_tag), self.iv[:12])) self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg[:16]) if Cr...
self.assertEqual( encrypted, b'\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xaf\x08') def test_gcm_decrypt(self): data = b'\x159Y\xcf5eud\x90\x9c\x85&]\x14\x1d\x0f.\x08\xb4T\xe4/\x17\xbd' authentication_tag = b'\xe8&I\x80rI\x07\x9d}YWuU@:e' dec...
@@ -83,6 +83,18 @@ def test_gcm_decrypt(self): data, intlist_to_bytes(self.key), authentication_tag, intlist_to_bytes(self.iv[:12])) self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg) + def test_gcm_aligned_decrypt(self): + data = b'\x159Y\xcf5eud\x90\x9c\x85&]\x14\x1...
test/test_aes.py
26
Python
0.786
security
478
51
51
false
[aes] Fix gcm pad length calculation
11,438
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
'channel': 'ARD-Aktuell', '_old_archive_ids': ['ardbetamediathek Y3JpZDovL2Rhc2Vyc3RlLmRlL3RhZ2Vzc2NoYXUvZmM4ZDUxMjgtOTE0ZC00Y2MzLTgzNzAtNDZkNGNiZWJkOTll'], }, }, { 'url': 'https://www.ardmediathek.de/video/7-tage/7-tage-unter-harten-jungs/hr-fernsehen/N2I2YmM5MzgtNWFlOS00ZGF...
Please actually run the tests, and fill out the information properly.
'channel': 'ARD-Aktuell', '_old_archive_ids': ['ardbetamediathek Y3JpZDovL2Rhc2Vyc3RlLmRlL3RhZ2Vzc2NoYXUvZmM4ZDUxMjgtOTE0ZC00Y2MzLTgzNzAtNDZkNGNiZWJkOTll'], }, }, { 'url': 'https://www.ardmediathek.de/video/7-tage/7-tage-unter-harten-jungs/hr-fernsehen/N2I2YmM5MzgtNWFlOS00ZGF...
@@ -311,6 +311,12 @@ class ARDBetaMediathekIE(InfoExtractor): 'title': '7 Tage ... unter harten Jungs', '_old_archive_ids': ['ardbetamediathek N2I2YmM5MzgtNWFlOS00ZGFlLTg2NzMtYzNjM2JlNjk4MDg3'], }, + }, { + 'url': 'https://www.ardmediathek.de/video/lokalzeit-aus-duesseldorf/...
yt_dlp/extractor/ard.py
26
Python
0.214
style
69
51
51
false
[ie/ARDMediathek] Extract chapters
11,442
yt-dlp/yt-dlp
132,642
Python
seproDev
iw0nderhow
**traverse_obj(media, { 'format_note': ('forcedLabel', {str}), 'width': ('maxHResolutionPx', {int_or_none}), 'height': ('maxVResolutionPx', {int_or_none}), 'vcodec': ('videoCodec', {st...
We can simplify this using a single `traverse_obj` call: ```suggestion **traverse_obj(media_data, { 'chapters': ('pluginData', 'jumpmarks@all', 'chapterArray', ..., { 'start_time': ('chapterTime', {int_or_none}), 'title': ('chapterTitle', {str}), ...
for f in fmts: f['language'] = lang f['language_preference'] = language_preference formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) else: formats.append({ ...
@@ -455,6 +463,7 @@ def _real_extract(self, url): 'subtitles': subtitles, 'is_live': is_live, 'age_limit': age_limit, + 'chapters': chapters,
yt_dlp/extractor/ard.py
26
Python
0.857
refactor
362
51
51
false
[ie/ARDMediathek] Extract chapters
11,442
yt-dlp/yt-dlp
132,642
Python
seproDev
iw0nderhow
'language_preference': language_preference, **traverse_obj(media, { 'format_note': ('forcedLabel', {str}), 'width': ('maxHResolutionPx', {int_or_none}), 'height': ('maxVResolutionPx', {int...
Actually, let's ensure the start time is present. ```suggestion 'chapters': ('pluginData', 'jumpmarks@all', 'chapterArray', lambda _, v: int_or_none(v['chapterTime']), { ```
'language_preference': language_preference, **traverse_obj(media, { 'format_note': ('forcedLabel', {str}), 'width': ('maxHResolutionPx', {int_or_none}), 'height': ('maxVResolutionPx', {int...
@@ -455,6 +473,12 @@ def _real_extract(self, url): 'subtitles': subtitles, 'is_live': is_live, 'age_limit': age_limit, + **traverse_obj(media_data, { + 'chapters': ('pluginData', 'jumpmarks@all', 'chapterArray', ..., {
yt_dlp/extractor/ard.py
26
Python
0.714
suggestion
192
51
51
false
[ie/ARDMediathek] Extract chapters
11,442
yt-dlp/yt-dlp
132,642
Python
seproDev
iw0nderhow
}, 'playlist_count': 2, }, { 'url': 'https://www.bfmtv.com/international/pour-bolsonaro-le-bresil-est-en-faillite-mais-il-ne-peut-rien-faire_AD-202101060232.html', 'only_matching': True, }, { 'url': 'https://www.bfmtv.com/sante/covid-19-oui-le-vaccin-de-pfizer-distribue-e...
This makes only little sense since `traverse_obj` returns a list, always. Probably bad design, but compat and cannot be changed
'playlist_count': 2, }, { 'url': 'https://www.bfmtv.com/international/pour-bolsonaro-le-bresil-est-en-faillite-mais-il-ne-peut-rien-faire_AD-202101060232.html', 'only_matching': True, }, { 'url': 'https://www.bfmtv.com/sante/covid-19-oui-le-vaccin-de-pfizer-distribue-en-france-a-...
@@ -102,18 +129,14 @@ class BFMTVArticleIE(BFMTVBaseIE): }, }] + def _entries(self, webpage): + yield from traverse_obj( + re.findall(self._VIDEO_BLOCK_REGEX, webpage), (..., {self._extract_video}, filter, all))
yt_dlp/extractor/bfmtv.py
26
Python
0.571
suggestion
127
35
36
false
[ie/bfmtv] Fix extractors
11,444
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
def _perform_login(self, username, password): self.report_login() aws = AwsIdp(ie=self, pool_id='eu-west-1_dViSsKM5Y', client_id='6s1h851s8uplco5h6mqh1jac8m') self._id_token, _ = aws.authenticate(username=username, password=password) def _real_initialize(self): if not self._id_t...
```suggestion 'title': traverse_obj(video_data, ('meta', 'title')), ```
'params': {'skip_download': True}, 'skip': 'This video is only available for registered users', }, { 'url': 'https://www.goplay.be/video/de-mol/de-mol-s11/de-mol-s11-aflevering-1#autoplay', 'info_dict': { 'id': 'ecb79672-92b9-4cd9-a0d7-e2f0250681ee', 'ext': 'm...
@@ -72,24 +58,23 @@ def _real_initialize(self): def _real_extract(self, url): url, display_id = self._match_valid_url(url).group(0, 'display_id') webpage = self._download_webpage(url, display_id) - video_data_json = self._html_search_regex(r'<div\s+data-hero="([^"]+)"', webpage, 'video_dat...
yt_dlp/extractor/goplay.py
26
Python
0.571
suggestion
85
51
51
false
[ie/goplay] Fix extractor
11,466
yt-dlp/yt-dlp
132,642
Python
grqz
SamDecrock
'only_matching': True, }, { 'url': 'https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video=81d80727f3022488598f68d323c1ad5e', 'only_matching': True, }, { 'url': 'https://customer-aw5py76sw8wyqzmh.cloudflarestream.com/2463f6d3e06fa29710a337f5f5389fd8/iframe', 'onl...
```suggestion video_id, domain = self._match_valid_url(url).group('id', 'domain') ``` and then up above, we can do this: ```diff - _VALID_URL = rf'https?://(?:{_SUBDOMAIN_RE}{_DOMAIN_RE}/|{_EMBED_RE})(?P<id>{_ID_RE})' + _VALID_URL = rf'https?://(?:{_SUBDOMAIN_RE}(?P<domain>{_DOMAIN_RE})/|{_EMBED_R...
'only_matching': True, }, { 'url': 'https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video=81d80727f3022488598f68d323c1ad5e', 'only_matching': True, }, { 'url': 'https://customer-aw5py76sw8wyqzmh.cloudflarestream.com/2463f6d3e06fa29710a337f5f5389fd8/iframe', 'onl...
@@ -63,7 +63,7 @@ class CloudflareStreamIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url)
yt_dlp/extractor/cloudflarestream.py
26
Python
0.786
suggestion
345
49
50
false
[ie/CloudflareStream] Avoid extraction via videodelivery.net
11,478
yt-dlp/yt-dlp
132,642
Python
bashonly
hugovdev
return self._download_json( f'https://rutube.ru/api/play/options/{video_id}/', video_id, 'Downloading options JSON', 'Unable to download options JSON', headers=self.geo_verification_headers(), query=query) def _extract_formats_and_subtitles(self, options, vid...
I know this is basically old code, but would be good to add an `m3u8_id` ```suggestion fmts, subs = self._extract_m3u8_formats_and_subtitles( hls_url, video_id, 'mp4', fatal=False, m3u8_id='hls') ```
return self._download_json( f'https://rutube.ru/api/play/options/{video_id}/', video_id, 'Downloading options JSON', 'Unable to download options JSON', headers=self.geo_verification_headers(), query=query) def _extract_formats_and_subtitles(self, options, vid...
@@ -82,11 +88,18 @@ def _extract_formats(self, options, video_id): 'format_id': format_id, }) for hls_url in traverse_obj(options, ('live_streams', 'hls', ..., 'url', {url_or_none})): - formats.extend(self._extract_m3u8_formats(hls_url, video_id, ext='mp4', fata...
yt_dlp/extractor/rutube.py
26
Python
0.857
refactor
231
51
51
false
[ie/rutube] Rework extractors
11,480
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'uploader_id': str_or_none(data.get('author_id')), 'creator': uploader, 'duration': duration('duration') or duration('length'), 'view_count': stats('play'), 'like_count': stats('like'), 'comment_count': stats('message'), 'format': 'MPEG Layer 3', 'format_i...
Let's just parse the query arguments from the URL without regex ```suggestion ```
'timestamp': unified_timestamp(data.get('published_at')), 'uploader': uploader, 'uploader_id': str_or_none(data.get('author_id')), 'creator': uploader, 'duration': duration('duration') or duration('length'), 'view_count': stats('play'), 'like_count': stats('like')...
@@ -66,6 +66,7 @@ class SpreakerIE(InfoExtractor): v2/episodes )/ (?P<id>\d+) + (?:\?key=(?P<key>[^&]+))?
yt_dlp/extractor/spreaker.py
26
Python
0.571
suggestion
83
51
51
false
[ie/spreaker] Support episode pages and access keys
11,489
yt-dlp/yt-dlp
132,642
Python
seproDev
julionc
'title': 'EP:15 | Music Marketing (Likes) - Part 2', 'description': 'md5:0588c43e27be46423e183076fa071177', 'timestamp': 1502250336, 'upload_date': '20170809', 'uploader': 'SWM', 'uploader_id': '9780658', 'duration': 1063.42, ...
```suggestion episode_id = self._match_id(url) query = {} if key := traverse_obj(url, ({parse_qs}, 'key', 0)): query = {'key': key} ``` import `traverse_obj` from `..utils.traversal` and `parse_qs` from `..utils`
'uploader': 'SWM', 'uploader_id': '9780658', 'duration': 1063.42, 'view_count': int, 'like_count': int, 'comment_count': int, 'series': 'Success With Music | SWM', 'thumbnail': 'https://d3wo5wojvuv7l.cloudfront.net/t_square_...
@@ -94,28 +95,33 @@ class SpreakerIE(InfoExtractor): }] def _real_extract(self, url): - episode_id = self._match_id(url) + episode_id, key = self._match_valid_url(url).group( + 'id', 'key') + query = {} + if key is not None: + query = {'key': key}
yt_dlp/extractor/spreaker.py
26
Python
0.786
suggestion
256
51
51
false
[ie/spreaker] Support episode pages and access keys
11,489
yt-dlp/yt-dlp
132,642
Python
seproDev
julionc
'uploader': 'SWM', 'uploader_id': '9780658', 'duration': 1063.42, 'view_count': int, 'like_count': int, 'comment_count': int, 'series': 'Success With Music (SWM)', }, }, { 'url': 'https://api.spreaker.com/download/ep...
```suggestion episode_id, query=query)['response']['episode'] ```
'like_count': int, 'comment_count': int, 'series': 'Success With Music | SWM', 'thumbnail': 'https://d3wo5wojvuv7l.cloudfront.net/t_square_limited_160/images.spreaker.com/original/777ce4f96b71b0e1b7c09a5e625210e3.jpg', 'creators': ['SWM'], }, }, { ...
@@ -94,28 +95,33 @@ class SpreakerIE(InfoExtractor): }] def _real_extract(self, url): - episode_id = self._match_id(url) + episode_id, key = self._match_valid_url(url).group( + 'id', 'key') + query = {} + if key is not None: + query = {'key': key} d...
yt_dlp/extractor/spreaker.py
26
Python
0.571
suggestion
79
51
51
false
[ie/spreaker] Support episode pages and access keys
11,489
yt-dlp/yt-dlp
132,642
Python
seproDev
julionc
'uploader': uploader, 'uploader_id': str_or_none(data.get('author_id')), 'creator': uploader, 'duration': duration('duration') or duration('length'), 'view_count': stats('play'), 'like_count': stats('like'), 'comment_count': stats('message'), 'format': 'MP...
Can we add a test for this, or are these keys supposed to be private?
'description': data.get('description'), 'timestamp': unified_timestamp(data.get('published_at')), 'uploader': uploader, 'uploader_id': str_or_none(data.get('author_id')), 'creator': uploader, 'duration': duration('duration') or duration('length'), 'view_count': st...
@@ -66,6 +66,7 @@ class SpreakerIE(InfoExtractor): v2/episodes )/ (?P<id>\d+) + (?:\?key=(?P<key>[^&]+))? ''' _TESTS = [{ 'url': 'https://api.spreaker.com/episode/12534508',
yt_dlp/extractor/spreaker.py
26
Python
0.214
question
69
51
51
false
[ie/spreaker] Support episode pages and access keys
11,489
yt-dlp/yt-dlp
132,642
Python
seproDev
julionc
'comment_count': int, 'series': 'Success With Music (SWM)', }, }, { 'url': 'https://api.spreaker.com/download/episode/12534508/swm_ep15_how_to_market_your_music_part_2.mp3', 'only_matching': True, }, { 'url': 'https://api.spreaker.com/v2/episodes/12534508?...
I don't get why we need a separate extractor for the pages. Can't we just match the page URL in `SpreakerIE`? ```py class SpreakerIE(InfoExtractor): _VALID_URL = [ r'''(?x) https?:// api\.spreaker\.com/ (?: (?:download/)?episode| v2/ep...
}, }, { 'url': 'https://api.spreaker.com/download/episode/12534508/swm_ep15_how_to_market_your_music_part_2.mp3', 'only_matching': True, }, { 'url': 'https://api.spreaker.com/v2/episodes/12534508?export=episode_segments', 'only_matching': True, }, { 'note': 'e...
@@ -94,28 +95,33 @@ class SpreakerIE(InfoExtractor): }] def _real_extract(self, url): - episode_id = self._match_id(url) + episode_id, key = self._match_valid_url(url).group( + 'id', 'key') + query = {} + if key is not None: + query = {'key': key} d...
yt_dlp/extractor/spreaker.py
26
Python
0.857
refactor
628
51
51
false
[ie/spreaker] Support episode pages and access keys
11,489
yt-dlp/yt-dlp
132,642
Python
seproDev
julionc
'creator': uploader, 'duration': duration('duration') or duration('length'), 'view_count': stats('play'), 'like_count': stats('like'), 'comment_count': stats('message'), 'format': 'MPEG Layer 3', 'format_id': 'mp3', 'container': 'mp3', 'ext': 'mp3'...
since the diff already changes all these lines, we might as well do this, which imo is more readable if we're doing multiple patterns ```suggestion r'https?://api\.spreaker\.com/(?:(?:download/)?episode|v2/episodes)/(?P<id>\d+)', ```
'creator': uploader, 'duration': duration('duration') or duration('length'), 'view_count': stats('play'), 'like_count': stats('like'), 'comment_count': stats('message'), 'format': 'MPEG Layer 3', 'format_id': 'mp3', 'container': 'mp3', 'ext': 'mp3'...
@@ -58,15 +60,18 @@ def duration(key): class SpreakerIE(InfoExtractor): - _VALID_URL = r'''(?x) - https?:// - api\.spreaker\.com/ - (?: - (?:download/)?episode| - v2/episodes - ...
yt_dlp/extractor/spreaker.py
26
Python
0.857
suggestion
244
51
51
false
[ie/spreaker] Support episode pages and access keys
11,489
yt-dlp/yt-dlp
132,642
Python
bashonly
julionc
'info_dict': { 'id': '60269615', 'display_id': 'grunge-music-origins-the-raw-sound-that-', 'ext': 'mp3', 'title': 'Grunge Music Origins - The Raw Sound that Defined a Generation', 'description': str, 'timestamp': 1717468905, 'up...
could do this and remove the added lines above ```suggestion episode_id, query=traverse_obj(parse_qs(url), {'key': ('key', 0)}))['response']['episode'] ```
'timestamp': 1717468905, 'upload_date': '20240604', 'uploader': 'Katie Brown 2', 'uploader_id': '17733249', 'duration': 818.83, 'view_count': int, 'like_count': int, 'comment_count': int, 'series': '90s Grunge', ...
@@ -91,34 +96,38 @@ class SpreakerIE(InfoExtractor): }, { 'url': 'https://api.spreaker.com/v2/episodes/12534508?export=episode_segments', 'only_matching': True, + }, { + 'note': 'episode', + 'url': 'https://www.spreaker.com/episode/grunge-music-origins-the-raw-sound-that-defined-...
yt_dlp/extractor/spreaker.py
26
Python
0.786
suggestion
170
51
51
false
[ie/spreaker] Support episode pages and access keys
11,489
yt-dlp/yt-dlp
132,642
Python
bashonly
julionc
return lambda _: value def require(name, /, *, expected=False): def func(value): if value is None: raise _RequiredError(f'Unable to extract {name}', expected=expected) return value return func class _RequiredError(ExtractorError): pass @typing.overload def subs_list_t...
should we do this? ```suggestion def subs_list_to_dict(subs: list[dict] | None = None, /, *, lang='und', ext=None): ```
return lambda _: value def require(name, /, *, expected=False): def func(value): if value is None: raise _RequiredError(f'Unable to extract {name}', expected=expected) return value return func class _RequiredError(ExtractorError): pass @typing.overload def subs_list_t...
@@ -332,14 +332,14 @@ class _RequiredError(ExtractorError): @typing.overload -def subs_list_to_dict(*, ext: str | None = None) -> collections.abc.Callable[[list[dict]], dict[str, list[dict]]]: ... +def subs_list_to_dict(*, lang: str | None = None, ext: str | None = None) -> collections.abc.Callable[[list[dict]], d...
yt_dlp/utils/traversal.py
26
Python
0.786
question
122
51
51
false
[utils] `subs_list_to_dict`: Add `lang` default parameter
11,508
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
}, 'INNERTUBE_CONTEXT_CLIENT_NAME': 2, }, 'tv': { 'INNERTUBE_CONTEXT': { 'client': { 'clientName': 'TVHTML5', 'clientVersion': '7.20240724.13.00', }, }, 'INNERTUBE_CONTEXT_CLIENT_NAME': 7, }, # This client no...
maybe it still can, right? if authenticated ```suggestion # It may be able to receive pre-merged video+audio 720p/1080p streams ```
# See: https://github.com/yt-dlp/yt-dlp/pull/557 'mweb': { 'INNERTUBE_CONTEXT': { 'client': { 'clientName': 'MWEB', 'clientVersion': '2.20240726.01.00', }, }, 'INNERTUBE_CONTEXT_CLIENT_NAME': 2, }, 'tv': { 'INNERTUBE...
@@ -283,7 +268,8 @@ }, 'INNERTUBE_CONTEXT_CLIENT_NAME': 85, }, - # This client has pre-merged video+audio 720p/1080p streams + # This client now requires sign-in for every video + # It previously was able to recieve pre-merged video+audio 720p/1080p streams
yt_dlp/extractor/youtube.py
26
Python
0.714
security
138
51
51
false
[ie/youtube] Player client maintenance
11,528
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
info['id'] = video_id info['__post_extractor'] = comments return info def _get_comments(self, post_id): cursor = None count = 0 params = { 'page[count]': 50, 'include': 'parent.commenter.campaign,parent.post.user,parent.post.campaign.creator,p...
The real problem is that the traversal path here is incorrect, thus the filtering it's trying to do is ineffective. Let's change it to this: ```suggestion for comment in traverse_obj(response, (('data', 'included'), lambda _, v: v['type'] == 'comment' and v['id'])): ```
info['__post_extractor'] = comments return info def _get_comments(self, post_id): cursor = None count = 0 params = { 'page[count]': 50, 'include': 'parent.commenter.campaign,parent.post.user,parent.post.campaign.creator,parent.replies.parent,parent.re...
@@ -406,10 +428,9 @@ def _get_comments(self, post_id): cursor = None for comment in traverse_obj(response, (('data', ('included', lambda _, v: v['type'] == 'comment')), ...)):
yt_dlp/extractor/patreon.py
26
Python
1
bug
285
51
51
false
[ie/patreon] Fix comments extraction
11,530
yt-dlp/yt-dlp
132,642
Python
bashonly
jshumphrey
def _get_comments(self, post_id): cursor = None count = 0 params = { 'page[count]': 50, 'include': 'parent.commenter.campaign,parent.post.user,parent.post.campaign.creator,parent.replies.parent,parent.replies.commenter.campaign,parent.replies.post.user,parent.replies....
then: ```suggestion comment_id = comment['id'] attributes = traverse_obj(comment, ('attributes', {dict})) or {} ```
cursor = None count = 0 params = { 'page[count]': 50, 'include': 'parent.commenter.campaign,parent.post.user,parent.post.campaign.creator,parent.replies.parent,parent.replies.commenter.campaign,parent.replies.post.user,parent.replies.post.campaign.creator,commenter.campai...
@@ -406,10 +428,9 @@ def _get_comments(self, post_id): cursor = None for comment in traverse_obj(response, (('data', ('included', lambda _, v: v['type'] == 'comment')), ...)): count += 1 - comment_id = comment.get('id') - attributes = comment.get(...
yt_dlp/extractor/patreon.py
26
Python
0.714
suggestion
151
51
51
false
[ie/patreon] Fix comments extraction
11,530
yt-dlp/yt-dlp
132,642
Python
bashonly
jshumphrey
count = 0 params = { 'page[count]': 50, 'include': 'parent.commenter.campaign,parent.post.user,parent.post.campaign.creator,parent.replies.parent,parent.replies.commenter.campaign,parent.replies.post.user,parent.replies.post.campaign.creator,commenter.campaign,post.user,post.camp...
```suggestion 'id': ('id', {str_or_none}), ```
count = 0 params = { 'page[count]': 50, 'include': 'parent.commenter.campaign,parent.post.user,parent.post.campaign.creator,parent.replies.parent,parent.replies.commenter.campaign,parent.replies.post.user,parent.replies.post.campaign.creator,commenter.campaign,post.user,post.camp...
@@ -404,26 +425,24 @@ def _get_comments(self, post_id): f'posts/{post_id}/comments', post_id, query=params, note=f'Downloading comments page {page}') cursor = None - for comment in traverse_obj(response, (('data', ('included', lambda _, v: v['type'] == 'comment')), ...)): + ...
yt_dlp/extractor/patreon.py
26
Python
0.571
suggestion
72
51
51
false
[ie/patreon] Fix comments extraction
11,530
yt-dlp/yt-dlp
132,642
Python
bashonly
jshumphrey
'url': 'https://www.redgifs.com/users/lamsinka89?page=3', 'info_dict': { 'id': 'lamsinka89?page=3', 'title': 'lamsinka89', 'description': 'RedGifs user lamsinka89, ordered by recent', }, 'playlist_mincount': 31, }, ...
better to use a mincount closer to the actual count ```suggestion 'playlist_mincount': 121, ```
'url': 'https://www.redgifs.com/users/lamsinka89?page=3', 'info_dict': { 'id': 'lamsinka89?page=3', 'title': 'lamsinka89', 'description': 'RedGifs user lamsinka89, ordered by recent', }, 'playlist_count': 80, }, ...
@@ -240,7 +240,17 @@ class RedGifsUserIE(RedGifsBaseInfoExtractor): 'title': 'lamsinka89', 'description': 'RedGifs user lamsinka89, ordered by best', }, - 'playlist_mincount': 100, + 'playlist_mincount': 391, + }, + { + 'url':...
yt_dlp/extractor/redgifs.py
26
Python
0.786
suggestion
110
44
44
false
[ie/RedGifsUser] Fix extraction
11,531
yt-dlp/yt-dlp
132,642
Python
bashonly
jshumphrey
'title': 'lamsinka89', 'description': 'RedGifs user lamsinka89, ordered by recent', }, 'playlist_mincount': 391, }, { 'url': 'https://www.redgifs.com/users/lamsinka89?page=3', 'info_dict': { 'id': 'lamsinka89...
```suggestion 'note': 'https://github.com/yt-dlp/yt-dlp/issues/7382, ```
'title': 'lamsinka89', 'description': 'RedGifs user lamsinka89, ordered by recent', }, 'playlist_mincount': 391, }, { 'url': 'https://www.redgifs.com/users/lamsinka89?page=3', 'info_dict': { 'id': 'lamsinka89...
@@ -240,7 +240,17 @@ class RedGifsUserIE(RedGifsBaseInfoExtractor): 'title': 'lamsinka89', 'description': 'RedGifs user lamsinka89, ordered by best', }, - 'playlist_mincount': 100, + 'playlist_mincount': 391, + }, + { + 'url':...
yt_dlp/extractor/redgifs.py
26
Python
0.571
suggestion
86
50
50
false
[ie/RedGifsUser] Fix extraction
11,531
yt-dlp/yt-dlp
132,642
Python
bashonly
jshumphrey
return self.playlist_result( entries, query_str, tags, f'RedGifs search for {tags}, ordered by {order}') class RedGifsUserIE(RedGifsBaseInfoExtractor): IE_DESC = 'Redgifs user' _VALID_URL = r'https?://(?:www\.)?redgifs\.com/users/(?P<username>[^/?#]+)(?:\?(?P<query>[^#]+))?' _PAGE_SIZE...
since we are only requesting 1 page, we should test for an exact count of 80 ```suggestion 'playlist_count': 80, ```
return self.playlist_result( entries, query_str, tags, f'RedGifs search for {tags}, ordered by {order}') class RedGifsUserIE(RedGifsBaseInfoExtractor): IE_DESC = 'Redgifs user' _VALID_URL = r'https?://(?:www\.)?redgifs\.com/users/(?P<username>[^/?#]+)(?:\?(?P<query>[^#]+))?' _PAGE_SIZE...
@@ -231,7 +231,7 @@ class RedGifsUserIE(RedGifsBaseInfoExtractor): 'title': 'lamsinka89', 'description': 'RedGifs user lamsinka89, ordered by recent', }, - 'playlist_count': 30, + 'playlist_mincount': 31,
yt_dlp/extractor/redgifs.py
26
Python
0.786
suggestion
131
51
51
false
[ie/RedGifsUser] Fix extraction
11,531
yt-dlp/yt-dlp
132,642
Python
bashonly
jshumphrey
'title': 'lamsinka89', 'description': 'RedGifs user lamsinka89, ordered by recent', }, 'playlist_mincount': 391, }, { 'url': 'https://www.redgifs.com/users/lamsinka89?page=3', 'info_dict': { 'id': 'lamsinka89...
```suggestion 'note': 'https://github.com/yt-dlp/yt-dlp/issues/7382', ```
'title': 'lamsinka89', 'description': 'RedGifs user lamsinka89, ordered by recent', }, 'playlist_mincount': 391, }, { 'url': 'https://www.redgifs.com/users/lamsinka89?page=3', 'info_dict': { 'id': 'lamsinka89...
@@ -240,7 +240,17 @@ class RedGifsUserIE(RedGifsBaseInfoExtractor): 'title': 'lamsinka89', 'description': 'RedGifs user lamsinka89, ordered by best', }, - 'playlist_mincount': 100, + 'playlist_mincount': 391, + }, + { + 'url':...
yt_dlp/extractor/redgifs.py
26
Python
0.571
suggestion
87
50
50
false
[ie/RedGifsUser] Fix extraction
11,531
yt-dlp/yt-dlp
132,642
Python
bashonly
jshumphrey
{ 'id': '1.2966224', }, 'playlist_mincount': 19, }, { 'url': 'http://www.ctvnews.ca/video?binId=1.2876780', 'info_dict': { 'id': '1.2876780', }, 'playlist_mincount': 100, }, { 'url': 'http://www.ctvnews.ca/1.810401',...
```suggestion 'info_dict': { 'id': '1.6665797', }, ```
'upload_date': '20160630', 'categories': [], 'season_number': 0, 'season': 'Season 0', 'tags': [], 'series': 'CTV News National | Archive | Stories 2', 'season_id': '57981', 'thumbnail': r're:https?://.*\.jpg$', ...
@@ -40,6 +48,13 @@ class CTVNewsIE(InfoExtractor): }, { 'url': 'http://vancouverisland.ctvnews.ca/video?clipId=761241', 'only_matching': True, + }, { + 'url': 'https://www.ctvnews.ca/business/respondents-to-bank-of-canada-questionnaire-largely-oppose-creating-a-digital-loonie-1.6665797'...
yt_dlp/extractor/ctvnews.py
26
Python
0.571
suggestion
86
51
51
false
[ie/ctvnews] Fix extractor
11,534
yt-dlp/yt-dlp
132,642
Python
bashonly
jshumphrey
def ninecninemedia_url_result(clip_id): return { '_type': 'url_transparent', 'id': clip_id, 'url': f'9c9media:ctvnews_web:{clip_id}', 'ie_key': 'NineCNineMedia', } if page_id.isdigit(): return ninecnine...
```suggestion entries = [ninecninemedia_url_result(clip_id) for clip_id in orderedSet(re.findall(r'axisId&#34;:&#34;(\d+)', webpage))] ```
'info_dict': { 'id': '1.2966224', }, 'playlist_mincount': 19, }, { 'url': 'http://www.ctvnews.ca/video?binId=1.2876780', 'info_dict': { 'id': '1.2876780', }, 'playlist_mincount': 100, }, { 'url': 'https://www...
@@ -67,4 +82,7 @@ def ninecninemedia_url_result(clip_id): if 'getAuthStates("' in webpage: entries = [ninecninemedia_url_result(clip_id) for clip_id in self._search_regex(r'getAuthStates\("([\d+,]+)"', webpage, 'clip ids').split(',')] + ...
yt_dlp/extractor/ctvnews.py
26
Python
0.714
suggestion
192
28
51
false
[ie/ctvnews] Fix extractor
11,534
yt-dlp/yt-dlp
132,642
Python
bashonly
jshumphrey
}] def _real_extract(self, url): display_id = self._match_id(url) qs = parse_qs(url) revision_id = traverse_obj(qs, (('revId', 'id'), 0, any)) if 'bandlab.com/revision/' in url: revision_id = display_id revision_data = None if not revision_id: ...
would it be useful to include the `post_type` in the error message here?
}] def _real_extract(self, url): display_id, url_type = self._match_valid_url(url).group('id', 'url_type') qs = parse_qs(url) revision_id = traverse_obj(qs, (('revId', 'id'), 0, any)) if url_type == 'revision': revision_id = display_id revision_data = None ...
@@ -0,0 +1,438 @@ + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + format_field, + int_or_none, + parse_iso8601, + parse_qs, + truncate_string, + url_or_none, +) +from ..utils.traversal import traverse_obj, value + + +class BandlabBaseIE(InfoExtrac...
yt_dlp/extractor/bandlab.py
26
Python
0.571
question
72
51
51
false
[ie/bandlab] Add extractors
11,535
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
if post_type == 'Revision': yield self._parse_revision(post.get('revision')) elif post_type == 'Track': yield self._parse_track(post) elif post_type == 'Video': yield self._parse_video(post) else: self.report...
similarly, would it be useful to include the `errorCode` in the message here?
if post_type == 'Revision': yield self._parse_revision(post.get('revision')) elif post_type == 'Track': yield self._parse_track(post) elif post_type == 'Video': yield self._parse_video(post) else: self.report...
@@ -0,0 +1,438 @@ + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + format_field, + int_or_none, + parse_iso8601, + parse_qs, + truncate_string, + url_or_none, +) +from ..utils.traversal import traverse_obj, value + + +class BandlabBaseIE(InfoExtrac...
yt_dlp/extractor/bandlab.py
26
Python
0.571
question
77
46
46
false
[ie/bandlab] Add extractors
11,535
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
playlist_id, playlist_type = self._match_valid_url(url).group('id', 'type') endpoints = { 'albums': ['albums'], 'collections': ['collections'], 'embed': ['collections', 'albums'], }.get(playlist_type) for endpoint in endpoints: playlist_da...
this doesn't guard against empty strings, would return `'release_date': ''` ```suggestion 'release_date': ('releaseDate', {lambda x: x.replace('-', '')}, filter), ```
playlist_id, playlist_type = self._match_valid_url(url).group('id', 'type') endpoints = { 'albums': ['albums'], 'collections': ['collections'], 'embed': ['collections', 'albums'], }.get(playlist_type) for endpoint in endpoints: playlist_da...
@@ -0,0 +1,438 @@ + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + format_field, + int_or_none, + parse_iso8601, + parse_qs, + truncate_string, + url_or_none, +) +from ..utils.traversal import traverse_obj, value + + +class BandlabBaseIE(InfoExtrac...
yt_dlp/extractor/bandlab.py
26
Python
0.786
suggestion
187
36
36
false
[ie/bandlab] Add extractors
11,535
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'info_dict': { 'id': 'e14223c3-7871-ef11-bdfd-000d3a980db3', 'ext': 'm4a', 'view_count': int, 'upload_date': '20240913', 'uploader_id': 'phantommusicofficial', 'timestamp': 1726194897, 'uploader': 'Phantom', 'comment...
not sure if it would be worth it, but alternatively we could add something like a `url_type` capture group to the `_VALID_URL` patterns
'info_dict': { 'id': 'e14223c3-7871-ef11-bdfd-000d3a980db3', 'ext': 'm4a', 'view_count': int, 'upload_date': '20240913', 'uploader_id': 'phantommusicofficial', 'timestamp': 1726194897, 'uploader': 'Phantom', 'comment...
@@ -0,0 +1,438 @@ + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + format_field, + int_or_none, + parse_iso8601, + parse_qs, + truncate_string, + url_or_none, +) +from ..utils.traversal import traverse_obj, value + + +class BandlabBaseIE(InfoExtrac...
yt_dlp/extractor/bandlab.py
26
Python
0.714
suggestion
135
51
51
false
[ie/bandlab] Add extractors
11,535
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'view_count': int, 'description': 'md5:4ec31c568a5f5a5a2b17572ea64c3825', 'release_date': '20230812', 'title': 'Art', 'album': 'Art', 'album_type': 'Album', 'id': 'e98aafb5-d932-ee11-b8f0-00224844c719', 'thumbnail': 'https:/...
I think double-quotes look better in user-facing output, but I realize this is über-pedantic; it's up to you ```suggestion self.report_warning(f'Skipping unknown post type: "{post_type}"') ```
'view_count': int, 'description': 'md5:4ec31c568a5f5a5a2b17572ea64c3825', 'release_date': '20230812', 'title': 'Art', 'album': 'Art', 'album_type': 'Album', 'id': 'e98aafb5-d932-ee11-b8f0-00224844c719', 'thumbnail': 'https:/...
@@ -0,0 +1,438 @@ + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + format_field, + int_or_none, + parse_iso8601, + parse_qs, + truncate_string, + url_or_none, +) +from ..utils.traversal import traverse_obj, value + + +class BandlabBaseIE(InfoExtrac...
yt_dlp/extractor/bandlab.py
26
Python
1
suggestion
211
51
51
false
[ie/bandlab] Add extractors
11,535
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
if post_type == 'Revision': yield self._parse_revision(post.get('revision')) elif post_type == 'Track': yield self._parse_track(post) elif post_type == 'Video': yield self._parse_video(post) else: self.report...
```suggestion raise ExtractorError(f'Could not find playlist data. Error code: "{error_code}"') ```
if post_type == 'Revision': yield self._parse_revision(post.get('revision')) elif post_type == 'Track': yield self._parse_track(post) elif post_type == 'Video': yield self._parse_video(post) else: self.report...
@@ -0,0 +1,438 @@ + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + float_or_none, + format_field, + int_or_none, + parse_iso8601, + parse_qs, + truncate_string, + url_or_none, +) +from ..utils.traversal import traverse_obj, value + + +class BandlabBaseIE(InfoExtrac...
yt_dlp/extractor/bandlab.py
26
Python
0.929
refactor
113
46
46
false
[ie/bandlab] Add extractors
11,535
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'id': '103247', }, 'playlist_count': 2, }] def _real_extract(self, url): video_id = self._match_id(url) data = self._call_api( 'catchstory/a/view', video_id, headers={'Referer': url}, query={'aStoryListIdx': '', 'nStoryIdx': video_id}) ...
Consistency with above? ```suggestion 'thumbnails': ('thumb', {self._fixup_thumb}), ```
'id': '103247', }, 'playlist_count': 2, }] def _real_extract(self, url): video_id = self._match_id(url) data = self._call_api( 'catchstory/a/view', video_id, headers={'Referer': url}, query={'aStoryListIdx': '', 'nStoryIdx': video_id}) ...
@@ -238,7 +246,7 @@ def _entries(data): 'title': ('title', {str}), 'uploader': ('writer_nick', {str}), 'uploader_id': ('writer_id', {str}), - 'thumbnail': ('thumb', {url_or_none}), + 'thumbnails': ('thumb', {AfreecaTVBaseIE._fixup_thumb}),
yt_dlp/extractor/afreecatv.py
26
Python
0.714
suggestion
106
51
51
false
[ie/soop] Fix thumbnail extraction
11,545
yt-dlp/yt-dlp
132,642
Python
Grub4K
bashonly
'only_matching': True, }, { 'url': 'https://chaturbate.eu/fullvideo/?b=caylin', 'only_matching': True, }, { 'url': 'https://chaturbate.global/siswet19/', 'only_matching': True, }] _ROOM_OFFLINE = 'Room is currently offline' _ROOM_PRIVATE = 'Room is currently ...
- we can inline all the request params in the `_download_json()` call - `'Content-Type': 'application/x-www-form-urlencoded'` header is added by default if the request has `data` - let's future-proof this by adding the `'Accept': 'application/json'` header - don't forget our `geo_verification_headers`, or else this ...
'only_matching': True, }, { 'url': 'https://chaturbate.eu/fullvideo/?b=caylin', 'only_matching': True, }, { 'url': 'https://chaturbate.global/siswet19/', 'only_matching': True, }] _ERROR_MAP = { 'offline': 'Room is currently offline', 'private': '...
@@ -41,10 +42,54 @@ class ChaturbateIE(InfoExtractor): }] _ROOM_OFFLINE = 'Room is currently offline' + _ROOM_PRIVATE = 'Room is currently in a private show' + _ROOM_AWAY = 'Performer is currently away' + _ROOM_PASSWORD = 'Room is password protected' + _ROOM_HIDDEN = 'Hidden session in progress'...
yt_dlp/extractor/chaturbate.py
26
Python
1
refactor
998
51
51
false
[ie/chaturbate] Extract from API and support impersonation
11,555
yt-dlp/yt-dlp
132,642
Python
bashonly
powergold1
'skip_download': True, }, 'skip': 'Room is offline', }, { 'url': 'https://chaturbate.com/fullvideo/?b=caylin', 'only_matching': True, }, { 'url': 'https://en.chaturbate.com/siswet19/', 'only_matching': True, }, { 'url': 'https://chaturbate....
let's condense this into a single class var mapping (and remove `_ROOM_BLOCKED` since we won't need it per my suggestion below) ```suggestion _ERROR_MAP = { 'offline': 'Room is currently offline', 'private': 'Room is currently in a private show', 'away': 'Performer is currently away', ...
'skip_download': True, }, 'skip': 'Room is offline', }, { 'url': 'https://chaturbate.com/fullvideo/?b=caylin', 'only_matching': True, }, { 'url': 'https://en.chaturbate.com/siswet19/', 'only_matching': True, }, { 'url': 'https://chaturbate....
@@ -41,10 +42,54 @@ class ChaturbateIE(InfoExtractor): }] _ROOM_OFFLINE = 'Room is currently offline' + _ROOM_PRIVATE = 'Room is currently in a private show' + _ROOM_AWAY = 'Performer is currently away' + _ROOM_PASSWORD = 'Room is password protected' + _ROOM_HIDDEN = 'Hidden session in progress'...
yt_dlp/extractor/chaturbate.py
26
Python
1
refactor
879
51
51
false
[ie/chaturbate] Extract from API and support impersonation
11,555
yt-dlp/yt-dlp
132,642
Python
bashonly
powergold1
_ROOM_BLOCKED = 'Room is not avaiable in this region' def _extract_from_api(self, video_id, tld): req = Request( f'https://chaturbate.{tld}/get_edge_hls_url_ajax/', data=f'room_slug={video_id}'.encode(), headers={ 'X-Requested-With': 'XMLHttpRequest',...
with the above `_ERROR_MAP` suggestion applied, we can simplify this: ```suggestion if status != 'public': if error := self._ERROR_MAP.get(status): raise ExtractorError(error, expected=True) self.report_warning('Falling back to webpage extraction') retur...
'hidden': 'Hidden session in progress', } def _extract_from_api(self, video_id, tld): response = self._download_json( f'https://chaturbate.{tld}/get_edge_hls_url_ajax/', video_id, data=urlencode_postdata({'room_slug': video_id}), headers={ **s...
@@ -41,10 +42,54 @@ class ChaturbateIE(InfoExtractor): }] _ROOM_OFFLINE = 'Room is currently offline' + _ROOM_PRIVATE = 'Room is currently in a private show' + _ROOM_AWAY = 'Performer is currently away' + _ROOM_PASSWORD = 'Room is password protected' + _ROOM_HIDDEN = 'Hidden session in progress'...
yt_dlp/extractor/chaturbate.py
26
Python
1
refactor
331
51
51
false
[ie/chaturbate] Extract from API and support impersonation
11,555
yt-dlp/yt-dlp
132,642
Python
bashonly
powergold1
f'https://chaturbate.{tld}/get_edge_hls_url_ajax/', data=f'room_slug={video_id}'.encode(), headers={ 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/x-www-form-urlencoded', }, ) response = self._download_j...
```suggestion self.raise_geo_restricted() ```
response = self._download_json( f'https://chaturbate.{tld}/get_edge_hls_url_ajax/', video_id, data=urlencode_postdata({'room_slug': video_id}), headers={ **self.geo_verification_headers(), 'X-Requested-With': 'XMLHttpRequest', '...
@@ -41,10 +42,54 @@ class ChaturbateIE(InfoExtractor): }] _ROOM_OFFLINE = 'Room is currently offline' + _ROOM_PRIVATE = 'Room is currently in a private show' + _ROOM_AWAY = 'Performer is currently away' + _ROOM_PASSWORD = 'Room is password protected' + _ROOM_HIDDEN = 'Hidden session in progress'...
yt_dlp/extractor/chaturbate.py
26
Python
0.571
suggestion
59
51
51
false
[ie/chaturbate] Extract from API and support impersonation
11,555
yt-dlp/yt-dlp
132,642
Python
bashonly
powergold1
elif status == 'private': raise ExtractorError(self._ROOM_PRIVATE, expected=True) elif status == 'away': raise ExtractorError(self._ROOM_AWAY, expected=True) elif status == 'hidden': raise ExtractorError(self._ROOM_HIDDEN, expected=True) elif status ==...
inline formats extraction in the return ```suggestion return { 'id': video_id, 'title': video_id, 'thumbnail': f'https://roomimg.stream.highwebmedia.com/ri/{video_id}.jpg', 'is_live': True, 'formats': self._extract_m3u8_formats(m3u8_url, video_i...
raise ExtractorError(error, expected=True) self.report_warning('Falling back to webpage extraction') return None m3u8_url = response.get('url') if not m3u8_url: self.raise_geo_restricted() return { 'id': video_id, 'tit...
@@ -41,10 +42,54 @@ class ChaturbateIE(InfoExtractor): }] _ROOM_OFFLINE = 'Room is currently offline' + _ROOM_PRIVATE = 'Room is currently in a private show' + _ROOM_AWAY = 'Performer is currently away' + _ROOM_PASSWORD = 'Room is password protected' + _ROOM_HIDDEN = 'Hidden session in progress'...
yt_dlp/extractor/chaturbate.py
26
Python
0.857
refactor
357
51
51
false
[ie/chaturbate] Extract from API and support impersonation
11,555
yt-dlp/yt-dlp
132,642
Python
bashonly
powergold1
raise ExtractorError(self._ROOM_HIDDEN, expected=True) elif status == 'password protected': raise ExtractorError(self._ROOM_PASSWORD, expected=True) elif status != 'public': return None m3u8_url = response.get('url') if not m3u8_url: raise...
can we also do this so that we can truly close #6546 ```suggestion headers=self.geo_verification_headers(), impersonate=True) ```
if not m3u8_url: self.raise_geo_restricted() return { 'id': video_id, 'title': video_id, 'thumbnail': f'https://roomimg.stream.highwebmedia.com/ri/{video_id}.jpg', 'is_live': True, 'age_limit': 18, 'formats': self._extr...
@@ -41,10 +42,54 @@ class ChaturbateIE(InfoExtractor): }] _ROOM_OFFLINE = 'Room is currently offline' + _ROOM_PRIVATE = 'Room is currently in a private show' + _ROOM_AWAY = 'Performer is currently away' + _ROOM_PASSWORD = 'Room is password protected' + _ROOM_HIDDEN = 'Hidden session in progress'...
yt_dlp/extractor/chaturbate.py
26
Python
0.714
suggestion
144
51
51
false
[ie/chaturbate] Extract from API and support impersonation
11,555
yt-dlp/yt-dlp
132,642
Python
bashonly
powergold1
if f'_{known_id}' in m3u8_url: m3u8_id = known_id break else: m3u8_id = None formats.extend(self._extract_m3u8_formats( m3u8_url, video_id, ext='mp4', # ffmpeg skips segments for fast m3u8 ...
I think we could do this ```suggestion return self._extract_from_api(video_id, tld) or self._extract_from_webpage(video_id, tld) ```
import re from .common import InfoExtractor from ..utils import ( ExtractorError, lowercase_escape, url_or_none, urlencode_postdata, ) class ChaturbateIE(InfoExtractor): _VALID_URL = r'https?://(?:[^/]+\.)?chaturbate\.(?P<tld>com|eu|global)/(?:fullvideo/?\?.*?\bb=)?(?P<id>[^/?&#]+)' _TESTS = ...
@@ -113,3 +158,10 @@ def _real_extract(self, url): 'is_live': True, 'formats': formats, } + + def _real_extract(self, url): + video_id, tld = self._match_valid_url(url).group('id', 'tld') + extraction = self._extract_from_api(video_id, tld) + if extraction is N...
yt_dlp/extractor/chaturbate.py
26
Python
0.786
refactor
143
27
155
false
[ie/chaturbate] Extract from API and support impersonation
11,555
yt-dlp/yt-dlp
132,642
Python
bashonly
powergold1
'only_matching': True, }, { 'url': 'https://chaturbate.eu/fullvideo/?b=caylin', 'only_matching': True, }, { 'url': 'https://chaturbate.global/siswet19/', 'only_matching': True, }] _ERROR_MAP = { 'offline': 'Room is currently offline', 'private': '...
```suggestion }, fatal=False, impersonate=True) or {} ```
'only_matching': True, }, { 'url': 'https://chaturbate.eu/fullvideo/?b=caylin', 'only_matching': True, }, { 'url': 'https://chaturbate.global/siswet19/', 'only_matching': True, }] _ERROR_MAP = { 'offline': 'Room is currently offline', 'private': '...
@@ -40,14 +41,47 @@ class ChaturbateIE(InfoExtractor): 'only_matching': True, }] - _ROOM_OFFLINE = 'Room is currently offline' + _ERROR_MAP = { + 'offline': 'Room is currently offline', + 'private': 'Room is currently in a private show', + 'away': 'Performer is currently away'...
yt_dlp/extractor/chaturbate.py
26
Python
0.571
suggestion
71
51
51
false
[ie/chaturbate] Extract from API and support impersonation
11,555
yt-dlp/yt-dlp
132,642
Python
bashonly
powergold1
response = self._download_json( f'https://chaturbate.{tld}/get_edge_hls_url_ajax/', video_id, data=urlencode_postdata({'room_slug': video_id}), headers={ **self.geo_verification_headers(), 'X-Requested-With': 'XMLHttpRequest', '...
```suggestion 'is_live': True, 'age_limit': 18, 'formats': self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4', live=True), ```
response = self._download_json( f'https://chaturbate.{tld}/get_edge_hls_url_ajax/', video_id, data=urlencode_postdata({'room_slug': video_id}), headers={ **self.geo_verification_headers(), 'X-Requested-With': 'XMLHttpRequest', '...
@@ -40,14 +41,47 @@ class ChaturbateIE(InfoExtractor): 'only_matching': True, }] - _ROOM_OFFLINE = 'Room is currently offline' + _ERROR_MAP = { + 'offline': 'Room is currently offline', + 'private': 'Room is currently in a private show', + 'away': 'Performer is currently away'...
yt_dlp/extractor/chaturbate.py
26
Python
0.786
refactor
172
51
51
false
[ie/chaturbate] Extract from API and support impersonation
11,555
yt-dlp/yt-dlp
132,642
Python
bashonly
powergold1
timer = [None] ping_lock = threading.Lock() current_time = [0] ping_url = info_dict['_bunnycdn_ping_data']['url'] headers = info_dict['_bunnycdn_ping_data']['headers'] secret = info_dict['_bunnycdn_ping_data']['secret'] context_id = info_dict['_bunnycdn_ping_data...
`except network_exceptions` maybe?
self.to_screen(f'[{self.FD_NAME}] Downloading from BunnyCDN') fd = HlsFD(self.ydl, self.params) stop_event = threading.Event() ping_thread = threading.Thread(target=self.ping_thread, args=(stop_event,), kwargs=info_dict['_bunnycdn_ping_data']) ping_thread.start() try: ...
@@ -0,0 +1,64 @@ +import hashlib +import random +import threading + +from .common import FileDownloader +from . import HlsFD +from ..networking import Request + + +class BunnyCdnFD(FileDownloader): + """Downloads from BunnyCDN with required pings""" + + def real_download(self, filename, info_dict): + self....
yt_dlp/downloader/bunnycdn.py
26
Python
0.357
question
34
47
33
false
[ie/BunnyCDN] Add extractor
11,586
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
fd = HlsFD(self.ydl, self.params) success = download_complete = False timer = [None] ping_lock = threading.Lock() current_time = [0] ping_url = info_dict['_bunnycdn_ping_data']['url'] headers = info_dict['_bunnycdn_ping_data']['headers'] secret = info_d...
```suggestion headers=headers) ```
DO NOT USE """ def real_download(self, filename, info_dict): self.to_screen(f'[{self.FD_NAME}] Downloading from BunnyCDN') fd = HlsFD(self.ydl, self.params) stop_event = threading.Event() ping_thread = threading.Thread(target=self.ping_thread, args=(stop_event,), kwargs=in...
@@ -0,0 +1,64 @@ +import hashlib +import random +import threading + +from .common import FileDownloader +from . import HlsFD +from ..networking import Request + + +class BunnyCdnFD(FileDownloader): + """Downloads from BunnyCDN with required pings""" + + def real_download(self, filename, info_dict): + self....
yt_dlp/downloader/bunnycdn.py
26
Python
0.571
suggestion
52
51
37
false
[ie/BunnyCDN] Add extractor
11,586
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'thumbnail': r're:^https?://.*\.b-cdn\.net/0b02fa20-4e8c-4140-8f87-f64d820a3386/thumbnail\.jpg', 'title': 'Moscow subway. The train is arriving at the Park Kultury station.', 'upload_date': '20240531', 'duration': 18.0, 'timestamp': 1717152269, 'de...
```suggestion raise ExtractorError( 'This video is inaccessible. Setting a Referer header ' 'might be required to access the video', expected=True) ```
'thumbnail': r're:^https?://.*\.b-cdn\.net/0b02fa20-4e8c-4140-8f87-f64d820a3386/thumbnail\.jpg', 'title': 'Moscow subway. The train is arriving at the Park Kultury station.', 'upload_date': '20240531', 'duration': 18.0, 'timestamp': 1717152269, 'de...
@@ -0,0 +1,176 @@ +import json + +from .common import InfoExtractor +from ..networking import HEADRequest +from ..utils import ( + ExtractorError, + extract_attributes, + int_or_none, + parse_qs, + smuggle_url, + unsmuggle_url, + url_or_none, + urlhandle_detect_ext, +) +from ..utils.traversal im...
yt_dlp/extractor/bunnycdn.py
26
Python
0.929
refactor
199
51
51
false
[ie/BunnyCDN] Add extractor
11,586
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
if html_title := self._html_extract_title(webpage, default=None) == '403': raise ExtractorError('This video is inaccessible. Setting a Referer header might be required to access the video', expected=True) elif html_title == '404': raise ExtractorError('This video does not exist'...
```suggestion 'filesize': int_or_none(urlh.get_header('Content-Length')), ```
if html_title := self._html_extract_title(webpage, default=None) == '403': raise ExtractorError( 'This video is inaccessible. Setting a Referer header ' 'might be required to access the video', expected=True) elif html_title == '404': raise Extrac...
@@ -0,0 +1,176 @@ +import json + +from .common import InfoExtractor +from ..networking import HEADRequest +from ..utils import ( + ExtractorError, + extract_attributes, + int_or_none, + parse_qs, + smuggle_url, + unsmuggle_url, + url_or_none, + urlhandle_detect_ext, +) +from ..utils.traversal im...
yt_dlp/extractor/bunnycdn.py
26
Python
0.571
suggestion
99
51
51
false
[ie/BunnyCDN] Add extractor
11,586
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
'http_headers': headers, }) formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) ping_data = { '_bunnycdn_ping_data': { 'url': ping_url, 'headers': headers, ...
do we want the json ld data to overwrite everything else?
fmt.update({ 'protocol': 'bunnycdn', 'http_headers': headers, }) formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) ping_data = { '_bunnycdn_ping_data': { 'url...
@@ -0,0 +1,176 @@ +import json + +from .common import InfoExtractor +from ..networking import HEADRequest +from ..utils import ( + ExtractorError, + extract_attributes, + int_or_none, + parse_qs, + smuggle_url, + unsmuggle_url, + url_or_none, + urlhandle_detect_ext, +) +from ..utils.traversal im...
yt_dlp/extractor/bunnycdn.py
26
Python
0.214
question
57
26
28
false
[ie/BunnyCDN] Add extractor
11,586
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
self.report_warning(f'{e}; Re-extracting data') continue except GeoRestrictedError as e: msg = e.msg if e.countries: msg += '\nThis video is available in {}.'.format(', '.join( ...
`{:02}` is incorrect, and `{:02d}` could throw a ValueError if any of the items are float ```suggestion format_dur = lambda dur: '{:02.0f}:{:02.0f}:{:02.0f}'.format(*timetuple_from_msec(dur * 1000)[:-1]) ```
self.report_warning(f'{e}; Re-extracting data') continue except GeoRestrictedError as e: msg = e.msg if e.countries: msg += '\nThis video is available in {}.'.format(', '.join( ...
@@ -1654,7 +1654,7 @@ def _wait_for_video(self, ie_result={}): or ie_result.get('formats') or ie_result.get('url')): return - format_dur = lambda dur: '%02d:%02d:%02d' % timetuple_from_msec(dur * 1000)[:-1] + format_dur = lambda dur: '{:02}:{:02}:{:02}'.format(*timetuple_fr...
yt_dlp/YoutubeDL.py
26
Python
1
bug
218
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
(?:([0-9]{1,}):)? ([0-9]{2}): ([0-9]{2})\. ([0-9]{3})? ''') _REGEX_EOF = re.compile(r'\Z') _REGEX_NL = re.compile(r'(?:\r\n|[\r\n]|$)') _REGEX_BLANK = re.compile(r'(?:\r\n|[\r\n])+') _REGEX_OPTIONAL_WHITESPACE = re.compile(r'[ \t]*') def _parse_ts(ts): """ Convert a parsed WebVTT timestamp (a ...
```suggestion return '{:02.0f}:{:02.0f}:{:02.0f}.{:03.0f}'.format(*timetuple_from_msec(int((ts + 45) // 90))) ```
(?:([0-9]{1,}):)? ([0-9]{2}): ([0-9]{2})\. ([0-9]{3})? ''') _REGEX_EOF = re.compile(r'\Z') _REGEX_NL = re.compile(r'(?:\r\n|[\r\n]|$)') _REGEX_BLANK = re.compile(r'(?:\r\n|[\r\n])+') _REGEX_OPTIONAL_WHITESPACE = re.compile(r'[ \t]*') def _parse_ts(ts): """ Convert a parsed WebVTT timestamp (a ...
@@ -111,7 +111,7 @@ def _format_ts(ts): Convert an MPEG PES timestamp into a WebVTT timestamp. This will lose sub-millisecond precision. """ - return '%02u:%02u:%02u.%03u' % timetuple_from_msec(int((ts + 45) // 90)) + return '{:02d}:{:02d}:{:02d}.{:03d}'.format(*timetuple_from_msec(int((ts + 45) //...
yt_dlp/webvtt.py
26
Python
0.714
suggestion
119
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
and self.chapters == other.chapters and self.ranges == other.ranges) def __repr__(self): return f'{__name__}.{type(self).__name__}({self.chapters}, {self.ranges})' def parse_dfxp_time_expr(time_expr): if not time_expr: return mobj = re.match(rf'^(?P<time_offset>{NUMBER_RE...
```suggestion return '{:01.0f}:{:02.0f}:{:02.0f}.{:02.0f}'.format(*time[:-1], time.milliseconds / 10) ```
and self.chapters == other.chapters and self.ranges == other.ranges) def __repr__(self): return f'{__name__}.{type(self).__name__}({self.chapters}, {self.ranges})' def parse_dfxp_time_expr(time_expr): if not time_expr: return mobj = re.match(rf'^(?P<time_offset>{NUMBER_RE...
@@ -3380,12 +3380,12 @@ def parse_dfxp_time_expr(time_expr): def srt_subtitles_timecode(seconds): - return '%02d:%02d:%02d,%03d' % timetuple_from_msec(seconds * 1000) + return '{:02d}:{:02d}:{:02d},{:03d}'.format(*map(int, timetuple_from_msec(seconds * 1000))) def ass_subtitles_timecode(seconds): t...
yt_dlp/utils/_utils.py
26
Python
0.714
suggestion
111
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
def _handle_negative_timestamp(time, info): return max(info['duration'] + time, 0) if info.get('duration') and time < 0 else time def __eq__(self, other): return (isinstance(other, download_range_func) and self.chapters == other.chapters and self.ranges == other.ranges) def...
```suggestion return '{:02.0f}:{:02.0f}:{:02.0f},{:03.0f}'.format(*timetuple_from_msec(seconds * 1000)) ```
def _handle_negative_timestamp(time, info): return max(info['duration'] + time, 0) if info.get('duration') and time < 0 else time def __eq__(self, other): return (isinstance(other, download_range_func) and self.chapters == other.chapters and self.ranges == other.ranges) def...
@@ -3380,12 +3380,12 @@ def parse_dfxp_time_expr(time_expr): def srt_subtitles_timecode(seconds): - return '%02d:%02d:%02d,%03d' % timetuple_from_msec(seconds * 1000) + return '{:02d}:{:02d}:{:02d},{:03d}'.format(*map(int, timetuple_from_msec(seconds * 1000)))
yt_dlp/utils/_utils.py
26
Python
0.714
suggestion
113
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
default = '' if proc.__text_mode else b'' stdout, stderr = proc.communicate_or_kill(timeout=timeout) return stdout or default, stderr or default, proc.returncode def encodeArgument(s): # Legacy code that uses byte strings # Uncomment the following line after fixing all post...
```suggestion ret = f'{time.hours:.0f}{delim}{time.minutes:02.0f}{delim}{time.seconds:02.0f}' ```
default = '' if proc.__text_mode else b'' stdout, stderr = proc.communicate_or_kill(timeout=timeout) return stdout or default, stderr or default, proc.returncode def encodeArgument(s): # Legacy code that uses byte strings # Uncomment the following line after fixing all post...
@@ -927,12 +927,12 @@ def timetuple_from_msec(msec): def formatSeconds(secs, delim=':', msec=False): time = timetuple_from_msec(secs * 1000) if time.hours: - ret = '%d%s%02d%s%02d' % (time.hours, delim, time.minutes, delim, time.seconds) + ret = f'{time.hours}{delim}{time.minutes:02d}{delim}{ti...
yt_dlp/utils/_utils.py
26
Python
0.714
suggestion
107
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
return stdout or default, stderr or default, proc.returncode def encodeArgument(s): # Legacy code that uses byte strings # Uncomment the following line after fixing all post processors # assert isinstance(s, str), 'Internal error: %r should be of type %r, is %r' % (s, str, type(s)) return ...
```suggestion ret = f'{time.minutes:.0f}{delim}{time.seconds:02.0f}' ```
return stdout or default, stderr or default, proc.returncode def encodeArgument(s): # Legacy code that uses byte strings # Uncomment the following line after fixing all post processors # assert isinstance(s, str), 'Internal error: %r should be of type %r, is %r' % (s, str, type(s)) return ...
@@ -927,12 +927,12 @@ def timetuple_from_msec(msec): def formatSeconds(secs, delim=':', msec=False): time = timetuple_from_msec(secs * 1000) if time.hours: - ret = '%d%s%02d%s%02d' % (time.hours, delim, time.minutes, delim, time.seconds) + ret = f'{time.hours}{delim}{time.minutes:02d}{delim}{ti...
yt_dlp/utils/_utils.py
26
Python
0.571
suggestion
82
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
def encodeArgument(s): # Legacy code that uses byte strings # Uncomment the following line after fixing all post processors # assert isinstance(s, str), 'Internal error: %r should be of type %r, is %r' % (s, str, type(s)) return s if isinstance(s, str) else s.decode('ascii') _timetuple = collections....
```suggestion ret = f'{time.seconds:.0f}' ```
def encodeArgument(s): # Legacy code that uses byte strings # Uncomment the following line after fixing all post processors # assert isinstance(s, str), 'Internal error: %r should be of type %r, is %r' % (s, str, type(s)) return s if isinstance(s, str) else s.decode('ascii') _timetuple = collections....
@@ -927,12 +927,12 @@ def timetuple_from_msec(msec): def formatSeconds(secs, delim=':', msec=False): time = timetuple_from_msec(secs * 1000) if time.hours: - ret = '%d%s%02d%s%02d' % (time.hours, delim, time.minutes, delim, time.seconds) + ret = f'{time.hours}{delim}{time.minutes:02d}{delim}{ti...
yt_dlp/utils/_utils.py
26
Python
0.571
suggestion
55
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
def encodeArgument(s): # Legacy code that uses byte strings # Uncomment the following line after fixing all post processors # assert isinstance(s, str), 'Internal error: %r should be of type %r, is %r' % (s, str, type(s)) return s if isinstance(s, str) else s.decode('ascii') _timetuple = collections.n...
```suggestion return f'{ret}.{time.milliseconds:03.0f}' if msec else ret ```
def encodeArgument(s): # Legacy code that uses byte strings # Uncomment the following line after fixing all post processors # assert isinstance(s, str), 'Internal error: %r should be of type %r, is %r' % (s, str, type(s)) return s if isinstance(s, str) else s.decode('ascii') _timetuple = collections.n...
@@ -927,12 +927,12 @@ def timetuple_from_msec(msec): def formatSeconds(secs, delim=':', msec=False): time = timetuple_from_msec(secs * 1000) if time.hours: - ret = '%d%s%02d%s%02d' % (time.hours, delim, time.minutes, delim, time.seconds) + ret = f'{time.hours}{delim}{time.minutes:02d}{delim}{ti...
yt_dlp/utils/_utils.py
26
Python
0.571
suggestion
82
51
51
false
[cleanup] Bump ruff to 0.8.x
11,608
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev