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
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = r'https?://matchtv\.ru/on-air' _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'matchtv-live', 'ext': 'mp4', 'title': r're:^Матч ТВ - Прямой эфир \d{4}-\d{2}-...
```suggestion _VALID_URL = [ r'https?://matchtv\.ru/on-air', r'https?://video\.matchtv\.ru/iframe/channel/106', ] ```
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = [ r'https?://matchtv\.ru/on-air/?(?:$|[?#])', r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])', ] _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'ma...
@@ -1,51 +1,29 @@ -import random - from .common import InfoExtractor -from ..utils import xpath_text class MatchTVIE(InfoExtractor): - _VALID_URL = r'https?://matchtv\.ru(?:/on-air|/?#live-player)' + _VALID_URL = r'https?://matchtv\.ru/on-air'
yt_dlp/extractor/matchtv.py
5
Python
0.714
suggestion
146
30
30
false
[ie/matchtv] Fix extractor
10,190
yt-dlp/yt-dlp
132,642
Python
seproDev
megumintyan
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = [ r'https?://matchtv\.ru/on-air', r'https?://video\.matchtv\.ru/iframe/channel/106', ] _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'matchtv-live', ...
`[^?]*` could match a whole lot more than we want it to if the site starts using URLs without query params. Need to find a more well-defined pattern IMO
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = [ r'https?://matchtv\.ru/on-air/?(?:$|[?#])', r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])', ] _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'ma...
@@ -1,51 +1,32 @@ -import random - from .common import InfoExtractor -from ..utils import xpath_text class MatchTVIE(InfoExtractor): - _VALID_URL = r'https?://matchtv\.ru(?:/on-air|/?#live-player)' + _VALID_URL = [ + r'https?://matchtv\.ru/on-air', + r'https?://video\.matchtv\.ru/iframe/channe...
yt_dlp/extractor/matchtv.py
26
Python
0.571
suggestion
152
33
36
false
[ie/matchtv] Fix extractor
10,190
yt-dlp/yt-dlp
132,642
Python
bashonly
megumintyan
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = [ r'https?://matchtv\.ru/on-air', r'https?://video\.matchtv\.ru/iframe/channel/106', ] _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'matchtv-live', ...
```suggestion r'data-config="config=(https?://[^?"]+)[?"]', webpage, 'video URL').replace('/feed/', '/media/') + '.m3u8' ```
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = [ r'https?://matchtv\.ru/on-air/?(?:$|[?#])', r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])', ] _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'ma...
@@ -1,51 +1,32 @@ -import random - from .common import InfoExtractor -from ..utils import xpath_text class MatchTVIE(InfoExtractor): - _VALID_URL = r'https?://matchtv\.ru(?:/on-air|/?#live-player)' + _VALID_URL = [ + r'https?://matchtv\.ru/on-air', + r'https?://video\.matchtv\.ru/iframe/channe...
yt_dlp/extractor/matchtv.py
26
Python
0.786
suggestion
138
33
36
false
[ie/matchtv] Fix extractor
10,190
yt-dlp/yt-dlp
132,642
Python
bashonly
megumintyan
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = [ r'https?://matchtv\.ru/on-air', r'https?://video\.matchtv\.ru/iframe/channel/106', ] _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'matchtv-live', ...
```suggestion }, { 'url': 'https://video.matchtv.ru/iframe/channel/106', 'only_matching': True, }] ```
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = [ r'https?://matchtv\.ru/on-air/?(?:$|[?#])', r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])', ] _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'ma...
@@ -1,51 +1,32 @@ -import random - from .common import InfoExtractor -from ..utils import xpath_text class MatchTVIE(InfoExtractor): - _VALID_URL = r'https?://matchtv\.ru(?:/on-air|/?#live-player)' + _VALID_URL = [ + r'https?://matchtv\.ru/on-air', + r'https?://video\.matchtv\.ru/iframe/channe...
yt_dlp/extractor/matchtv.py
23
Python
0.714
suggestion
131
33
36
false
[ie/matchtv] Fix extractor
10,190
yt-dlp/yt-dlp
132,642
Python
bashonly
megumintyan
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = [ r'https?://matchtv\.ru/on-air', r'https?://video\.matchtv\.ru/iframe/channel/106', ] _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'matchtv-live', ...
```suggestion r'https?://matchtv\.ru/on-air/?(?:$|[?#])', r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])', ```
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = [ r'https?://matchtv\.ru/on-air/?(?:$|[?#])', r'https?://video\.matchtv\.ru/iframe/channel/106/?(?:$|[?#])', ] _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'ma...
@@ -1,51 +1,32 @@ -import random - from .common import InfoExtractor -from ..utils import xpath_text class MatchTVIE(InfoExtractor): - _VALID_URL = r'https?://matchtv\.ru(?:/on-air|/?#live-player)' + _VALID_URL = [ + r'https?://matchtv\.ru/on-air', + r'https?://video\.matchtv\.ru/iframe/channe...
yt_dlp/extractor/matchtv.py
7
Python
0.714
suggestion
143
32
32
false
[ie/matchtv] Fix extractor
10,190
yt-dlp/yt-dlp
132,642
Python
bashonly
megumintyan
return True @staticmethod def _create_url(user_id, video_id): return f'https://www.tiktok.com/@{user_id or "_"}/video/{video_id}' def _get_sigi_state(self, webpage, display_id): return self._search_json( r'<script[^>]+\bid="(?:SIGI_STATE|sigi-persisted-data)"[^>]*>', w...
should `urlencode_postdata` in the invocation of `_call_api()` instead
return True @staticmethod def _create_url(user_id, video_id): return f'https://www.tiktok.com/@{user_id or "_"}/video/{video_id}' def _get_sigi_state(self, webpage, display_id): return self._search_json( r'<script[^>]+\bid="(?:SIGI_STATE|sigi-persisted-data)"[^>]*>', w...
@@ -114,18 +115,21 @@ def _get_universal_data(self, webpage, display_id): 'universal data', display_id, end_pattern=r'</script>', default={}), ('__DEFAULT_SCOPE__', {dict})) or {} - def _call_api_impl(self, ep, query, video_id, fatal=True, + def _call_api_impl(self, ep, query, video_id...
yt_dlp/extractor/tiktok.py
26
Python
0.429
suggestion
70
51
51
false
[ie/tiktok] Fix API extraction
10,216
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
self.write_debug(str(self._APP_INFO)) real_query = self._build_api_query(query) try: return self._call_api_impl( ep, real_query, video_id, data=data, fatal=fatal, note=note, errnote=errnote) except ExtractorError as e: i...
formatting could use some work
try: return self._call_api_impl( ep, video_id, query=real_query, data=data, headers=headers, fatal=fatal, note=note, errnote=errnote) except ExtractorError as e: if isinstance(e.cause, json.JSONDecodeError) and e.cause.pos =...
@@ -204,10 +209,13 @@ def _call_api(self, ep, query, video_id, fatal=True, raise def _extract_aweme_app(self, aweme_id): - feed_list = self._call_api( - 'feed', {'aweme_id': aweme_id}, aweme_id, note='Downloading video feed', - errnote='Unable to download video feed'...
yt_dlp/extractor/tiktok.py
26
Python
0.143
style
30
51
51
false
[ie/tiktok] Fix API extraction
10,216
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly
-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 (?P<id>\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...
@@ -72,7 +72,7 @@ class AfreecaTVIE(AfreecaTVBaseIE): )\?.*?\bnTitleNo=| vod\.afreecatv\.com/(PLAYER/STATION|player)/ ) - (?P<id>\d+) + (?P<id>\d+)[^/]*$
yt_dlp/extractor/afreecatv.py
26
Python
0.571
suggestion
68
51
51
false
[afreecatv] Support catchstory
10,235
yt-dlp/yt-dlp
132,642
Python
bashonly
hui1601
'title': common_info.get('title'), } common_info['timestamp'] = traverse_obj(entries, (..., 'timestamp'), get_all=False) return self.playlist_result(entries, video_id, multi_video=True, **common_info) class AfreecaTVCatchStoryIE(AfreecaTVBaseIE): IE_NAME = 'afreecatv:...
see https://github.com/yt-dlp/yt-dlp/pull/10174#issuecomment-2195320898 about using `impersonate` instead of insecure requests also, let's use `traverse_obj` below when we iterate over the data instead of `.get()` here ```suggestion data = self._download_json( 'https://api.m.afreecatv.com/catc...
'title': common_info.get('title'), } common_info['timestamp'] = traverse_obj(entries, (..., 'timestamp'), get_all=False) return self.playlist_result(entries, video_id, multi_video=True, **common_info) class AfreecaTVCatchStoryIE(AfreecaTVBaseIE): IE_NAME = 'afreecatv:...
@@ -253,6 +253,50 @@ def _real_extract(self, url): return self.playlist_result(entries, video_id, multi_video=True, **common_info) +class AfreecaTVCatchStoryIE(AfreecaTVBaseIE): + IE_NAME = 'afreecatv:catchstory' + IE_DESC = 'afreecatv.com catch story' + _VALID_URL = r'https?://vod\.afreecatv\.com...
yt_dlp/extractor/afreecatv.py
26
Python
0.857
suggestion
459
51
51
false
[afreecatv] Support catchstory
10,235
yt-dlp/yt-dlp
132,642
Python
bashonly
hui1601
'http://api.m.afreecatv.com/catchstory/a/view', video_id, headers={'Referer': url}, query={'aStoryListIdx': '', 'nStoryIdx': video_id}).get('data', []) entries = [] for story in data: if story.get('story_type') != 'catch': break for catch i...
- avoid append loops for entries, use a generator/PagedList when possible - we can use traversal to filter for what we need, check value types, and transform values - `write_timestamp` is found in `catch`, not `file` - `duration` is in milliseconds, we need to convert - the URLs are m3u8s, so `http` is not correct ...
query={'aStoryListIdx': '', 'nStoryIdx': video_id}, impersonate=True) return self.playlist_result(self._entries(data), video_id) @staticmethod def _entries(data): # 'files' is always a list with 1 element yield from traverse_obj(data, ( 'data', lambda _, v: v['s...
@@ -253,6 +253,50 @@ def _real_extract(self, url): return self.playlist_result(entries, video_id, multi_video=True, **common_info) +class AfreecaTVCatchStoryIE(AfreecaTVBaseIE): + IE_NAME = 'afreecatv:catchstory' + IE_DESC = 'afreecatv.com catch story' + _VALID_URL = r'https?://vod\.afreecatv\.com...
yt_dlp/extractor/afreecatv.py
26
Python
1
suggestion
1,339
51
51
false
[afreecatv] Support catchstory
10,235
yt-dlp/yt-dlp
132,642
Python
bashonly
hui1601
_VALID_URL = r'https?://vod\.afreecatv\.com/player/(?P<id>\d+)/catchstory' _TESTS = [{ 'url': 'https://vod.afreecatv.com/player/103247/catchstory', 'info_dict': { 'id': '103247', }, 'playlist_count': 2, }] def _real_extract(self, url): video_id = self...
we don't want this. the test's url is an m3u8 and this value is mp4. it will not download correctly if yt-dlp thinks an m3u8 is an mp4 ```suggestion ```
_VALID_URL = r'https?://vod\.afreecatv\.com/player/(?P<id>\d+)/catchstory' _TESTS = [{ 'url': 'https://vod.afreecatv.com/player/103247/catchstory', 'info_dict': { 'id': '103247', }, 'playlist_count': 2, }] def _real_extract(self, url): video_id = self...
@@ -253,6 +253,44 @@ def _real_extract(self, url): return self.playlist_result(entries, video_id, multi_video=True, **common_info) +class AfreecaTVCatchStoryIE(AfreecaTVBaseIE): + IE_NAME = 'afreecatv:catchstory' + IE_DESC = 'afreecatv.com catch story' + _VALID_URL = r'https?://vod\.afreecatv\.com...
yt_dlp/extractor/afreecatv.py
26
Python
0.714
suggestion
154
51
51
false
[afreecatv] Support catchstory
10,235
yt-dlp/yt-dlp
132,642
Python
bashonly
hui1601
ERROR: type should be string, got " https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/sync/key_storage_util_linux.h\n SelectedLinuxBackend\n \"\"\"\n KWALLET = auto() # KDE4\n KWALLET5 = auto()\n KWALLET6 = auto()\n GNOMEKEYRING = auto()\n BASICTEXT = auto()\n\n\nSUPPORTED_KEYRINGS = _LinuxKeyring.__members__.keys()\n\nSUPPORTED_DESKTOP_ENVS = {'Unity', 'Deepin', 'GNOME', 'X-Cinnamon', 'KDE', 'Pantheon', 'XFCE', 'UKUI', 'LXQt'}\n\n\ndef _get_linux_desktop_environment(env, logger):\n \"\"\"\n https://chromium.googlesource.com/chromium/src/+/refs/heads/main/base/nix/xdg_util.cc\n GetDesktopEnvironment\n \"\"\"\n xdg_current_desktop = env.get('XDG_CURRENT_DESKTOP', None)\n desktop_session = env.get('DESKTOP_SESSION', None)\n if xdg_current_desktop is not None:\n xdg_current_desktop = [env.strip() for env in xdg_current_desktop.split(':')]\n xdg_current_desktop = next(\n (env for env in xdg_current_desktop if env in SUPPORTED_DESKTOP_ENVS), xdg_current_desktop[0])\n\n if xdg_current_desktop == 'Unity':\n if desktop_session is not None and 'gnome-fallback' in desktop_session:\n return _LinuxDesktopEnvironment.GNOME\n else:\n return _LinuxDesktopEnvironment.UNITY\n elif xdg_current_desktop == 'Deepin':\n return _LinuxDesktopEnvironment.DEEPIN\n elif xdg_current_desktop == 'GNOME':\n return _LinuxDesktopEnvironment.GNOME\n elif xdg_current_desktop == 'X-Cinnamon':\n return _LinuxDesktopEnvironment.CINNAMON\n elif xdg_current_desktop == 'KDE':\n kde_version = env.get('KDE_SESSION_VERSION', None)\n if kde_version == '5':\n return _LinuxDesktopEnvironment.KDE5\n elif kde_version == '6':\n return _LinuxDesktopEnvironment.KDE6\n elif kde_version == '4':\n return _LinuxDesktopEnvironment.KDE4\n else:\n logger.info(f'unknown KDE version: \"{kde_version}\". Assuming KDE4')\n return _LinuxDesktopEnvironment.KDE4\n elif xdg_current_desktop == 'Pantheon':\n return _LinuxDesktopEnvironment.PANTHEON"
Instead of doing this, I think this would be better suited to be doing a `for`, like: ```py for part in map(str.strip, xdg_current_desktop.split(':')): if part == 'Unity': ... elif part == 'Deepin': return _LinuxDesktopEnvironment.DEEPIN els...
ERROR: type should be string, got " https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/sync/key_storage_util_linux.h\n SelectedLinuxBackend\n \"\"\"\n KWALLET = auto() # KDE4\n KWALLET5 = auto()\n KWALLET6 = auto()\n GNOMEKEYRING = auto()\n BASICTEXT = auto()\n\n\nSUPPORTED_KEYRINGS = _LinuxKeyring.__members__.keys()\n\n\ndef _get_linux_desktop_environment(env, logger):\n \"\"\"\n https://chromium.googlesource.com/chromium/src/+/refs/heads/main/base/nix/xdg_util.cc\n GetDesktopEnvironment\n \"\"\"\n xdg_current_desktop = env.get('XDG_CURRENT_DESKTOP', None)\n desktop_session = env.get('DESKTOP_SESSION', None)\n if xdg_current_desktop is not None:\n for part in map(str.strip, xdg_current_desktop.split(':')):\n if part == 'Unity':\n if desktop_session is not None and 'gnome-fallback' in desktop_session:\n return _LinuxDesktopEnvironment.GNOME\n else:\n return _LinuxDesktopEnvironment.UNITY\n elif part == 'Deepin':\n return _LinuxDesktopEnvironment.DEEPIN\n elif part == 'GNOME':\n return _LinuxDesktopEnvironment.GNOME\n elif part == 'X-Cinnamon':\n return _LinuxDesktopEnvironment.CINNAMON\n elif part == 'KDE':\n kde_version = env.get('KDE_SESSION_VERSION', None)\n if kde_version == '5':\n return _LinuxDesktopEnvironment.KDE5\n elif kde_version == '6':\n return _LinuxDesktopEnvironment.KDE6\n elif kde_version == '4':\n return _LinuxDesktopEnvironment.KDE4\n else:\n logger.info(f'unknown KDE version: \"{kde_version}\". Assuming KDE4')\n return _LinuxDesktopEnvironment.KDE4\n elif part == 'Pantheon':\n return _LinuxDesktopEnvironment.PANTHEON\n elif part == 'XFCE':\n return _LinuxDesktopEnvironment.XFCE\n elif part == 'UKUI':\n return _LinuxDesktopEnvironment.UKUI\n elif part == 'LXQt':"
@@ -740,7 +742,9 @@ def _get_linux_desktop_environment(env, logger): xdg_current_desktop = env.get('XDG_CURRENT_DESKTOP', None) desktop_session = env.get('DESKTOP_SESSION', None) if xdg_current_desktop is not None: - xdg_current_desktop = xdg_current_desktop.split(':')[0].strip() + xdg_curr...
yt_dlp/cookies.py
26
Python
0.857
refactor
523
51
51
false
[cookies] Fix getting Linux desktop env from `$XDG_CURRENT_DESKTOP` in Ubuntu
10,237
yt-dlp/yt-dlp
132,642
Python
Grub4K
peisenwang
def what(file=None, h=None): """ Detect format of image (Currently supports jpeg, png, webp, gif only) """ if h is None: with open(file, 'rb') as f: h = f.read(12) if h.startswith(b'RIFF') and h.startswith(b'WEBP', 8): return 'webp' if h.startswith(b'\x89PNG'): retu...
```suggestion """ Detect format of image (Currently supports jpeg, png, webp, gif only) Ref: https://github.com/python/cpython/blob/3.11/Lib/imghdr.py Ref: https://www.w3.org/Graphics/JPEG/itu-t81.pdf """ ```
def what(file=None, h=None): """Detect format of image (Currently supports jpeg, png, webp, gif only) Ref: https://github.com/python/cpython/blob/3.11/Lib/imghdr.py Ref: https://www.w3.org/Graphics/JPEG/itu-t81.pdf """ if h is None: with open(file, 'rb') as f: h = f.read(12) ...
@@ -1,16 +1,19 @@ -tests = { - 'webp': lambda h: h[0:4] == b'RIFF' and h[8:] == b'WEBP', - 'png': lambda h: h[:8] == b'\211PNG\r\n\032\n', - 'jpeg': lambda h: h[6:10] in (b'JFIF', b'Exif'), - 'gif': lambda h: h[:6] in (b'GIF87a', b'GIF89a'), -} - - def what(file=None, h=None): - """Detect format of imag...
yt_dlp/compat/imghdr.py
2
Python
0.786
suggestion
229
20
23
false
[pp/embedthumbnail] Fix
10,248
yt-dlp/yt-dlp
132,642
Python
bashonly
Grub4K
}), } return self._download_json( urljoin('https://interface3.music.163.com/', f'/eapi{path}'), video_id, data=self._create_eapi_cipher(f'/api{path}', query_body, cookies), headers={ 'Referer': 'https://music.163.com', 'Cookie': '; '.jo...
should also add this so yt-dlp knows it's an audio-only format ```suggestion 'format_id': song_level, 'vcodec': 'none', ```
'versioncode': '140', 'mobilename': 'undefined', 'buildver': '1623435496', 'resolution': '1920x1080', '__csrf': '', 'os': 'pc', 'channel': 'undefined', 'requestId': f'{int(time.time() * 1000)}_{random.randint(0, 1000):04}', ...
@@ -66,27 +66,22 @@ def _download_eapi_json(self, path, video_id, query_body, headers={}, **kwargs): **headers, }, **kwargs) - def _call_player_api(self, song_id, bitrate): + def _call_player_api(self, song_id, level): return self._download_eapi_json( - '/song/e...
yt_dlp/extractor/neteasemusic.py
26
Python
0.786
suggestion
175
51
51
false
[ie/neteasemusic] Use new API for url extraction
10,258
yt-dlp/yt-dlp
132,642
Python
bashonly
hafeoz
'requestId': f'{int(time.time() * 1000)}_{random.randint(0, 1000):04}', **traverse_obj(self._get_cookies(self._API_BASE), { 'MUSIC_U': ('MUSIC_U', {lambda i: i.value}), }), } return self._download_json( urljoin('https://interface3.music.163...
this is wrong. there is no `level` field in the format dicts
'osver': 'undefined', 'deviceId': 'undefined', 'appver': '8.0.0', 'versioncode': '140', 'mobilename': 'undefined', 'buildver': '1623435496', 'resolution': '1920x1080', '__csrf': '', 'os': 'pc', 'chann...
@@ -66,45 +66,40 @@ def _download_eapi_json(self, path, video_id, query_body, headers={}, **kwargs): **headers, }, **kwargs) - def _call_player_api(self, song_id, bitrate): + def _call_player_api(self, song_id, level): return self._download_eapi_json( - '/song/e...
yt_dlp/extractor/neteasemusic.py
26
Python
0.357
bug
60
51
51
false
[ie/neteasemusic] Use new API for url extraction
10,258
yt-dlp/yt-dlp
132,642
Python
bashonly
hafeoz
} return self._download_json( urljoin('https://interface3.music.163.com/', f'/eapi{path}'), video_id, data=self._create_eapi_cipher(f'/api{path}', query_body, cookies), headers={ 'Referer': 'https://music.163.com', 'Cookie': '; '.join([f'{k}={v}' f...
if we already `break` upon reaching a dupe, when will this code path be reached?
'mobilename': 'undefined', 'buildver': '1623435496', 'resolution': '1920x1080', '__csrf': '', 'os': 'pc', 'channel': 'undefined', 'requestId': f'{int(time.time() * 1000)}_{random.randint(0, 1000):04}', **traverse_obj(self._g...
@@ -66,45 +66,40 @@ def _download_eapi_json(self, path, video_id, query_body, headers={}, **kwargs): **headers, }, **kwargs) - def _call_player_api(self, song_id, bitrate): + def _call_player_api(self, song_id, level): return self._download_eapi_json( - '/song/e...
yt_dlp/extractor/neteasemusic.py
26
Python
0.357
question
80
51
51
false
[ie/neteasemusic] Use new API for url extraction
10,258
yt-dlp/yt-dlp
132,642
Python
bashonly
hafeoz
'channel': 'undefined', 'requestId': f'{int(time.time() * 1000)}_{random.randint(0, 1000):04}', **traverse_obj(self._get_cookies(self._API_BASE), { 'MUSIC_U': ('MUSIC_U', {lambda i: i.value}), }), } return self._download_json( u...
Maybe better to maintain a `set`, say `seen_levels`, and check for `song.get('level') in seen_levels`? Also, what if `song.get('level')` is `None` instead of being one of the levels already seen?
cookies = { 'osver': 'undefined', 'deviceId': 'undefined', 'appver': '8.0.0', 'versioncode': '140', 'mobilename': 'undefined', 'buildver': '1623435496', 'resolution': '1920x1080', '__csrf': '', 'os': 'pc'...
@@ -76,8 +76,8 @@ def _extract_formats(self, info): song_id = info['id'] for level in self._LEVELS: song = traverse_obj(self._call_player_api(song_id, level), ('data', 0, {dict})) or {} - if song.get('level') != level: - break # We have already extracted the hig...
yt_dlp/extractor/neteasemusic.py
26
Python
0.571
question
198
51
51
false
[ie/neteasemusic] Use new API for url extraction
10,258
yt-dlp/yt-dlp
132,642
Python
dirkf
hafeoz
'__csrf': '', 'os': 'pc', 'channel': 'undefined', 'requestId': f'{int(time.time() * 1000)}_{random.randint(0, 1000):04}', **traverse_obj(self._get_cookies(self._API_BASE), { 'MUSIC_U': ('MUSIC_U', {lambda i: i.value}), }), }...
Is there ever anything in `['data'][i]` for `i > 0`?
def _download_eapi_json(self, path, video_id, query_body, headers={}, **kwargs): cookies = { 'osver': 'undefined', 'deviceId': 'undefined', 'appver': '8.0.0', 'versioncode': '140', 'mobilename': 'undefined', 'buildver': '1623435496', ...
@@ -66,45 +66,39 @@ def _download_eapi_json(self, path, video_id, query_body, headers={}, **kwargs): **headers, }, **kwargs) - def _call_player_api(self, song_id, bitrate): + def _call_player_api(self, song_id, level): return self._download_eapi_json( - '/song/e...
yt_dlp/extractor/neteasemusic.py
26
Python
0.357
question
52
51
51
false
[ie/neteasemusic] Use new API for url extraction
10,258
yt-dlp/yt-dlp
132,642
Python
dirkf
hafeoz
from .common import InfoExtractor from ..utils import ( traverse_obj, ) class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', 'info_dict': { ...
- let's match any locale code just in case - we don't need capture groups that we don't actually capture ```suggestion _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' ```
from .common import InfoExtractor from ..utils import update_url, url_or_none from ..utils.traversal import traverse_obj class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', ...
@@ -0,0 +1,42 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class GraspopIE(InfoExtractor): + _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/'
yt_dlp/extractor/graspop.py
8
Python
0.714
suggestion
196
33
33
false
[ie/graspop] Add extractor
10,268
yt-dlp/yt-dlp
132,642
Python
bashonly
Niluge-KiWi
from .common import InfoExtractor from ..utils import ( traverse_obj, ) class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', 'info_dict': { ...
```suggestion from ..utils import url_or_none from ..utils.traversal import traverse_obj ```
from .common import InfoExtractor from ..utils import update_url, url_or_none from ..utils.traversal import traverse_obj class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', ...
@@ -0,0 +1,42 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +)
yt_dlp/extractor/graspop.py
4
Python
0.571
suggestion
95
29
29
false
[ie/graspop] Add extractor
10,268
yt-dlp/yt-dlp
132,642
Python
bashonly
Niluge-KiWi
from .common import InfoExtractor from ..utils import ( traverse_obj, ) class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', 'info_dict': { ...
```suggestion 'thumbnail': r're:https://cdn-mds\.pickx\.be/festivals/v3/global/original/.+\.jpg', ```
from .common import InfoExtractor from ..utils import update_url, url_or_none from ..utils.traversal import traverse_obj class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', ...
@@ -0,0 +1,42 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class GraspopIE(InfoExtractor): + _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' + _TESTS = [{ + 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/...
yt_dlp/extractor/graspop.py
16
Python
0.714
suggestion
115
41
33
false
[ie/graspop] Add extractor
10,268
yt-dlp/yt-dlp
132,642
Python
bashonly
Niluge-KiWi
from .common import InfoExtractor from ..utils import ( traverse_obj, ) class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', 'info_dict': { ...
Is this required for this site? I hope not. But if yes, then we should use `http` URLs for all requests. If it's only needed for your local configuration, then remove this and make use of `test/local_parameters.json` for running the tests
from .common import InfoExtractor from ..utils import update_url, url_or_none from ..utils.traversal import traverse_obj class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', ...
@@ -0,0 +1,42 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class GraspopIE(InfoExtractor): + _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' + _TESTS = [{ + 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/...
yt_dlp/extractor/graspop.py
21
Python
0.643
refactor
238
43
33
false
[ie/graspop] Add extractor
10,268
yt-dlp/yt-dlp
132,642
Python
bashonly
Niluge-KiWi
traverse_obj, ) class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', 'info_dict': { 'id': '101556', 'ext': 'mp4', ...
unnecessary comments ```suggestion ```
from ..utils.traversal import traverse_obj class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', 'info_dict': { 'id': '101556', 'ext': 'mp4', ...
@@ -0,0 +1,42 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class GraspopIE(InfoExtractor): + _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' + _TESTS = [{ + 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/...
yt_dlp/extractor/graspop.py
26
Python
0.429
suggestion
40
41
31
false
[ie/graspop] Add extractor
10,268
yt-dlp/yt-dlp
132,642
Python
bashonly
Niluge-KiWi
) class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', 'info_dict': { 'id': '101556', 'ext': 'mp4', 'title': ...
line too long ```suggestion metadata = self._download_json( f'https://tv.proximus.be/MWC/videocenter/festivals/{video_id}/stream', video_id) ```
class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', 'info_dict': { 'id': '101556', 'ext': 'mp4', 'title': 'Thy Art Is Murder', ...
@@ -0,0 +1,42 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class GraspopIE(InfoExtractor): + _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' + _TESTS = [{ + 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/...
yt_dlp/extractor/graspop.py
26
Python
0.714
refactor
168
40
30
false
[ie/graspop] Add extractor
10,268
yt-dlp/yt-dlp
132,642
Python
bashonly
Niluge-KiWi
'formats': 'count:4', }, 'params': { 'nocheckcertificate': True, }, }] def _real_extract(self, url): video_id = self._match_id(url) # e.g. https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/ # e.g. https://tv.proximus.be/MWC/video...
- we can inline all of this in the return - we don't need to use `traverse_obj` for the m3u8 url if the subsequent `_extract_m3u8_formats` call is fatal; we can let the KeyError rip - constructing the description like that doesn't seem useful to me ```suggestion return { 'id': video_id, ...
from .common import InfoExtractor from ..utils import update_url, url_or_none from ..utils.traversal import traverse_obj class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', ...
@@ -0,0 +1,42 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class GraspopIE(InfoExtractor): + _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' + _TESTS = [{ + 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/...
yt_dlp/extractor/graspop.py
26
Python
1
refactor
598
27
33
false
[ie/graspop] Add extractor
10,268
yt-dlp/yt-dlp
132,642
Python
bashonly
Niluge-KiWi
from .common import InfoExtractor from ..utils import ( traverse_obj, ) class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', 'info_dict': { ...
not needed. let the test script generate the test dict for you (as explained in the contributing guide's extractor template) ```suggestion ```
from .common import InfoExtractor from ..utils import update_url, url_or_none from ..utils.traversal import traverse_obj class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', ...
@@ -0,0 +1,42 @@ +from .common import InfoExtractor +from ..utils import ( + traverse_obj, +) + + +class GraspopIE(InfoExtractor): + _VALID_URL = r'https?://vod\.graspop\.be/(?P<lang>fr|nl)/(?P<id>[0-9]+)/(?P<title>.*)/' + _TESTS = [{ + 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/...
yt_dlp/extractor/graspop.py
17
Python
0.786
refactor
146
42
33
false
[ie/graspop] Add extractor
10,268
yt-dlp/yt-dlp
132,642
Python
bashonly
Niluge-KiWi
from .common import InfoExtractor from ..utils import url_or_none from ..utils.traversal import traverse_obj class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', 'info_d...
```suggestion 'formats': self._extract_m3u8_formats( # switch to http to avoid incomplete certificate chain error metadata['source']['assetUri'].replace('https://', 'http://'), video_id, 'mp4'), ```
from .common import InfoExtractor from ..utils import update_url, url_or_none from ..utils.traversal import traverse_obj class GraspopIE(InfoExtractor): _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' _TESTS = [{ 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-concert/', ...
@@ -0,0 +1,29 @@ +from .common import InfoExtractor +from ..utils import url_or_none +from ..utils.traversal import traverse_obj + + +class GraspopIE(InfoExtractor): + _VALID_URL = r'https?://vod\.graspop\.be/[a-z]{2}/(?P<id>\d+)/' + _TESTS = [{ + 'url': 'https://vod.graspop.be/fr/101556/thy-art-is-murder-...
yt_dlp/extractor/graspop.py
24
Python
1
refactor
246
30
33
false
[ie/graspop] Add extractor
10,268
yt-dlp/yt-dlp
132,642
Python
Niluge-KiWi
Niluge-KiWi
import base64 import json import re import time import urllib.parse import xml.etree.ElementTree from .common import InfoExtractor from ..utils import ( base_url, ExtractorError, float_or_none, int_or_none, join_nonempty, js_to_json, orderedSet, parse_iso8601, remove_end, smuggl...
Uppercase comes first ```suggestion ExtractorError, base_url, ```
import base64 import functools import json import re import time import urllib.parse import xml.etree.ElementTree from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( ExtractorError, float_or_none, int_or_none, join_nonempty, js_to_json, mimetype2ext, ...
@@ -7,16 +7,21 @@ from .common import InfoExtractor from ..utils import ( + base_url, ExtractorError,
yt_dlp/extractor/cbc.py
11
Python
0.786
refactor
77
36
36
false
[ie/cbc.ca:player] Fix extractor
10,302
yt-dlp/yt-dlp
132,642
Python
seproDev
trainman261
}) for sub in traverse_obj(data, ('media', 'textTracks', lambda _, v: url_or_none(v['src']))): subtitles.setdefault(sub.get('language') or 'und', []).append({ 'url': sub['src'], 'name': sub.get('label'), }) chapters = traverse_obj...
```suggestion 'is_live': ('media', 'streamType', {lambda x: x == 'Live'}), ```
continue asset_data = self._download_json(asset_key, video_id, f'Downloading {asset_type} JSON') ext = mimetype2ext(self._parse_param(asset_data, 'contentType')) if ext == 'm3u8': fmts, subs = self._extract_m3u8_formats_and_subtitles( ...
@@ -307,23 +373,85 @@ class CBCPlayerIE(InfoExtractor): 'only_matching': True, }] + def _parse_param(self, asset_data, name): + return traverse_obj(asset_data, ('params', lambda _, v: v['name'] == name, 'value', {str}, any)) + def _real_extract(self, url): video_id = self._match_...
yt_dlp/extractor/cbc.py
26
Python
0.714
suggestion
96
51
51
false
[ie/cbc.ca:player] Fix extractor
10,302
yt-dlp/yt-dlp
132,642
Python
bashonly
trainman261
if isinstance(e.cause, HTTPError) and e.cause.status == 401: raise ExtractorError('Wrong password', expected=True) raise def _real_extract(self, url): url, data, headers = self._unsmuggle_headers(url) if 'Referer' not in headers: heade...
Eventhough unchanged, I think `error` is better
if isinstance(e.cause, HTTPError) and e.cause.status == 401: raise ExtractorError('Wrong password', expected=True) raise def _real_extract(self, url): url, data, headers = self._unsmuggle_headers(url) if 'Referer' not in headers: heade...
@@ -829,21 +829,33 @@ def _real_extract(self, url): url = 'https://vimeo.com/' + video_id self._try_album_password(url) + is_secure = urllib.parse.urlparse(url).scheme == 'https' try: # Retrieve video webpage to extract further information webpage, urlh ...
yt_dlp/extractor/vimeo.py
26
Python
0.429
suggestion
47
51
51
false
[ie/vimeo] Support browser impersonation
10,327
yt-dlp/yt-dlp
132,642
Python
Grub4K
bashonly
'url': 'https://steviasphere.bandcamp.com/music', 'playlist_mincount': 47, 'info_dict': { 'id': 'steviasphere', 'title': 'Discography of steviasphere', }, }, { 'url': 'https://coldworldofficial.bandcamp.com/music', 'playlist_mincount': 10, ...
I would instead use a generator method to yield all the url paths ```suggestion def _yield_items(self, webpage): yield from ( re.findall(r'<li data-item-id=["\'][^>]+>\s*<a href=["\'](?![^"\'/]*?/merch)([^"\']+)', webpage) or re.findall(r'<div[^>]+trackTitle["\'][^"\']+["\']([^"...
'id': 'nightcallofficial', 'title': 'Discography of nightcallofficial', }, 'playlist_count': 4, }, { 'url': 'https://steviasphere.bandcamp.com/music', 'playlist_mincount': 47, 'info_dict': { 'id': 'steviasphere', 'title': 'Disco...
@@ -473,12 +473,20 @@ class BandcampUserIE(InfoExtractor): }, }] + def _extract_data_attr(self, webpage, video_id, attr, fatal=True): + return self._parse_json(self._html_search_regex( + fr'data-{attr}=(["\'])(\[.+?\])\1', webpage, + attr + ' data', group=2), video_id, fa...
yt_dlp/extractor/bandcamp.py
26
Python
0.857
refactor
555
40
44
false
[ie/bandcamp] Extract extended user page
10,328
yt-dlp/yt-dlp
132,642
Python
bashonly
quad
}, { 'url': 'https://nuclearwarnowproductions.bandcamp.com/music', 'playlist_mincount': 399, 'info_dict': { 'id': 'nuclearwarnowproductions', 'title': 'Discography of nuclearwarnowproductions', }, }] def _extract_data_attr(self, webpage, video_id, att...
and then do this ```suggestion return self.playlist_from_matches( self._yield_items(webpage), uploader, f'Discography of {uploader}', getter=functools.partial(urljoin, url)) ```
'playlist_mincount': 7, 'info_dict': { 'id': 'coldworldofficial', 'title': 'Discography of coldworldofficial', }, }, { 'url': 'https://nuclearwarnowproductions.bandcamp.com/music', 'playlist_mincount': 399, 'info_dict': { 'id': 'nuc...
@@ -473,12 +473,20 @@ class BandcampUserIE(InfoExtractor): }, }] + def _extract_data_attr(self, webpage, video_id, attr, fatal=True): + return self._parse_json(self._html_search_regex( + fr'data-{attr}=(["\'])(\[.+?\])\1', webpage, + attr + ' data', group=2), video_id, fa...
yt_dlp/extractor/bandcamp.py
26
Python
0.786
suggestion
214
27
31
false
[ie/bandcamp] Extract extended user page
10,328
yt-dlp/yt-dlp
132,642
Python
bashonly
quad
'tags': ['Paryż', 'Francja', 'Polska', 'Imigranci', 'Morawiecki', 'Tusk'], 'like_count': int, 'dislike_count': int, 'view_count': int, 'comment_count': int, }, }] def _real_extract(self, url): video_id = self._match_id(url) pla...
```suggestion if master_url := traverse_obj(url_data, ('src', 'hls', 'masterPlaylist', {url_or_none})): formats = self._extract_m3u8_formats(master_url, video_id, 'mp4', m3u8_id='hls', fatal=False) ```
'timestamp': 1688642656, 'upload_date': '20230706', 'thumbnail': 'https://cdn.banbye.com/video/v_kb6_o1Kyq-CD/96.webp', 'tags': ['Paryż', 'Francja', 'Polska', 'Imigranci', 'Morawiecki', 'Tusk'], 'like_count': int, 'dislike_count': int, ...
@@ -91,11 +94,27 @@ def _real_extract(self, url): 'id': f'{quality}p', 'url': f'{self._CDN_BASE}/video/{video_id}/{quality}.webp', } for quality in [48, 96, 144, 240, 512, 1080]] - formats = [{ - 'format_id': f'http-{quality}p', - 'quality': quality, - ...
yt_dlp/extractor/banbye.py
26
Python
0.857
refactor
224
51
51
false
[ie/banbye] Fix extractor
10,332
yt-dlp/yt-dlp
132,642
Python
bashonly
PatrykMis
data = self._download_json(f'{self._API_BASE}/videos/{video_id}', video_id) thumbnails = [{ 'id': f'{quality}p', 'url': f'{self._CDN_BASE}/video/{video_id}/{quality}.webp', } for quality in [48, 96, 144, 240, 512, 1080]] formats = [] url_data = self._downl...
- we should always reach this code path (not only `if not formats`) in case there are direct mp4 formats available as well as m3u8 formats - the `levels` m3u8s are variant playlists, so we don't need to call `_extract_m3u8_formats`, we can just append to `formats`, which simplifies this a bit - call `self._remove_dup...
'title': 'md5:183524056bebdfa245fd6d214f63c0fe', 'description': 'md5:943ac87287ca98d28d8b8797719827c6', 'uploader': 'wRealu24', 'channel_id': 'ch_wrealu24', 'channel_url': 'https://banbye.com/channel/ch_wrealu24', 'upload_date': '20231113', ...
@@ -91,11 +94,27 @@ def _real_extract(self, url): 'id': f'{quality}p', 'url': f'{self._CDN_BASE}/video/{video_id}/{quality}.webp', } for quality in [48, 96, 144, 240, 512, 1080]] - formats = [{ - 'format_id': f'http-{quality}p', - 'quality': quality, - ...
yt_dlp/extractor/banbye.py
26
Python
0.857
refactor
1,026
51
51
false
[ie/banbye] Fix extractor
10,332
yt-dlp/yt-dlp
132,642
Python
bashonly
PatrykMis
import math import urllib.parse from .common import InfoExtractor from ..utils import ( InAdvancePagedList, determine_ext, format_field, int_or_none, traverse_obj, unified_timestamp, url_or_none, ) class BanByeBaseIE(InfoExtractor): _API_BASE = 'https://api.banbye.com' _CDN_BASE =...
if applying my formats suggestion, we'll need `join_nonempty`: ```suggestion format_field, int_or_none, join_nonempty, traverse_obj, ```
import math import urllib.parse from .common import InfoExtractor from ..utils import ( InAdvancePagedList, determine_ext, format_field, int_or_none, join_nonempty, traverse_obj, unified_timestamp, url_or_none, ) class BanByeBaseIE(InfoExtractor): _API_BASE = 'https://api.banbye.c...
@@ -4,9 +4,12 @@ from .common import InfoExtractor from ..utils import ( InAdvancePagedList, + determine_ext, format_field, + int_or_none, traverse_obj,
yt_dlp/extractor/banbye.py
10
Python
0.714
suggestion
158
35
35
false
[ie/banbye] Fix extractor
10,332
yt-dlp/yt-dlp
132,642
Python
bashonly
PatrykMis
_TESTS = [{ 'url': 'https://banbye.com/channel/ch_wrealu24', 'info_dict': { 'title': 'wRealu24', 'id': 'ch_wrealu24', 'description': 'md5:da54e48416b74dfdde20a04867c0c2f6', }, 'playlist_mincount': 791, }, { 'url': 'https://banbye.com/ch...
Just as a note: this will throw a 404 warning for some videos. This is expected, the browser makes an additional head request, which also 404s. I think it is fine to leave as is and not suppress the warning.
'view_count': int, 'like_count': int, 'dislike_count': int, 'comment_count': int, 'thumbnail': 'https://cdn.banbye.com/video/v_B0rsKWsr-aaa/96.webp', 'tags': ['Biden', 'Trump', 'Wybory', 'USA'], }, }] def _real_extract(self, url): ...
@@ -91,11 +139,24 @@ def _real_extract(self, url): 'id': f'{quality}p', 'url': f'{self._CDN_BASE}/video/{video_id}/{quality}.webp', } for quality in [48, 96, 144, 240, 512, 1080]] - formats = [{ - 'format_id': f'http-{quality}p', - 'quality': quality, - ...
yt_dlp/extractor/banbye.py
26
Python
0.429
suggestion
209
46
51
false
[ie/banbye] Fix extractor
10,332
yt-dlp/yt-dlp
132,642
Python
seproDev
PatrykMis
_TESTS = [{ 'url': 'http://www.rtve.es/alacarta/videos/la-aventura-del-saber/aventuraentornosilla/3088905/', 'md5': 'a964547824359a5753aef09d79fe984b', 'info_dict': { 'id': '3088905', 'ext': 'mp4', 'title': 'En torno a la silla', 'duration': 12...
Please change the format extraction to return both video and subtitle data. So using `self._extract_m3u8_formats_and_subtitles` and `self._extract_mpd_formats_and_subtitles`
def _decrypt_url(png): encrypted_data = io.BytesIO(base64.b64decode(png)[8:]) while True: length_data = encrypted_data.read(4) length = struct.unpack('!I', length_data)[0] chunk_type = encrypted_data.read(4) if chunk_type == b'IEND': br...
@@ -38,18 +39,23 @@ class RTVEALaCartaIE(InfoExtractor): 'ext': 'mp4', 'title': 're:^24H LIVE [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'is_live': True, + 'live_status': 'is_live', + 'thumbnail': r're:https://img2\.rtve\.es/v/.*\.png', }, ...
yt_dlp/extractor/rtve.py
26
Python
0.571
refactor
173
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
seproDev
meGAmeS1
'duration': 3222.8, 'thumbnail': r're:https://img2\.rtve\.es/v/.*\.png', 'series': 'Servir y proteger', }, 'expected_warnings': ['Failed to download MPD manifest', 'Failed to download m3u8 information'], }, { 'url': 'http://www.rtve.es/m/alacarta/videos/cu...
This seems to always return `default`. Can we hard code it instead of making the extra request?
e = (b + 3) % 4 f = 0 b += 1 else: e -= 1 return url @staticmethod def _get_alphabet(alphabet_data): alphabet = [] e = 0 d = 0 for char in alphabet_data.decode('iso-8859-1'): ...
@@ -58,6 +64,18 @@ class RTVEALaCartaIE(InfoExtractor): }, { 'url': 'http://www.rtve.es/filmoteca/no-do/not-1-introduccion-primer-noticiario-espanol/1465256/', 'only_matching': True, + }, { + 'url': 'https://www.rtve.es/play/videos/saber-vivir/07-07-24/16177116/', + 'md5': '9eebc...
yt_dlp/extractor/rtve.py
26
Python
0.429
question
95
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
seproDev
meGAmeS1
l += int(letter) url += alphabet[l] e = (b + 3) % 4 f = 0 b += 1 else: e -= 1 return url @staticmethod def _get_alfabet(alphabet_data): alphabet = [] e...
For what URLs is the additional variant required? This currently results in duplicate formats. Can we just always use `rtveplayw`?
r'https?://(?:www\.)?rtve\.es/infantil/serie/[^/?#]+/video/[^/?#]+/(?P<id>\d+)', ] _TESTS = [{ 'url': 'http://www.rtve.es/alacarta/videos/la-aventura-del-saber/aventuraentornosilla/3088905/', 'md5': 'a964547824359a5753aef09d79fe984b', 'info_dict': { 'id': '3088905', ...
@@ -70,65 +88,86 @@ def _real_initialize(self): def _decrypt_url(png): encrypted_data = io.BytesIO(base64.b64decode(png)[8:]) while True: - length = struct.unpack('!I', encrypted_data.read(4))[0] + length_data = encrypted_data.read(4) + length = struct.unpack('!I'...
yt_dlp/extractor/rtve.py
26
Python
0.571
refactor
130
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
seproDev
meGAmeS1
for quality, video_url in self._decrypt_url(png): ext = determine_ext(video_url) if ext == 'm3u8': formats.extend(self._extract_m3u8_formats( video_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=F...
We might as well fix this. Title does not need to be fatal. We can also in-line this along with some other info. ```py return { 'id': video_id, 'formats': formats, 'subtitles': subtitles, **traverse_obj(info, { 'title': ('title', {str.strip}...
'url': 'http://www.rtve.es/alacarta/videos/servir-y-proteger/servir-proteger-capitulo-104/4236788/', 'md5': 'f3cf0d1902d008c48c793e736706c174', 'info_dict': { 'id': '4236788', 'ext': 'mp4', 'title': 'Episodio 104', 'duration': 3222.8, '...
@@ -141,10 +180,8 @@ def _real_extract(self, url): title = info['title'].strip()
yt_dlp/extractor/rtve.py
26
Python
0.786
style
1,107
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
seproDev
meGAmeS1
video_id)['page']['items'][0] if info['state'] == 'DESPU': raise ExtractorError('The video is no longer available', expected=True) title = info['title'].strip() formats = self._extract_png_formats(video_id) sbt_file = f'https://api2.rtve.es/api/videos/{video_id}/...
Can you please change this to not be fatal.
'title': 'Saber vivir - 07/07/24', 'thumbnail': r're:https://img2\.rtve\.es/v/.*\.png', 'duration': 2162.68, 'series': 'Saber vivir', }, }, { 'url': 'https://www.rtve.es/infantil/serie/agus-lui-churros-crafts/video/gusano/7048976/', 'info_dict'...
@@ -161,7 +198,7 @@ def _real_extract(self, url): def _get_subtitles(self, video_id, sub_file): subs = self._download_json( - sub_file + '.json', video_id, + sub_file, video_id, 'Downloading subtitles info')['page']['items']
yt_dlp/extractor/rtve.py
26
Python
0.143
suggestion
43
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
seproDev
meGAmeS1
encrypted_data = io.BytesIO(base64.b64decode(png)[8:]) while True: length_data = encrypted_data.read(4) length = struct.unpack('!I', length_data)[0] chunk_type = encrypted_data.read(4) if chunk_type == b'IEND': break data = encr...
Lets leave a comment. ```suggestion # Reimplementation of https://js2.rtve.es/pages/app-player/3.5.1/js/pf_video.js @staticmethod ```
fmts, subs = self._extract_m3u8_formats_and_subtitles( video_url, video_id, 'mp4', m3u8_id='hls', fatal=False) formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) elif ext == 'mpd': fmt...
@@ -70,65 +88,86 @@ def _real_initialize(self): def _decrypt_url(png): encrypted_data = io.BytesIO(base64.b64decode(png)[8:]) while True: - length = struct.unpack('!I', encrypted_data.read(4))[0] + length_data = encrypted_data.read(4) + length = struct.unpack('!I'...
yt_dlp/extractor/rtve.py
26
Python
0.714
suggestion
145
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
seproDev
meGAmeS1
import base64 import io import struct from .common import InfoExtractor from ..utils import ( ExtractorError, determine_ext, float_or_none, qualities, try_get, ) class RTVEALaCartaIE(InfoExtractor): IE_NAME = 'rtve.es:alacarta' IE_DESC = 'RTVE a la carta and Play' _VALID_URL = [ ...
Not sure why we need a separate regex ```suggestion _VALID_URL = r'https?://(?:www\.)?rtve\.es/(m/)?(?:(?:alacarta|play)/videos|filmoteca)/[^/?#]+/[^/?#]+/(?P<id>\d+)' ```
import base64 import io import struct import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, determine_ext, float_or_none, make_archive_id, parse_iso8601, qualities, url_or_none, ) from ..utils.traversal import subs_list_to_dict, traverse...
@@ -8,28 +8,29 @@ determine_ext, float_or_none, qualities, - remove_end, - remove_start, try_get, ) class RTVEALaCartaIE(InfoExtractor): IE_NAME = 'rtve.es:alacarta' - IE_DESC = 'RTVE a la carta' - _VALID_URL = r'https?://(?:www\.)?rtve\.es/(m/)?(alacarta/videos|filmoteca)/[^/...
yt_dlp/extractor/rtve.py
21
Python
0.714
suggestion
178
46
46
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
seproDev
meGAmeS1
yield quality_str, url encrypted_data.read(4) # CRC @staticmethod def _get_url(alphabet, url_data): url = '' f = 0 e = 3 b = 1 for letter in url_data.decode('iso-8859-1'): if f == 0: l = int(letter) * 10 ...
Let's keep the code english ```suggestion def _get_alphabet(alphabet_data): ```
'timestamp': ('dateOfEmission', {parse_iso8601(delimiter=' ')}), 'release_timestamp': ('publicationDate', {parse_iso8601(delimiter=' ')}), 'modified_timestamp': ('modificationDate', {parse_iso8601(delimiter=' ')}), 'thumbnail': (('thumbnail', 'image', 'imageSEO'), {url_or...
@@ -70,65 +88,86 @@ def _real_initialize(self): def _decrypt_url(png): encrypted_data = io.BytesIO(base64.b64decode(png)[8:]) while True: - length = struct.unpack('!I', encrypted_data.read(4))[0] + length_data = encrypted_data.read(4) + length = struct.unpack('!I'...
yt_dlp/extractor/rtve.py
26
Python
0.571
suggestion
86
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
seproDev
meGAmeS1
@staticmethod def _decrypt_url(png): encrypted_data = io.BytesIO(base64.b64decode(png)[8:]) while True: length_data = encrypted_data.read(4) length = struct.unpack('!I', length_data)[0] chunk_type = encrypted_data.read(4) if chunk_type == b'IEND':...
Looking at the sites JS I would have said this is a more accurate implementation: ```suggestion data = bytes(filter(None, data)) alphabet_data, _, url_data = data.partition(b'#') quality_str, _, url_data = url_data.rpartition(b'%%') quality_str = qual...
for quality, video_url in self._decrypt_url(png): ext = determine_ext(video_url) if ext == 'm3u8': fmts, subs = self._extract_m3u8_formats_and_subtitles( video_url, video_id, 'mp4', m3u8_id='hls', fatal=False) fo...
@@ -70,65 +88,86 @@ def _real_initialize(self): def _decrypt_url(png): encrypted_data = io.BytesIO(base64.b64decode(png)[8:]) while True: - length = struct.unpack('!I', encrypted_data.read(4))[0] + length_data = encrypted_data.read(4) + length = struct.unpack('!I'...
yt_dlp/extractor/rtve.py
26
Python
0.786
question
578
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
seproDev
meGAmeS1
'format_id': quality, 'quality': q(quality), 'url': video_url, }) return formats, subtitles def _parse_metadata(self, metadata): return traverse_obj(metadata, { 'title': ('title', {str.strip}), ...
```suggestion r'https?://(?:www\.)?rtve\.es/(?:m/)?(?:(?:alacarta|play)/videos|filmoteca)/(?:[^/?#]+/){2}(?P<id>\d+)', ```
formats.append({ 'format_id': quality, 'quality': q(quality), 'url': video_url, }) return formats, subtitles def _parse_metadata(self, metadata): return traverse_obj(metadata, { ...
@@ -1,35 +1,141 @@ import base64 import io import struct +import urllib.parse from .common import InfoExtractor from ..utils import ( ExtractorError, + clean_html, determine_ext, float_or_none, + parse_iso8601, qualities, - remove_end, - remove_start, - try_get, + url_or_non...
yt_dlp/extractor/rtve.py
26
Python
0.714
suggestion
132
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
f'https://api2.rtve.es/api/videos/{video_id}/subtitulos.json', video_id, 'Downloading subtitles info') return traverse_obj(subtitle_data, ('page', 'items', ..., { 'id': ('lang', {str}), 'url': ('src', {url_or_none}), }, all, {subs_list_to_dict(lang='es')})...
```suggestion '_old_archive_ids': [make_archive_id('rtveinfantil', video_id)] if is_infantil else None, ```
subtitle_data = self._download_json( f'https://api2.rtve.es/api/videos/{video_id}/subtitulos.json', video_id, 'Downloading subtitles info') return traverse_obj(subtitle_data, ('page', 'items', ..., { 'id': ('lang', {str}), 'url': ('src', {url_or_none}), ...
@@ -38,140 +144,88 @@ class RTVEALaCartaIE(InfoExtractor): 'ext': 'mp4', 'title': 're:^24H LIVE [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'is_live': True, + 'live_status': 'is_live', + 'thumbnail': r're:https://img2\.rtve\.es/v/.*\.png', }, ...
yt_dlp/extractor/rtve.py
26
Python
0.714
suggestion
121
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
def _real_extract(self, url): video_id = self._match_id(url) metadata = self._download_json( f'http://www.rtve.es/api/videos/{video_id}/config/alacarta_videos.json', video_id)['page']['items'][0] if metadata['state'] == 'DESPU': raise ExtractorError('The v...
```suggestion _VALID_URL = r'https?://(?:www\.)?rtve\.es/(alacarta|play)/audios/(?:[^/?#]+/){2}(?P<id>\d+)' ```
def _real_extract(self, url): video_id = self._match_id(url) metadata = self._download_json( f'http://www.rtve.es/api/videos/{video_id}/config/alacarta_videos.json', video_id)['page']['items'][0] if metadata['state'] == 'DESPU': raise ExtractorError('The ...
@@ -38,140 +144,88 @@ class RTVEALaCartaIE(InfoExtractor): 'ext': 'mp4', 'title': 're:^24H LIVE [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'is_live': True, + 'live_status': 'is_live', + 'thumbnail': r're:https://img2\.rtve\.es/v/.*\.png', }, ...
yt_dlp/extractor/rtve.py
26
Python
0.714
suggestion
117
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
'duration': 292.86, 'series': 'Agus & Lui: Churros y Crafts', '_old_archive_ids': ['rtveinfantil 7048976'], }, }] def _get_subtitles(self, video_id): subtitle_data = self._download_json( f'https://api2.rtve.es/api/videos/{video_id}/subtitulos.json...
Does this actually work? I would think we'd need to pass `subtitles` to `extract_subtitles` and merge them inside `_get_subtitles`
'thumbnail': r're:https://img2\.rtve\.es/v/.*\.png', 'duration': 292.86, 'series': 'Agus & Lui: Churros y Crafts', '_old_archive_ids': ['rtveinfantil 7048976'], }, }] def _get_subtitles(self, video_id): subtitle_data = self._download_json( ...
@@ -38,140 +144,88 @@ class RTVEALaCartaIE(InfoExtractor): 'ext': 'mp4', 'title': 're:^24H LIVE [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'is_live': True, + 'live_status': 'is_live', + 'thumbnail': r're:https://img2\.rtve\.es/v/.*\.png', }, ...
yt_dlp/extractor/rtve.py
26
Python
0.571
refactor
130
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
'_old_archive_ids': ['rtveinfantil 7048976'], }, }] def _get_subtitles(self, video_id): subtitle_data = self._download_json( f'https://api2.rtve.es/api/videos/{video_id}/subtitulos.json', video_id, 'Downloading subtitles info') return traverse_obj(sub...
could also make this a capture group in `_VALID_URL` and set the var at the beginning of `_real_extract`
'series': 'Agus & Lui: Churros y Crafts', '_old_archive_ids': ['rtveinfantil 7048976'], }, }] def _get_subtitles(self, video_id): subtitle_data = self._download_json( f'https://api2.rtve.es/api/videos/{video_id}/subtitulos.json', video_id, 'Downlo...
@@ -38,140 +144,88 @@ class RTVEALaCartaIE(InfoExtractor): 'ext': 'mp4', 'title': 're:^24H LIVE [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', 'is_live': True, + 'live_status': 'is_live', + 'thumbnail': r're:https://img2\.rtve\.es/v/.*\.png', }, ...
yt_dlp/extractor/rtve.py
26
Python
0.571
refactor
104
51
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
return { 'id': video_id, 'title': self._html_extract_title(webpage), 'formats': formats, 'subtitles': subtitles, 'is_live': True, } class RTVETelevisionIE(InfoExtractor): IE_NAME = 'rtve.es:television' _VALID_URL = r'https?://(?:www\....
what does the title look like? we don't need to perform any string surgery like the old code did?
'title': str, 'description': str, 'thumbnail': r're:https://img2\d\.rtve\.es/resources/thumbslive/\d+\.jpg', 'timestamp': int, 'upload_date': str, }, 'params': {'skip_download': 'live stream'}, }, { 'url': 'http://www.rtve.es/play/v...
@@ -282,46 +293,46 @@ class RTVELiveIE(RTVEALaCartaIE): # XXX: Do not subclass from concrete IE 'info_dict': { 'id': 'la-1', 'ext': 'mp4', - 'title': 're:^La 1 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', + 'title': str, + 'live_status': 'is_live',...
yt_dlp/extractor/rtve.py
26
Python
0.214
question
97
38
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
webpage = self._download_webpage(url, video_id) data_setup = self._search_json( r'<div[^>]+class="[^"]*videoPlayer[^"]*"[^>]*data-setup=\'', webpage, 'data_setup', video_id) formats, subtitles = self._extract_png_formats_and_subtitles(data_setup['idAsset']) ret...
they single quote the json and don't escape html special chars (`"`=>`&quot;`)?
}, 'params': {'skip_download': 'live stream'}, }, { 'url': 'https://www.rtve.es/play/videos/directo/deportes/tdp/', 'info_dict': { 'id': 'tdp', 'ext': 'mp4', 'live_status': 'is_live', 'title': str, 'description': str, ...
@@ -282,46 +293,46 @@ class RTVELiveIE(RTVEALaCartaIE): # XXX: Do not subclass from concrete IE 'info_dict': { 'id': 'la-1', 'ext': 'mp4', - 'title': 're:^La 1 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', + 'title': str, + 'live_status': 'is_live',...
yt_dlp/extractor/rtve.py
26
Python
0.357
security
79
46
51
false
[ie/rtve] Rework extractors
10,388
yt-dlp/yt-dlp
132,642
Python
bashonly
meGAmeS1
urlencode_postdata, ) from ..utils.traversal import traverse_obj class ADNBaseIE(InfoExtractor): IE_DESC = 'Animation Digital Network' _NETRC_MACHINE = 'animationdigitalnetwork' _BASE = 'animationdigitalnetwork.fr' _API_BASE_URL = f'https://gw.api.{_BASE}/' _PLAYER_BASE_URL = f'{_API_BASE_URL}...
non-capturing group for the outer group ```suggestion _VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.com/(?:(?P<lang>de)/)?video/[^/?#]+/(?P<id>\d+)' ```
unified_strdate, urlencode_postdata, ) from ..utils.traversal import traverse_obj class ADNBaseIE(InfoExtractor): IE_DESC = 'Animation Digital Network' _NETRC_MACHINE = 'animationdigitalnetwork' _BASE = 'animationdigitalnetwork.fr' _API_BASE_URL = f'https://gw.api.{_BASE}/' _PLAYER_BASE_UR...
@@ -48,9 +48,9 @@ class ADNBaseIE(InfoExtractor): class ADNIE(ADNBaseIE): - _VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.(?P<lang>fr|de)/video/[^/?#]+/(?P<id>\d+)' + _VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.com/((?P<lang>de)/)?video/[^/?#]+/(?P<id>\d+)'
yt_dlp/extractor/adn.py
26
Python
0.714
suggestion
182
51
51
false
[ie/adn] domain change from .fr/.de to .com
10,399
yt-dlp/yt-dlp
132,642
Python
bashonly
infanf
video = (self._download_json( self._API_BASE_URL + f'video/{video_id}', video_id, 'Downloading additional video metadata', fatal=False) or {}).get('video') or {} show = video.get('show') or {} return { 'id': video_id, 'title': title, ...
same as above ```suggestion _VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.com/(?:(?P<lang>de)/)?video/(?P<id>[^/?#]+)/?(?:$|[#?])' ```
video = (self._download_json( self._API_BASE_URL + f'video/{video_id}', video_id, 'Downloading additional video metadata', fatal=False) or {}).get('video') or {} show = video.get('show') or {} return { 'id': video_id, 'title': title, '...
@@ -298,9 +300,9 @@ def _real_extract(self, url): class ADNSeasonIE(ADNBaseIE): - _VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.(?P<lang>fr|de)/video/(?P<id>[^/?#]+)/?(?:$|[#?])' + _VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.com/((?P<lang>de)/)?video/(?P<id>[^/...
yt_dlp/extractor/adn.py
26
Python
0.714
suggestion
164
51
51
false
[ie/adn] domain change from .fr/.de to .com
10,399
yt-dlp/yt-dlp
132,642
Python
bashonly
infanf
}] def _real_extract(self, url): lang, video_show_slug = self._match_valid_url(url).group('lang', 'id') if not lang: lang = 'fr' show = self._download_json( f'{self._API_BASE_URL}show/{video_show_slug}/', video_show_slug, 'Downloading show JSON metada...
```py yield self.url_result(join_nonempty( 'https://animationdigitalnetwork.com', lang, 'video', video_show_slug, episode_id, delim='/'), ADNIE, episode_id) ```
import base64 import binascii import json import os import random import time from .common import InfoExtractor from ..aes import aes_cbc_decrypt_bytes, unpad_pkcs7 from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, ass_subtitles_timecode, bytes_to_intlist, bytes_to_lon...
@@ -327,8 +331,9 @@ def _real_extract(self, url): def entries(): for episode_id in traverse_obj(episodes, ('videos', ..., 'id', {str_or_none})): + baseurl = 'https://animationdigitalnetwork.com' + ('/' + lang if lang != 'fr' else '') yield self.url_result( - ...
yt_dlp/extractor/adn.py
26
Python
0.786
suggestion
220
29
336
false
[ie/adn] domain change from .fr/.de to .com
10,399
yt-dlp/yt-dlp
132,642
Python
bashonly
infanf
def suitable(cls, url): return False if PicartoVodIE.suitable(url) else super().suitable(url) def _real_extract(self, url): channel_id = self._match_id(url) data = self._download_json( 'https://ptvintern.picarto.tv/ptvapi', channel_id, query={ 'query': '''{ ...
```suggestion }, headers={'Accept': '*/*', 'Content-Type': 'application/json'})['data'] ```
@classmethod def suitable(cls, url): return False if PicartoVodIE.suitable(url) else super().suitable(url) def _real_extract(self, url): channel_id = self._match_id(url) data = self._download_json( 'https://ptvintern.picarto.tv/ptvapi', channel_id, query={ ...
@@ -43,16 +43,24 @@ def _real_extract(self, url): url } }''' % (channel_id, channel_id), # noqa: UP031 - })['data'] + }, + headers={ + 'Accept': '*/*', + 'Content-Type': 'application/json', + }, + )['data']
yt_dlp/extractor/picarto.py
26
Python
0.857
suggestion
105
51
51
false
[ie/Picarto] Fix failed to parse JSON error
10,414
yt-dlp/yt-dlp
132,642
Python
bashonly
Frankgoji
online stream_name title } getLoadBalancerUrl(channel_name: "%s") { url } }''' % (channel_id, channel_id), # noqa: UP031 }, headers={ 'Accept': '*/*', 'Content-Type': 'application/json', }, )['data'] metadata = da...
I would import `update_url` from utils and do this: ```py cdn_data = self._download_json(''.join(( update_url(data['getLoadBalancerUrl']['url'], scheme='https'), '/stream/json_', metadata['stream_name'], '.js')), channel_id, 'Downloading load balancing info') ```
id online stream_name title } getLoadBalancerUrl(channel_name: "%s") { url } }''' % (channel_id, channel_id), # noqa: UP031 }, headers={'Accept': '*/*', 'Content-Type': 'application/json'})['data'] metadata = data['channel'] if metadata.get('online') == 0: ...
@@ -43,16 +43,24 @@ def _real_extract(self, url): url } }''' % (channel_id, channel_id), # noqa: UP031 - })['data'] + }, + headers={ + 'Accept': '*/*', + 'Content-Type': 'application/json', + }, + )['data'] metadata = da...
yt_dlp/extractor/picarto.py
26
Python
0.786
suggestion
313
51
51
false
[ie/Picarto] Fix failed to parse JSON error
10,414
yt-dlp/yt-dlp
132,642
Python
bashonly
Frankgoji
'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) data = self._download_json( 'https://ptvintern.picarto.tv/ptvapi', video_id, query={ 'query': f'''{{ video(id: "{video_id}") {{ id title adult file_name ...
```suggestion }, headers={'Accept': '*/*', 'Content-Type': 'application/json'})['data']['video'] ```
data = self._download_json( 'https://ptvintern.picarto.tv/ptvapi', video_id, query={ 'query': f'''{{ video(id: "{video_id}") {{ id title adult file_name video_recording_image_url channel {{ name }} }} }}''', }, headers={'Accept': '*/*...
@@ -131,7 +139,12 @@ def _real_extract(self, url): }} }} }}''', - })['data']['video'] + }, + headers={ + 'Accept': '*/*', + 'Content-Type': 'application/json', + }, + )['data']['video']
yt_dlp/extractor/picarto.py
26
Python
0.857
suggestion
114
45
34
false
[ie/Picarto] Fix failed to parse JSON error
10,414
yt-dlp/yt-dlp
132,642
Python
bashonly
Frankgoji
import re from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, orderedSet, parse_iso8601, parse_qs, parse_resolution, str_or_none, traverse_obj, url_or_none, ) class EpidemicSoundIE(InfoExtractor): # set an attribute to indicate if it's a sound e...
we can handle this all in the `_VALID_URL` by adding an `sfx` capture group ```suggestion _VALID_URL = r'https?://(?:www\.)?epidemicsound\.com/(?:(?P<sfx>sound-effects/tracks)|track)/(?P<id>[0-9a-zA-Z-]+)' ```
from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, join_nonempty, orderedSet, parse_iso8601, parse_qs, parse_resolution, str_or_none, traverse_obj, url_or_none, ) class EpidemicSoundIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?epidem...
@@ -13,7 +15,10 @@ class EpidemicSoundIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?epidemicsound\.com/track/(?P<id>[0-9a-zA-Z]+)' + # set an attribute to indicate if it's a sound effect or a track based on this regex (r'https?://(?:www\.)?epidemicsound\.com/sound-effects/tracks/(?P<id>[0-9a-zA-Z-]+...
yt_dlp/extractor/epidemicsound.py
21
Python
0.929
suggestion
216
46
46
false
Fix Epidemic Sound SFX unsupported url
10,436
yt-dlp/yt-dlp
132,642
Python
bashonly
iancmy
'url': url, **(traverse_obj(url, ({parse_qs}, { 'width': ('width', 0, {int_or_none}), 'height': ('height', 0, {int_or_none}), })) or parse_resolution(url)), } @staticmethod def _epidemic_fmt_or_none(f): if not f.get('format'): ...
and then do this ```suggestion video_id, is_sfx = self._match_valid_url(url).group('id', 'sfx') ```
'thumbnail': 'https://cdn.epidemicsound.com/curation-assets/commercial-release-cover-images/default-sfx/3000x3000.jpg', }, }] @staticmethod def _epidemic_parse_thumbnail(url: str): if not url_or_none(url): return None return { 'url': url, ...
@@ -77,8 +82,15 @@ def _epidemic_fmt_or_none(f): return f def _real_extract(self, url): + if self._SFX_REGEX.match(url): + self._IS_SFX = True + video_id = self._match_id(url)
yt_dlp/extractor/epidemicsound.py
26
Python
0.714
suggestion
110
51
51
false
Fix Epidemic Sound SFX unsupported url
10,436
yt-dlp/yt-dlp
132,642
Python
bashonly
iancmy
} @staticmethod def _epidemic_fmt_or_none(f): if not f.get('format'): f['format'] = f.get('format_id') elif not f.get('format_id'): f['format_id'] = f['format'] if not f['url'] or not f['format']: return None if f.get('format_note'): ...
and finally this ```suggestion json_data = self._download_json(join_nonempty( 'https://www.epidemicsound.com/json/track' is_sfx and 'kosmos-id', video_id, delim='/'), video_id) ``` import `join_nonempty` from utils
def _epidemic_parse_thumbnail(url: str): if not url_or_none(url): return None return { 'url': url, **(traverse_obj(url, ({parse_qs}, { 'width': ('width', 0, {int_or_none}), 'height': ('height', 0, {int_or_none}), })) or...
@@ -77,8 +82,15 @@ def _epidemic_fmt_or_none(f): return f def _real_extract(self, url): + if self._SFX_REGEX.match(url): + self._IS_SFX = True + video_id = self._match_id(url) - json_data = self._download_json(f'https://www.epidemicsound.com/json/track/{video_id}', vide...
yt_dlp/extractor/epidemicsound.py
26
Python
0.786
suggestion
254
51
51
false
Fix Epidemic Sound SFX unsupported url
10,436
yt-dlp/yt-dlp
132,642
Python
bashonly
iancmy
import re from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, orderedSet, parse_iso8601, parse_qs, parse_resolution, str_or_none, traverse_obj, url_or_none, ) class EpidemicSoundIE(InfoExtractor): # set an attribute to indicate if it's a sound e...
```suggestion from .common import InfoExtractor ``` &nbsp; and also import `join_nonempty` from utils below
from .common import InfoExtractor from ..utils import ( float_or_none, int_or_none, join_nonempty, orderedSet, parse_iso8601, parse_qs, parse_resolution, str_or_none, traverse_obj, url_or_none, ) class EpidemicSoundIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?epidem...
@@ -1,3 +1,5 @@ +import re + from .common import InfoExtractor
yt_dlp/extractor/epidemicsound.py
3
Python
0.786
refactor
115
28
28
false
Fix Epidemic Sound SFX unsupported url
10,436
yt-dlp/yt-dlp
132,642
Python
bashonly
iancmy
parse_qs, parse_resolution, str_or_none, traverse_obj, url_or_none, ) class EpidemicSoundIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?epidemicsound\.com/(?:(?P<sfx>sound-effects/tracks)|track)/(?P<id>[0-9a-zA-Z-]+)' _TESTS = [{ 'url': 'https://www.epidemicsound.com/track/mj...
why was this removed? the link still works
parse_qs, parse_resolution, str_or_none, traverse_obj, url_or_none, ) class EpidemicSoundIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?epidemicsound\.com/(?:(?P<sfx>sound-effects/tracks)|track)/(?P<id>[0-9a-zA-Z-]+)' _TESTS = [{ 'url': 'https://www.epidemicsound.com/track/yF...
@@ -13,24 +14,8 @@ class EpidemicSoundIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?epidemicsound\.com/track/(?P<id>[0-9a-zA-Z]+)' + _VALID_URL = r'https?://(?:www\.)?epidemicsound\.com/(?:(?P<sfx>sound-effects/tracks)|track)/(?P<id>[0-9a-zA-Z-]+)' _TESTS = [{ - 'url': 'https://www.epide...
yt_dlp/extractor/epidemicsound.py
26
Python
0.143
question
42
51
51
false
Fix Epidemic Sound SFX unsupported url
10,436
yt-dlp/yt-dlp
132,642
Python
bashonly
iancmy
return { 'url': url, **(traverse_obj(url, ({parse_qs}, { 'width': ('width', 0, {int_or_none}), 'height': ('height', 0, {int_or_none}), })) or parse_resolution(url)), } @staticmethod def _epidemic_fmt_or_none(f): if not ...
line too long ```suggestion json_data = self._download_json(join_nonempty( 'https://www.epidemicsound.com/json/track' is_sfx and 'kosmos-id', video_id, delim='/'), video_id) ```
'upload_date': '20240603', 'timestamp': 1717436529, 'categories': ['appliance'], 'display_id': '6b2NXLURPr', 'duration': 1.0, 'title': 'Oven, Grill, Door Open 01', 'thumbnail': 'https://cdn.epidemicsound.com/curation-assets/commercial-r...
@@ -77,8 +77,9 @@ def _epidemic_fmt_or_none(f): return f def _real_extract(self, url): - video_id = self._match_id(url) - json_data = self._download_json(f'https://www.epidemicsound.com/json/track/{video_id}', video_id) + video_id, is_sfx = self._match_valid_url(url).group('id', 'sf...
yt_dlp/extractor/epidemicsound.py
26
Python
0.786
refactor
214
51
51
false
Fix Epidemic Sound SFX unsupported url
10,436
yt-dlp/yt-dlp
132,642
Python
bashonly
iancmy
return { 'url': url, **(traverse_obj(url, ({parse_qs}, { 'width': ('width', 0, {int_or_none}), 'height': ('height', 0, {int_or_none}), })) or parse_resolution(url)), } @staticmethod def _epidemic_fmt_or_none(f): if not ...
```suggestion 'https://www.epidemicsound.com/json/track', ```
'ext': 'mp3', 'upload_date': '20240603', 'timestamp': 1717436529, 'categories': ['appliance'], 'display_id': '6b2NXLURPr', 'duration': 1.0, 'title': 'Oven, Grill, Door Open 01', 'thumbnail': 'https://cdn.epidemicsound.com/cu...
@@ -77,8 +76,10 @@ def _epidemic_fmt_or_none(f): return f def _real_extract(self, url): - video_id = self._match_id(url) - json_data = self._download_json(f'https://www.epidemicsound.com/json/track/{video_id}', video_id) + video_id, is_sfx = self._match_valid_url(url).group('id', 's...
yt_dlp/extractor/epidemicsound.py
26
Python
0.571
suggestion
75
51
51
false
Fix Epidemic Sound SFX unsupported url
10,436
yt-dlp/yt-dlp
132,642
Python
bashonly
iancmy
self.timeout = float(timeout or DEFAULT_TIMEOUT) self.proxies = proxies or {} self.source_address = source_address self.verbose = verbose self.prefer_system_certs = prefer_system_certs self._client_cert = client_cert or {} self.verify = verify self.legacy_...
```suggestion cookiejar = request.extensions.get('cookiejar') return self.cookiejar if cookiejar is None else cookiejar ```
self.timeout = float(timeout or DEFAULT_TIMEOUT) self.proxies = proxies or {} self.source_address = source_address self.verbose = verbose self.prefer_system_certs = prefer_system_certs self._client_cert = client_cert or {} self.verify = verify self.legacy_...
@@ -262,7 +263,7 @@ def _calculate_timeout(self, request): return float(request.extensions.get('timeout') or self.timeout) def _get_cookiejar(self, request): - return request.extensions.get('cookiejar') or self.cookiejar + return c if (c := request.extensions.get('cookiejar')) is not None ...
yt_dlp/networking/common.py
26
Python
0.714
suggestion
142
51
51
false
[networking] Add `legacy_ssl` request extension
10,448
yt-dlp/yt-dlp
132,642
Python
Grub4K
coletdjnz
return tried_iframe_fallback = False player_url = None skipped_clients = {} while clients: client, base_client, variant = _split_innertube_client(clients.pop()) player_ytcfg = master_ytcfg if client == 'web' else {} if 'configs...
```suggestion pr = initial_pr if client == 'web' and initial_pr else None for retry in self.RetryManager(fatal=False): try: pr = pr or self._extract_player_response( client, video_id, player_ytcfg or master_ytcfg, player_ytcfg, ...
return tried_iframe_fallback = False player_url = None skipped_clients = {} while clients: client, base_client, variant = _split_innertube_client(clients.pop()) player_ytcfg = master_ytcfg if client == 'web' else {} if 'configs...
@@ -3746,11 +3754,21 @@ def append_client(*client_names): player_url = self._download_player_url(video_id) tried_iframe_fallback = True - try: - pr = initial_pr if client == 'web' and initial_pr else self._extract_player_response( - client...
yt_dlp/extractor/youtube.py
26
Python
0.857
refactor
416
51
51
false
[ie/youtube] Avoid poToken experiment player responses
10,456
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
requested_clients.append(client) # Force deprioritization of broken Android clients for format de-duplication requested_clients.extend(android_clients) if not requested_clients: requested_clients = default if smuggled_data.get('is_music_url') or self.is_music...
```suggestion 'Webpage contains broken formats (poToken experiment detected). Ignoring initial player response') ```
requested_clients.append(client) # Force deprioritization of broken Android clients for format de-duplication requested_clients.extend(android_clients) if not requested_clients: requested_clients = default if smuggled_data.get('is_music_url') or self.is_music...
@@ -3703,8 +3704,15 @@ def _invalid_player_response(self, pr, video_id): def _extract_player_responses(self, clients, video_id, webpage, master_ytcfg, smuggled_data): initial_pr = None if webpage: - initial_pr = self._search_json( - self._YT_INITIAL_PLAYER_RESPONSE_RE, w...
yt_dlp/extractor/youtube.py
26
Python
0.714
bug
138
51
51
false
[ie/youtube] Avoid poToken experiment player responses
10,456
yt-dlp/yt-dlp
132,642
Python
bashonly
seproDev
import re from .common import InfoExtractor class NZZIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?nzz\.ch/(?:[^/]+/)*[^/?#]+-ld\.(?P<id>\d+)' _TESTS = [{ 'url': 'http://www.nzz.ch/zuerich/gymizyte/gymizyte-schreiben-schueler-heute-noch-diktate-ld.9153', 'info_dict': { 'id'...
```suggestion for script in re.findall(r'(?s)<script[^>]* data-hid="jw-video-jw[^>]+>(.+?)</script>', webpage): ```
import re from .common import InfoExtractor class NZZIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?nzz\.ch/(?:[^/]+/)*[^/?#]+-ld\.(?P<id>\d+)' _TESTS = [{ 'url': 'http://www.nzz.ch/zuerich/gymizyte/gymizyte-schreiben-schueler-heute-noch-diktate-ld.9153', 'info_dict': { 'id'...
@@ -22,19 +19,15 @@ class NZZIE(InfoExtractor): 'playlist_count': 1, }] + def _entries(self, webpage, page_id): + for script in re.findall(r'(?s)<script[^>]+data-hid="jw-video-jw[^>]+>(.*?)</script>', webpage):
yt_dlp/extractor/nzz.py
23
Python
0.714
suggestion
125
34
33
false
[ie/NZZ] Fix extractor
10,461
yt-dlp/yt-dlp
132,642
Python
bashonly
1-Byte
_TESTS = [{ 'url': 'http://www.nzz.ch/zuerich/gymizyte/gymizyte-schreiben-schueler-heute-noch-diktate-ld.9153', 'info_dict': { 'id': '9153', }, 'playlist_mincount': 6, }, { 'url': 'https://www.nzz.ch/video/nzz-standpunkte/cvp-auf-der-suche-nach-dem-mass-der-mi...
```suggestion return self.playlist_result(self._entries(webpage, page_id), page_id) ```
_TESTS = [{ 'url': 'http://www.nzz.ch/zuerich/gymizyte/gymizyte-schreiben-schueler-heute-noch-diktate-ld.9153', 'info_dict': { 'id': '9153', }, 'playlist_mincount': 6, }, { 'url': 'https://www.nzz.ch/video/nzz-standpunkte/cvp-auf-der-suche-nach-dem-mass-der-mi...
@@ -22,19 +19,15 @@ class NZZIE(InfoExtractor): 'playlist_count': 1, }] + def _entries(self, webpage, page_id): + for script in re.findall(r'(?s)<script[^>]+data-hid="jw-video-jw[^>]+>(.*?)</script>', webpage): + settings = self._search_json(r'var\s+settings\s*=[^{]*', script, 'sett...
yt_dlp/extractor/nzz.py
26
Python
0.571
suggestion
97
27
26
false
[ie/NZZ] Fix extractor
10,461
yt-dlp/yt-dlp
132,642
Python
bashonly
1-Byte
android_clients.append(client) else: requested_clients.append(client) # Force deprioritization of broken Android clients for format de-duplication requested_clients.extend(android_clients) if not requested_clients: requested_clients = defau...
Maybe we want something like this? ```py if 'web' in clients: experiments = traverse_obj(master_ytcfg, ( 'WEB_PLAYER_CONTEXT_CONFIGS', ..., 'serializedExperimentIds', {str}, {lambda x: x.split(',')}, ..., {str})) if all(x in experiments for x in self....
android_clients.append(client) else: requested_clients.append(client) # Force deprioritization of broken Android clients for format de-duplication requested_clients.extend(android_clients) if not requested_clients: requested_clients = defau...
@@ -3702,17 +3702,16 @@ def _invalid_player_response(self, pr, video_id): return pr_id def _extract_player_responses(self, clients, video_id, webpage, master_ytcfg, smuggled_data): - initial_pr = None + initial_pr = ignore_initial_response = None if webpage: exper...
yt_dlp/extractor/youtube.py
26
Python
0.786
suggestion
393
51
51
false
[ie/youtube] Fix initial player response usage
10,464
yt-dlp/yt-dlp
132,642
Python
Grub4K
seproDev
'chapters': [{ 'start_time': chapter.get('time'), 'end_time': try_get(chapter, lambda x: x['time'] + x['duration']), 'title': chapter.get('text'), } for chapter in item['cuepoints']] if item.get('cuepoints') and type_ == 'concer...
```suggestion album_artists = traverse_obj(vid_info, ('_links', 'artist', ..., 'name', {str})) ```
**kwargs, 'chapters': [{ 'start_time': chapter.get('time'), 'end_time': try_get(chapter, lambda x: x['time'] + x['duration']), 'title': chapter.get('text'), } for chapter in item['cuepoints']] if item.get('cuepoi...
@@ -140,13 +155,15 @@ def _real_extract(self, url): f'https://api.digitalconcerthall.com/v2/{api_type}/{video_id}', video_id, headers={ 'Accept': 'application/json', 'Accept-Language': language, + 'User-Agent': self._USER_AGENT, + 'Authorizati...
yt_dlp/extractor/digitalconcerthall.py
26
Python
0.714
suggestion
108
40
41
false
[ie/digitalconcerthall] Extract HEVC and FLAC formats
10,470
yt-dlp/yt-dlp
132,642
Python
seproDev
bashonly
url } } id timestamp title } }''' % display_id, # noqa: UP031 })['data']['mediaPlayback'][0] class MLBTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?mlb\.com/tv/g(?P<id>\d{6})' _NETRC_MACHINE = 'mlb' _TESTS = [{ 'url': 'https://www.mlb.com/tv/g6...
i think this is easier to read with ```suggestion _GRAPHQL_INIT_QUERY = '''\ mutation initSession($device: InitSessionInput!, $clientType: ClientType!, $experience: ExperienceTypeInput) { ```
} playbacks { name url } } id timestamp title } }''' % display_id, # noqa: UP031 })['data']['mediaPlayback'][0] class MLBTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?mlb\.com/tv/g(?P<id>\d{6})' _NETRC_MACHINE = 'mlb' _TESTS = [{ ...
@@ -288,69 +289,172 @@ class MLBTVIE(InfoExtractor): 'skip_download': True, }, }] - _access_token = None + _GRAPHQL_INIT_QUERY = '''mutation initSession($device: InitSessionInput!, $clientType: ClientType!, $experience: ExperienceTypeInput) {
yt_dlp/extractor/mlb.py
26
Python
0.929
suggestion
200
51
51
false
[ie/MLBTV] Fix extractor
10,515
yt-dlp/yt-dlp
132,642
Python
Grub4K
bashonly
return extract_video_data(try_get( js_data, lambda x: x['jsmods']['instances'], list) or []) def extract_dash_manifest(video, formats): dash_manifest = traverse_obj(video, 'dash_manifest', 'playlist', expected_type=str) if dash_manifest: ...
Shouldnt we try to find one that has info? or am i missing something? ```suggestion return next(filter(None, yield_all_relay_data(_filter)), {}) ```
return extract_video_data(try_get( js_data, lambda x: x['jsmods']['instances'], list) or []) def extract_dash_manifest(video, formats): dash_manifest = traverse_obj(video, 'dash_manifest', 'playlist', expected_type=str) if dash_manifest: ...
@@ -571,16 +571,21 @@ def process_formats(info): # Formats larger than ~500MB will return error 403 unless chunk size is regulated f.setdefault('downloader_options', {})['http_chunk_size'] = 250 << 20 - def extract_relay_data(_filter): - return self._parse_json(self...
yt_dlp/extractor/facebook.py
26
Python
0.786
suggestion
163
51
51
false
[ie/facebook] Fix extraction
10,531
yt-dlp/yt-dlp
132,642
Python
Grub4K
bashonly
}, { 'url': 'https://germanupa.de/mediathek/live-vom-ux-festival-neuigkeiten-von-figma-jobmarkt-agenturszene-interview-zu-sustainable', 'info_dict': { 'id': '1867346676', 'title': 'Live vom UX Festival: Neuigkeiten von Figma, Jobmarkt, Agenturszene & Interview zu Sustainable ...
needs to complete `info_dict` for `Germanupa_2`.
'note': 'audio, uses GenericIE', 'url': 'https://germanupa.de/mediathek/live-vom-ux-festival-neuigkeiten-von-figma-jobmarkt-agenturszene-interview-zu-sustainable', 'info_dict': { 'id': '1867346676', 'title': 'Live vom UX Festival: Neuigkeiten von Figma, Jobmarkt, Agenturs...
@@ -0,0 +1,77 @@ +import urllib.parse + +from .common import InfoExtractor +from .vimeo import VimeoIE +from ..utils import traverse_obj + + +class GermanupaIE(InfoExtractor): + _VALID_URL = r'https?://germanupa\.de/(?!media\b)[\w-]+/(?P<id>[\w-]+)' + _IFRAME_RE = r'<iframe[^>]+data-src\s*?=\s*?([\'"])(?P<url>htt...
yt_dlp/extractor/germanupa.py
26
Python
0.214
suggestion
48
51
51
false
[ie/Germanupa] Add extractor
10,538
yt-dlp/yt-dlp
132,642
Python
grqz
grqz
'duration': 2146, 'release_timestamp': 1721373980, 'uploader': 'German UPA', 'uploader_id': 'germanupa', 'upload_date': '20240719', 'comment_count': int, }, 'expected_warnings': ['Failed to parse XML: not well-formed'], 'ski...
Would this not cause an infinite loop?
'thumbnail': 'https://i.vimeocdn.com/video/1904187064-2a672630c30f9ad787bd390bff3f51d7506a3e8416763ba6dbf465732b165c5c-d_1280', 'duration': 2146, 'release_timestamp': 1721373980, 'uploader': 'German UPA', 'uploader_id': 'germanupa', 'upload_date': ...
@@ -0,0 +1,89 @@ +from .common import InfoExtractor +from .vimeo import VimeoIE +from ..utils import ( + parse_qs, + traverse_obj, +) + + +class GermanupaIE(InfoExtractor): + IE_DESC = 'germanupa.de' + _VALID_URL = r'https?://germanupa\.de/mediathek/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://...
yt_dlp/extractor/germanupa.py
26
Python
0.143
bug
38
30
32
false
[ie/Germanupa] Add extractor
10,538
yt-dlp/yt-dlp
132,642
Python
seproDev
grqz
'timestamp': 1721373980, 'license': 'by-sa', 'like_count': int, 'thumbnail': 'https://i.vimeocdn.com/video/1904187064-2a672630c30f9ad787bd390bff3f51d7506a3e8416763ba6dbf465732b165c5c-d_1280', 'duration': 2146, 'release_timestamp': 1721373980, ...
```suggestion param_url = traverse_obj(parse_qs(embed_url), ('url', 0, {url_or_none})) ```
'uploader_url': 'https://vimeo.com/germanupa', 'timestamp': 1721373980, 'license': 'by-sa', 'like_count': int, 'thumbnail': 'https://i.vimeocdn.com/video/1904187064-2a672630c30f9ad787bd390bff3f51d7506a3e8416763ba6dbf465732b165c5c-d_1280', 'duration...
@@ -0,0 +1,89 @@ +from .common import InfoExtractor +from .vimeo import VimeoIE +from ..utils import ( + parse_qs, + traverse_obj, +) + + +class GermanupaIE(InfoExtractor): + IE_DESC = 'germanupa.de' + _VALID_URL = r'https?://germanupa\.de/mediathek/(?P<id>[\w-]+)' + _TESTS = [{ + 'url': 'https://...
yt_dlp/extractor/germanupa.py
26
Python
0.714
suggestion
100
34
36
false
[ie/Germanupa] Add extractor
10,538
yt-dlp/yt-dlp
132,642
Python
seproDev
grqz
'duration': 2146, 'release_timestamp': 1721373980, 'uploader': 'German UPA', 'uploader_id': 'germanupa', 'upload_date': '20240719', 'comment_count': int, }, 'expected_warnings': ['Failed to parse XML: not well-formed'], 'ski...
No need to pass the video id ```suggestion raise ExtractorError('Failed to extract URL from the query parameters') ```
'release_timestamp': 1721373980, 'uploader': 'German UPA', 'uploader_id': 'germanupa', 'upload_date': '20240719', 'comment_count': int, }, 'expected_warnings': ['Failed to parse XML: not well-formed'], 'skip': 'login required', }] ...
@@ -0,0 +1,91 @@ +from .common import InfoExtractor +from .vimeo import VimeoIE +from ..utils import ( + ExtractorError, + parse_qs, + traverse_obj, + url_or_none, +) + + +class GermanupaIE(InfoExtractor): + IE_DESC = 'germanupa.de' + _VALID_URL = r'https?://germanupa\.de/mediathek/(?P<id>[\w-]+)' + ...
yt_dlp/extractor/germanupa.py
26
Python
0.929
bug
133
30
30
false
[ie/Germanupa] Add extractor
10,538
yt-dlp/yt-dlp
132,642
Python
seproDev
grqz
'thumbnail': 'https://i.vimeocdn.com/video/1904187064-2a672630c30f9ad787bd390bff3f51d7506a3e8416763ba6dbf465732b165c5c-d_1280', 'duration': 2146, 'release_timestamp': 1721373980, 'uploader': 'German UPA', 'uploader_id': 'germanupa', 'upload_date': ...
when is this `raise_login_required` reached? for the "login required" test example, it just falls back to generic and raises unsupported
'duration': 2146, 'release_timestamp': 1721373980, 'uploader': 'German UPA', 'uploader_id': 'germanupa', 'upload_date': '20240719', 'comment_count': int, }, 'expected_warnings': ['Failed to parse XML: not well-formed'], 'ski...
@@ -0,0 +1,91 @@ +from .common import InfoExtractor +from .vimeo import VimeoIE +from ..utils import ( + ExtractorError, + parse_qs, + traverse_obj, + url_or_none, +) + + +class GermanupaIE(InfoExtractor): + IE_DESC = 'germanupa.de' + _VALID_URL = r'https?://germanupa\.de/mediathek/(?P<id>[\w-]+)' + ...
yt_dlp/extractor/germanupa.py
26
Python
0.5
question
136
31
31
false
[ie/Germanupa] Add extractor
10,538
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
'ext': 'mp4', 'release_date': '20240719', 'uploader_url': 'https://vimeo.com/germanupa', 'timestamp': 1721373980, 'license': 'by-sa', 'like_count': int, 'thumbnail': 'https://i.vimeocdn.com/video/1904187064-2a672630c30f9ad787bd390bff3f5...
```suggestion webpage, 'embedded video', default=None, group='url'), ```
'ext': 'mp4', 'release_date': '20240719', 'uploader_url': 'https://vimeo.com/germanupa', 'timestamp': 1721373980, 'license': 'by-sa', 'like_count': int, 'thumbnail': 'https://i.vimeocdn.com/video/1904187064-2a672630c30f9ad787bd390bff3f5...
@@ -0,0 +1,90 @@ +from .common import InfoExtractor +from .vimeo import VimeoIE +from ..utils import ( + parse_qs, + traverse_obj, + url_or_none, +) + + +class GermanupaIE(InfoExtractor): + IE_DESC = 'germanupa.de' + _VALID_URL = r'https?://germanupa\.de/mediathek/(?P<id>[\w-]+)' + _TESTS = [{ + ...
yt_dlp/extractor/germanupa.py
26
Python
0.571
suggestion
90
37
38
false
[ie/Germanupa] Add extractor
10,538
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
'like_count': int, 'thumbnail': 'https://i.vimeocdn.com/video/1904187064-2a672630c30f9ad787bd390bff3f51d7506a3e8416763ba6dbf465732b165c5c-d_1280', 'duration': 2146, 'release_timestamp': 1721373980, 'uploader': 'German UPA', 'uploader_id': 'germanup...
```suggestion if self._search_regex( r'<div[^>]+class\s*?=\s*?([\'"])(?:(?!\1).)*login-wrapper(?:(?!\1).)*\1', webpage, 'login wrapper', default=None): ```
'like_count': int, 'thumbnail': 'https://i.vimeocdn.com/video/1904187064-2a672630c30f9ad787bd390bff3f51d7506a3e8416763ba6dbf465732b165c5c-d_1280', 'duration': 2146, 'release_timestamp': 1721373980, 'uploader': 'German UPA', 'uploader_id': 'germanup...
@@ -0,0 +1,90 @@ +from .common import InfoExtractor +from .vimeo import VimeoIE +from ..utils import ( + parse_qs, + traverse_obj, + url_or_none, +) + + +class GermanupaIE(InfoExtractor): + IE_DESC = 'germanupa.de' + _VALID_URL = r'https?://germanupa\.de/mediathek/(?P<id>[\w-]+)' + _TESTS = [{ + ...
yt_dlp/extractor/germanupa.py
26
Python
0.786
suggestion
211
32
33
false
[ie/Germanupa] Add extractor
10,538
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
video_id, title = video_data['bvid'], video_data.get('title') # Bilibili anthologies are similar to playlists but all videos share the same video ID as the anthology itself. page_list_json = not is_festival and traverse_obj( self._download_json( 'https://api.bilibil...
I'd recommend keep the original `play_info` traversal, and make a check here, so you don't have to make an unnecessary request. ```suggestion if not play_info or not self.is_logged_in: query = {'try_look': 1} if not self.is_logged_in else {} play_info = self._download_playinfo(video_...
# Bilibili anthologies are similar to playlists but all videos share the same video ID as the anthology itself. page_list_json = (not is_festival and traverse_obj( self._download_json( 'https://api.bilibili.com/x/player/pagelist', video_id, fatal=False, query...
@@ -683,11 +682,10 @@ def _real_extract(self, url): aid = video_data.get('aid') old_video_id = format_field(aid, None, f'%s_part{part_id or 1}') cid = traverse_obj(video_data, ('pages', part_id - 1, 'cid')) if part_id else video_data.get('cid') + play_info = self._download_playinfo(vid...
yt_dlp/extractor/bilibili.py
26
Python
0.786
suggestion
359
51
51
false
[BiliBili] extract 720p/1080p format without logging in by passing `'try_look': 1` to the api
10,559
yt-dlp/yt-dlp
132,642
Python
c-basalt
grqz
'episode': '炭治郎篇', 'episode_id': '345120', 'episode_number': 27, 'title': '#1 炭治郎篇', 'duration': 1922.129, 'timestamp': 1602853860, 'upload_date': '20201016', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$', }, ...
For bangumi like `https://www.bilibili.com/bangumi/play/ep829434`, all logged-in users can access premium quality, and all qualities are directly embedded in `__playinfo__` of page HTML like non-festival `BiliBiliIE` videos. (The trial counter can be simply ignored). May be worth taking a look at that or see if we can...
'season_id': '26801', 'season_number': 1, 'episode': '炭治郎篇', 'episode_id': '345120', 'episode_number': 27, 'title': '#1 炭治郎篇', 'duration': 1922.129, 'timestamp': 1602853860, 'upload_date': '20201016', ...
@@ -861,7 +866,7 @@ def _real_extract(self, url): headers['Referer'] = url play_info = self._download_json( 'https://api.bilibili.com/pgc/player/web/v2/playurl', episode_id, - 'Extracting episode', query={'fnval': '4048', 'ep_id': episode_id}, + 'Extracting episode',...
yt_dlp/extractor/bilibili.py
26
Python
0.643
suggestion
374
51
51
false
[BiliBili] extract 720p/1080p format without logging in by passing `'try_look': 1` to the api
10,559
yt-dlp/yt-dlp
132,642
Python
c-basalt
grqz
# from getMixinKey() in the vendor js mixin_key_enc_tab = [ 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, ...
Could we change the `qn` parameter to a `query` parameter instead of doing `**kwargs` ?
# from getMixinKey() in the vendor js mixin_key_enc_tab = [ 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, ...
@@ -164,14 +164,18 @@ def _sign_wbi(self, params, video_id): params['w_rid'] = hashlib.md5(f'{query}{self._get_wbi_key(video_id)}'.encode()).hexdigest() return params - def _download_playinfo(self, bvid, cid, headers=None, qn=None): - params = {'bvid': bvid, 'cid': cid, 'fnval': 4048} - ...
yt_dlp/extractor/bilibili.py
26
Python
0.429
question
88
51
51
false
[BiliBili] extract 720p/1080p format without logging in by passing `'try_look': 1` to the api
10,559
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
video_id, title = video_data['bvid'], video_data.get('title') # Bilibili anthologies are similar to playlists but all videos share the same video ID as the anthology itself. page_list_json = (not is_festival and traverse_obj( self._download_json( 'https://api.bilibil...
this `is_logged_in` check seems redundant if we are also popping `try_look` from the query params in `_download_playinfo()`
video_id, title = video_data['bvid'], video_data.get('title') # Bilibili anthologies are similar to playlists but all videos share the same video ID as the anthology itself. page_list_json = (not is_festival and traverse_obj( self._download_json( 'https://api.bilibil...
@@ -676,6 +680,9 @@ def _real_extract(self, url): aid = video_data.get('aid') old_video_id = format_field(aid, None, f'%s_part{part_id or 1}') cid = traverse_obj(video_data, ('pages', part_id - 1, 'cid')) if part_id else video_data.get('cid') + if is_festival or not self.is_logged_in: ...
yt_dlp/extractor/bilibili.py
26
Python
0.5
suggestion
123
51
51
false
[BiliBili] extract 720p/1080p format without logging in by passing `'try_look': 1` to the api
10,559
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
# from getMixinKey() in the vendor js mixin_key_enc_tab = [ 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6...
a nitpick since we unpack it immediately and don't use it again, but it's better to not have mutable args IMO ```suggestion def _download_playinfo(self, bvid, cid, headers=None, query=None): params = {'bvid': bvid, 'cid': cid, 'fnval': 4048, **(query or {})} ```
# from getMixinKey() in the vendor js mixin_key_enc_tab = [ 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6...
@@ -164,14 +164,18 @@ def _sign_wbi(self, params, video_id): params['w_rid'] = hashlib.md5(f'{query}{self._get_wbi_key(video_id)}'.encode()).hexdigest() return params - def _download_playinfo(self, bvid, cid, headers=None, qn=None): - params = {'bvid': bvid, 'cid': cid, 'fnval': 4048} - ...
yt_dlp/extractor/bilibili.py
26
Python
0.857
suggestion
278
51
51
false
[BiliBili] extract 720p/1080p format without logging in by passing `'try_look': 1` to the api
10,559
yt-dlp/yt-dlp
132,642
Python
bashonly
grqz
'upload_date': '20201016', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$', }, }] def _real_extract(self, url): episode_id = self._match_id(url) headers = self.geo_verification_headers() webpage = self._download_webpage(url, episode_id, headers=headers) ...
what do you mean? that url isnt even `suitable` for this IE
'episode_number': 27, 'title': '#1 炭治郎篇', 'duration': 1922.129, 'timestamp': 1602853860, 'upload_date': '20201016', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$', }, }] def _real_extract(self, url): episode_id = self._ma...
@@ -862,10 +866,16 @@ def _real_extract(self, url): self.raise_login_required('This video is for premium members only') headers['Referer'] = url - play_info = self._download_json( - 'https://api.bilibili.com/pgc/player/web/v2/playurl', episode_id, - 'Extracting episo...
yt_dlp/extractor/bilibili.py
26
Python
0.357
question
59
51
51
false
[BiliBili] extract 720p/1080p format without logging in by passing `'try_look': 1` to the api
10,559
yt-dlp/yt-dlp
132,642
Python
grqz
grqz
'url': 'https://kick.com/xqc', 'only_matching': True, }] @classmethod def suitable(cls, url): return False if KickClipIE.suitable(url) else super().suitable(url) def _real_extract(self, url): channel = self._match_id(url) response = self._call_api(f'v2/channels/...
revert these. `uploader_id` and `channel_id` values need to be str
def _real_extract(self, url): channel = self._match_id(url) response = self._call_api(f'v2/channels/{channel}', channel) if not traverse_obj(response, 'livestream', expected_type=dict): raise UserNotLive(video_id=channel) return { 'channel': channel, ...
@@ -69,36 +92,39 @@ def _real_extract(self, url): response, ('livestream', ('session_title', 'slug')), get_all=False, default=''), 'description': traverse_obj(response, ('user', 'bio')), 'channel': channel, - 'channel_id': str_or_none(traverse_obj(response, 'id', ('...
yt_dlp/extractor/kick.py
26
Python
0.357
suggestion
66
51
51
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
def _real_extract(self, url): channel = self._match_id(url) response = self._call_api(f'v2/channels/{channel}', channel) if not traverse_obj(response, 'livestream', expected_type=dict): raise UserNotLive(video_id=channel) return { 'id': str(traverse_obj( ...
language is a format field, shouldn't be returned here ```suggestion ```
'channel': channel, 'is_live': True, 'formats': self._extract_m3u8_formats(response['playback_url'], channel, 'mp4', live=True), **traverse_obj(response, { 'id': ('livestream', 'slug', {str}), 'title': ('livestream', 'session_title', {str})...
@@ -69,36 +92,39 @@ def _real_extract(self, url): response, ('livestream', ('session_title', 'slug')), get_all=False, default=''), 'description': traverse_obj(response, ('user', 'bio')), 'channel': channel, - 'channel_id': str_or_none(traverse_obj(response, 'id', ('...
yt_dlp/extractor/kick.py
26
Python
0.643
suggestion
74
51
51
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
def _real_extract(self, url): video_id = self._match_id(url) response = self._call_api(f'v1/video/{video_id}', video_id) return { 'id': video_id, 'formats': self._extract_m3u8_formats(response['source'], video_id, 'mp4'), 'title': traverse_obj( ...
```suggestion _VALID_URL = r'https?://(?:www\.)?kick\.com/(?P<channel>[\w-]+)/?\?(?:[^#]+&)?clip=(?P<id>clip_[\w-]+)' ```
'description': ('livestream', 'channel', 'user', 'bio', {str}), 'channel': ('livestream', 'channel', 'slug', {str}), 'channel_id': ('livestream', 'channel', 'id', {int}, {str_or_none}), 'uploader': ('livestream', 'channel', 'user', 'username', {str}), ...
@@ -117,12 +143,100 @@ def _real_extract(self, url): response, ('livestream', ('session_title', 'slug')), get_all=False, default=''), 'description': traverse_obj(response, ('livestream', 'channel', 'user', 'bio')), 'channel': traverse_obj(response, ('livestream', 'channel', 's...
yt_dlp/extractor/kick.py
26
Python
0.714
suggestion
127
51
51
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
'view_count': int, 'like_count': int, 'is_mature': False, 'duration': 49.0, 'thumbnail': 'https://clips.kick.com/clips/j3/clip_01H9SKET879NE7N9RJRRDS98J3/thumbnail.png', 'uploader_id': 2027722, 'channel': 'Destiny', 'channel...
it's ok for `clip` to be fatal, and we don't use `response` anywhere else ```suggestion clip = self._call_api(f'v2/clips/{clip_id}/play', clip_id)['clip'] ```
'params': {'skip_download': 'm3u8'}, }] def _real_extract(self, url): clip_id = self._match_id(url) clip = self._call_api(f'v2/clips/{clip_id}/play', clip_id)['clip'] clip_url = clip['clip_url'] if determine_ext(clip_url) == 'm3u8': formats = self._extract_m...
@@ -117,12 +143,100 @@ def _real_extract(self, url): response, ('livestream', ('session_title', 'slug')), get_all=False, default=''), 'description': traverse_obj(response, ('livestream', 'channel', 'user', 'bio')), 'channel': traverse_obj(response, ('livestream', 'channel', 's...
yt_dlp/extractor/kick.py
26
Python
0.786
suggestion
169
51
32
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
'like_count': int, 'is_mature': False, 'duration': 49.0, 'thumbnail': 'https://clips.kick.com/clips/j3/clip_01H9SKET879NE7N9RJRRDS98J3/thumbnail.png', 'uploader_id': 2027722, 'channel': 'Destiny', 'channel_id': 1772249, 'cat...
same here, it's ok for `clip_url` to be fatal ```suggestion clip_url = clip['clip_url'] ```
}] def _real_extract(self, url): clip_id = self._match_id(url) clip = self._call_api(f'v2/clips/{clip_id}/play', clip_id)['clip'] clip_url = clip['clip_url'] if determine_ext(clip_url) == 'm3u8': formats = self._extract_m3u8_formats(clip_url, clip_id, 'mp4') ...
@@ -117,12 +143,100 @@ def _real_extract(self, url): response, ('livestream', ('session_title', 'slug')), get_all=False, default=''), 'description': traverse_obj(response, ('livestream', 'channel', 'user', 'bio')), 'channel': traverse_obj(response, ('livestream', 'channel', 's...
yt_dlp/extractor/kick.py
26
Python
0.714
suggestion
102
51
31
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
clip_url = traverse_obj(clip, 'clip_url') if determine_ext(clip_url) == 'm3u8': formats = self._extract_m3u8_formats(clip_url, clip_id, 'mp4') else: formats = [{'url': clip_url}] return { 'id': clip_id, 'formats': formats, 'ex...
- we can make this less of an eyesore with dict key traversal (use a single traversal that returns a dict and unpack it in the info dict) - `livestream_id` is not a valid info dict field -- in my suggestion I changed it to a description with attribution to the original stream id - `category_id` is not a valid info di...
import functools from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( UserNotLive, determine_ext, float_or_none, int_or_none, merge_dicts, parse_iso8601, str_or_none, traverse_obj, unified_timestamp, url_or_none, ) class KickBaseIE(InfoE...
@@ -117,12 +143,100 @@ def _real_extract(self, url): response, ('livestream', ('session_title', 'slug')), get_all=False, default=''), 'description': traverse_obj(response, ('livestream', 'channel', 'user', 'bio')), 'channel': traverse_obj(response, ('livestream', 'channel', 's...
yt_dlp/extractor/kick.py
26
Python
0.857
refactor
1,724
27
222
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
'title': 'W jews', 'ext': 'mp4', 'view_count': int, 'like_count': int, 'is_mature': False, 'duration': 49.0, 'thumbnail': 'https://clips.kick.com/clips/j3/clip_01H9SKET879NE7N9RJRRDS98J3/thumbnail.png', 'uploader_id': 202772...
do we need/use `channel_slug`? if not: ```suggestion clip_id = self._match_id(url) ```
'age_limit': 0, }, 'params': {'skip_download': 'm3u8'}, }] def _real_extract(self, url): clip_id = self._match_id(url) clip = self._call_api(f'v2/clips/{clip_id}/play', clip_id)['clip'] clip_url = clip['clip_url'] if determine_ext(clip_url) == 'm3u8'...
@@ -117,12 +143,100 @@ def _real_extract(self, url): response, ('livestream', ('session_title', 'slug')), get_all=False, default=''), 'description': traverse_obj(response, ('livestream', 'channel', 'user', 'bio')), 'channel': traverse_obj(response, ('livestream', 'channel', 's...
yt_dlp/extractor/kick.py
26
Python
0.643
question
97
51
34
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
from yt_dlp.utils._utils import unified_strdate from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( UserNotLive, determine_ext, float_or_none, int_or_none, merge_dicts, traverse_obj, unified_timestamp, url_or_none, ) # Routes -------------------...
```suggestion from .common import InfoExtractor ```
import functools from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( UserNotLive, determine_ext, float_or_none, int_or_none, merge_dicts, parse_iso8601, str_or_none, traverse_obj, unified_timestamp, url_or_none, ) class KickBaseIE(InfoE...
@@ -1,15 +1,32 @@ +from yt_dlp.utils._utils import unified_strdate + from .common import InfoExtractor
yt_dlp/extractor/kick.py
3
Python
0.643
refactor
53
28
28
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
from yt_dlp.utils._utils import unified_strdate from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( UserNotLive, determine_ext, float_or_none, int_or_none, merge_dicts, traverse_obj, unified_timestamp, url_or_none, ) # Routes -------------------...
```suggestion merge_dicts, parse_iso8601, str_or_none, ```
import functools from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( UserNotLive, determine_ext, float_or_none, int_or_none, merge_dicts, parse_iso8601, str_or_none, traverse_obj, unified_timestamp, url_or_none, ) class KickBaseIE(InfoE...
@@ -1,15 +1,32 @@ +from yt_dlp.utils._utils import unified_strdate + from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( UserNotLive, + determine_ext, float_or_none, + int_or_none, merge_dicts,
yt_dlp/extractor/kick.py
10
Python
0.571
suggestion
74
35
35
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
JioCinemaSeriesIE, ) from .jiosaavn import ( JioSaavnAlbumIE, JioSaavnPlaylistIE, JioSaavnSongIE, ) from .joj import JojIE from .joqrag import JoqrAgIE from .jove import JoveIE from .jstream import JStreamIE from .jtbc import ( JTBCIE, JTBCProgramIE, ) from .jwplatform import JWPlatformIE from ....
```suggestion from .kick import ( KickClipIE, KickIE, KickVODIE, ) ```
JioCinemaSeriesIE, ) from .jiosaavn import ( JioSaavnAlbumIE, JioSaavnPlaylistIE, JioSaavnSongIE, ) from .joj import JojIE from .joqrag import JoqrAgIE from .jove import JoveIE from .jstream import JStreamIE from .jtbc import ( JTBCIE, JTBCProgramIE, ) from .jwplatform import JWPlatformIE from ....
@@ -938,10 +938,7 @@ KhanAcademyIE, KhanAcademyUnitIE, ) -from .kick import ( - KickIE, - KickVODIE, -) +from .kick import KickClipIE, KickIE, KickVODIE
yt_dlp/extractor/_extractors.py
26
Python
0.571
suggestion
88
51
51
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( UserNotLive, determine_ext, float_or_none, int_or_none, merge_dicts, parse_iso8601, str_or_none, traverse_obj, unified_timestamp, url_or_none, ) class KickBaseIE(InfoExtractor): def _...
```suggestion class KickBaseIE(InfoExtractor): ```
import functools from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( UserNotLive, determine_ext, float_or_none, int_or_none, merge_dicts, parse_iso8601, str_or_none, traverse_obj, unified_timestamp, url_or_none, ) class KickBaseIE(InfoE...
@@ -2,15 +2,16 @@ from ..networking import HEADRequest from ..utils import ( UserNotLive, + determine_ext, float_or_none, + int_or_none, merge_dicts, + parse_iso8601, str_or_none, traverse_obj, unified_timestamp, url_or_none, ) - - class KickBaseIE(InfoExtractor):
yt_dlp/extractor/kick.py
15
Python
0.643
refactor
56
40
40
false
[ie/kick:clips] Add extractor
10,572
yt-dlp/yt-dlp
132,642
Python
bashonly
luvyana
reasons = traverse_obj(player_response, ('playabilityStatus', ('status', 'reason'))) AGE_GATE_REASONS = ( 'confirm your age', 'age-restricted', 'inappropriate', # reason 'age_verification_required', 'age_check_required', # status ) return any(expected in reason...
perhaps define client-specific params in the client definitions? think I was originally planning on doing that at one stage
item for item in traverse_obj(contents, (..., 'itemSectionRenderer'), default={}) if item.get('sectionIdentifier') == 'comment-item-section'), None) yield from self._comment_entries(renderer, ytcfg, video_id) max_comments = int_or_none(self._configuration_arg('max_co...
@@ -3661,6 +3676,9 @@ def _extract_player_response(self, client, video_id, master_ytcfg, player_ytcfg, 'videoId': video_id, } + if _split_innertube_client(client)[0] == 'android_testsuite': + yt_query['params'] = '2AMB'
yt_dlp/extractor/youtube.py
26
Python
0.357
suggestion
126
51
51
false
[ie/youtube] Player client maintenance
10,573
yt-dlp/yt-dlp
132,642
Python
coletdjnz
bashonly
import functools import re from yt_dlp.extractor.common import InfoExtractor from yt_dlp.utils import ( ExtractorError, clean_html, extract_attributes, get_element_by_class, get_element_html_by_id, join_nonempty, parse_duration, unified_timestamp, ) from yt_dlp.utils.traversal import tr...
```suggestion from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, extract_attributes, get_element_by_class, get_element_html_by_id, join_nonempty, parse_duration, unified_timestamp, ) from ..utils.traversal import traverse_obj ```
import functools import re from .common import InfoExtractor from ..utils import ( ExtractorError, clean_html, extract_attributes, get_element_by_class, get_element_html_by_id, join_nonempty, parse_duration, unified_timestamp, ) from ..utils.traversal import traverse_obj class Learnin...
@@ -0,0 +1,78 @@ +import functools +import re + +from yt_dlp.extractor.common import InfoExtractor +from yt_dlp.utils import ( + ExtractorError, + clean_html, + extract_attributes, + get_element_by_class, + get_element_html_by_id, + join_nonempty, + parse_duration, + unified_timestamp, +) +from ...
yt_dlp/extractor/learningonscreen.py
15
Python
1
refactor
307
40
40
false
[ie/learningonscreen] Add extractor
10,590
yt-dlp/yt-dlp
132,642
Python
bashonly
bashonly