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 from ..utils import ( clean_html, parse_duration, str_or_none, traverse_obj, unified_strdate, unified_timestamp, urlhandle_detect_ext, ) class GlobalPlayerBaseIE(InfoExtractor): def _get_pageProps(self, url, video_id): webpage = self._download...
`traverse_obj` isn't needed here since returning `None` will be fatal in all subclasses anyways ```suggestion return self._search_nextjs_data(webpage, video_id)['props']['pageProps'] ```
from .common import InfoExtractor from ..utils import ( clean_html, join_nonempty, parse_duration, str_or_none, traverse_obj, unified_strdate, unified_timestamp, urlhandle_detect_ext, ) class GlobalPlayerBaseIE(InfoExtractor): def _get_page_props(self, url, video_id): webpa...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
18
Python
0.714
suggestion
197
43
43
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
from .common import InfoExtractor from ..utils import ( clean_html, parse_duration, str_or_none, traverse_obj, unified_strdate, unified_timestamp, urlhandle_detect_ext, ) class GlobalPlayerBaseIE(InfoExtractor): def _get_pageProps(self, url, video_id): webpage = self._download...
review note: server does not allow HEAD requests ```suggestion def _request_ext(self, url, video_id): return urlhandle_detect_ext(self._request_webpage( url, video_id, note='Determining source extension')) ```
from .common import InfoExtractor from ..utils import ( clean_html, join_nonempty, parse_duration, str_or_none, traverse_obj, unified_strdate, unified_timestamp, urlhandle_detect_ext, ) class GlobalPlayerBaseIE(InfoExtractor): def _get_page_props(self, url, video_id): webpa...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
22
Python
0.929
suggestion
238
47
47
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'ext': 'aac', 'title': str, 'thumbnail': 'md5:6f13378a53ce55bcf57365a654e1b490', 'live_status': 'is_live', 'description': 'turn up the feel good!', 'display_id': 'heart-uk', }}, { # regional variation 'url': 'https://www.gl...
it improves readability to use a new var for the format url imo ```suggestion stream_url = station['streamUrl'] ```
'ext': 'aac', 'description': 'turn up the feel good!', 'thumbnail': 'https://herald.musicradio.com/media/49b9e8cb-15bf-4bf2-8c28-a4850cc6b0f3.png', 'live_status': 'is_live', 'title': 're:^Heart UK.+$', 'display_id': 'heart-uk', }, }, { ...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.786
suggestion
126
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
}}, { # regional variation 'url': 'https://www.globalplayer.com/live/heart/london/', 'info_dict': { 'id': 'AMqg', 'ext': 'aac', 'title': str, 'thumbnail': 'md5:6f13378a53ce55bcf57365a654e1b490', 'description': 'turn up the feel...
inline in return (see suggestion below) ```suggestion ```
}, }, { # regional variation 'url': 'https://www.globalplayer.com/live/heart/london/', 'info_dict': { 'id': 'AMqg', 'ext': 'aac', 'thumbnail': 'https://herald.musicradio.com/media/49b9e8cb-15bf-4bf2-8c28-a4850cc6b0f3.png', 'title': 're:...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.571
suggestion
59
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'info_dict': { 'id': 'AMqg', 'ext': 'aac', 'title': str, 'thumbnail': 'md5:6f13378a53ce55bcf57365a654e1b490', 'description': 'turn up the feel good!', 'live_status': 'is_live', 'display_id': 'heart-london', }}, ] ...
need to import `join_nonempty` ```suggestion 'display_id': join_nonempty('brandSlug', 'slug', from_dict=station) or station.get('legacyStationPrefix'), ```
'info_dict': { 'id': 'AMqg', 'ext': 'aac', 'thumbnail': 'https://herald.musicradio.com/media/49b9e8cb-15bf-4bf2-8c28-a4850cc6b0f3.png', 'title': 're:^Heart London.+$', 'live_status': 'is_live', 'display_id': 'heart-london', 'des...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.714
suggestion
170
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
**traverse_obj(episode, { 'id': 'id', 'description': ('description', {clean_html}), 'duration': ('duration', {parse_duration}), 'thumbnail': 'imageUrl', 'url': 'streamUrl', 'timestamp': (['pubDate', 'startDate'],...
Are you writing these tests by hand? If so you can let the test script generate them for you. If you only write the `url`, `id`, and `ext`, and then run the test, it will output a dict for you that is usually formatted properly. Could fix up the rest of the tests' formatting too ```suggestion }, }, { `...
**traverse_obj(episode, { 'id': 'id', 'description': ('description', {clean_html}), 'duration': ('duration', {parse_duration}), 'thumbnail': 'imageUrl', 'url': 'streamUrl', 'timestamp': (('pubDate', 'startDate'),...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.857
suggestion
322
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'ext': 'aac', 'title': str, 'thumbnail': 'md5:6f13378a53ce55bcf57365a654e1b490', 'description': 'turn up the feel good!', 'live_status': 'is_live', 'display_id': 'heart-london', }}, ] def _real_extract(self, url): video_id...
```suggestion 'url': stream_url, 'ext': self._request_ext(stream_url, video_id), ```
'ext': 'aac', 'thumbnail': 'https://herald.musicradio.com/media/49b9e8cb-15bf-4bf2-8c28-a4850cc6b0f3.png', 'title': 're:^Heart London.+$', 'live_status': 'is_live', 'display_id': 'heart-london', 'description': 'turn up the feel good!', }, ...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.714
suggestion
111
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'title': (['name', 'brandName'], {str_or_none}), 'description': 'tagline', 'thumbnail': 'brandLogo', }, get_all=False), } class GlobalPlayerLivePlaylistIE(GlobalPlayerBaseIE): _VALID_URL = r'https?://www\.globalplayer\.com/playlists/(?P<id>\w+)/$...
agree with the comment, but it can be removed ```suggestion def _real_extract(self, url): ```
class GlobalPlayerLivePlaylistIE(GlobalPlayerBaseIE): _VALID_URL = r'https?://www\.globalplayer\.com/playlists/(?P<id>\w+)' _TESTS = [{ # "live playlist" 'url': 'https://www.globalplayer.com/playlists/8bLk/', 'info_dict': { 'id': '8bLk', 'ext': 'aac', ...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.786
refactor
100
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
}, get_all=False), } class GlobalPlayerLivePlaylistIE(GlobalPlayerBaseIE): _VALID_URL = r'https?://www\.globalplayer\.com/playlists/(?P<id>\w+)/$' _TESTS = [{ # "live playlist" 'url': 'https://www.globalplayer.com/playlists/8bLk/', 'info_dict': { 'id': '...
same as above ```suggestion stream_url = station['streamUrl'] ```
# "live playlist" 'url': 'https://www.globalplayer.com/playlists/8bLk/', 'info_dict': { 'id': '8bLk', 'ext': 'aac', 'live_status': 'is_live', 'description': 'md5:e10f5e10b01a7f2c14ba815509fbb38d', 'thumbnail': 'https://images.globalplay...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.571
suggestion
76
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'url': 'https://www.globalplayer.com/playlists/8bLk/', 'info_dict': { 'id': '8bLk', 'ext': 'aac', 'title': str, 'description': 'md5:e10f5e10b01a7f2c14ba815509fbb38d', 'live_status': 'is_live', 'thumbnail': 'md5:0e0d47914a380577afdb4...
`id` is mandatory, and we can just use `video_id`, yeah? ```suggestion return { 'id': video_id, 'url': stream_url, 'ext': self._request_ext(stream_url, video_id), 'vcodec': 'none', 'is_live': True, **traverse_obj(station, { ```
'title': 're:^Classic FM Hall of Fame.+$' }, }] def _real_extract(self, url): video_id = self._match_id(url) station = self._get_page_props(url, video_id)['playlistData'] stream_url = station['streamUrl'] return { 'id': video_id, 'url...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.857
suggestion
316
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'title': 'Filthy Ritual', 'categories': ['Society & Culture', 'True Crime'], }, 'playlist_mincount': 5, }, { # radio catchup 'url': 'https://www.globalplayer.com/catchup/lbc/uk/46vyD7z/', 'info_dict': { 'id': '46vyD7z', 'title':...
we can inline categories in return ```suggestion series = props['podcastInfo'] if podcast else props['catchupInfo'] ```
'description': 'Nick Ferrari At Breakfast is Leading Britain\'s Conversation.', 'title': 'Nick Ferrari', 'thumbnail': 'md5:4df24d8a226f5b2508efbcc6ae874ebf', }, }] def _real_extract(self, url): video_id, podcast = self._match_valid_url(url).group('id', 'podca...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.857
suggestion
130
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'playlist_mincount': 3, }] def _real_extract(self, url): video_id, podcast = self._match_valid_url(url).group('id', 'podcast') props = self._get_pageProps(url, video_id) if podcast: series = props['podcastInfo'] categories = [i.get('name') for i in serie...
with traversal we can filter for entries with `id` and `url` keys/truthy values ```suggestion return { '_type': 'playlist', 'id': video_id, 'entries': [self._extract_audio(ep, series) for ep in traverse_obj( series, ('episodes', lambda _, v: v['i...
'id': video_id, 'entries': [self._extract_audio(ep, series) for ep in traverse_obj( series, ('episodes', lambda _, v: v['id'] and v['streamUrl']))], 'categories': traverse_obj(series, ('categories', ..., 'name')) or None, **traverse_obj(series, { ...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
1
security
689
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
data = self._search_nextjs_data(webpage, video_id) return traverse_obj(data, ('props', 'pageProps')) def _request_ext(self, url, video_id): urlh = self._request_webpage(url, video_id, note='Determining source extension') return urlhandle_detect_ext(urlh) def _extract_audio(self...
edit: see pukkandan's reply, this suggestion is not necessary `id` and `url` should be fatal; we'll already filter for them before extracting a playlist, and we don't want to return a single ep without id or url ```suggestion def _extract_audio(self, episode, series): return { 'id': episo...
return self._search_nextjs_data(webpage, video_id)['props']['pageProps'] def _request_ext(self, url, video_id): return urlhandle_detect_ext(self._request_webpage( # Server rejects HEAD requests url, video_id, note='Determining source extension')) def _extract_audio(self, episode, ...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.857
refactor
937
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'url': 'https://www.globalplayer.com/catchup/lbc/uk/episodes/2zGq26Vcv1fCWhddC4JAwETXWe/', 'info_dict': { 'id': '2zGq26Vcv1fCWhddC4JAwETXWe', 'ext': 'm4a', 'title': 'Nick Ferrari', 'duration': 10800, 'description': 'md5:53b6fa5ef71a3cff6628551b...
`series` is only used for metadata, shouldn't be fatal ```suggestion episode = props['podcastEpisode'] if podcast else props['catchupEpisode'] return self._extract_audio( episode, traverse_obj(episode, 'podcast', 'show', expected_type=dict) or {}) ```
def _real_extract(self, url): video_id, podcast = self._match_valid_url(url).group('id', 'podcast') props = self._get_page_props(url, video_id) episode = props['podcastEpisode'] if podcast else props['catchupEpisode'] return self._extract_audio( episode, traverse_obj(epi...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
1
refactor
286
51
38
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
_VALID_URL = r'https?://www\.globalplayer\.com/videos/(?P<id>\w+)/$' _TESTS = [{ 'url': 'https://www.globalplayer.com/videos/2JsSZ7Gm2uP/', 'info_dict': { 'id': '2JsSZ7Gm2uP', 'thumbnail': 'md5:d4498af48e15aae4839ce77b97d39550', 'title': 'Treble Malakai Bayoh ...
```suggestion return { 'id': video_id, **traverse_obj(meta, { 'url': 'url', 'thumbnail': ('image', 'url'), 'title': 'title', 'upload_date': ('publish_date', {unified_strdate}), 'description': 'descrip...
from .common import InfoExtractor from ..utils import ( clean_html, join_nonempty, parse_duration, str_or_none, traverse_obj, unified_strdate, unified_timestamp, urlhandle_detect_ext, ) class GlobalPlayerBaseIE(InfoExtractor): def _get_page_props(self, url, video_id): webpa...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.786
suggestion
359
27
255
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
urlh = self._request_webpage(url, video_id, note='Determining source extension') return urlhandle_detect_ext(urlh) def _extract_audio(self, episode, series): return { 'vcodec': 'none', **traverse_obj(series, { 'series': 'title', 'serie...
```suggestion class GlobalPlayerLiveIE(GlobalPlayerBaseIE): _VALID_URL = r'https?://www\.globalplayer\.com/live/(?P<id>\w+)/\w+' ```
url, video_id, note='Determining source extension')) def _extract_audio(self, episode, series): return { 'vcodec': 'none', **traverse_obj(series, { 'series': 'title', 'series_id': 'id', 'thumbnail': 'imageUrl', ...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.714
suggestion
139
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
station = self._get_pageProps(url, video_id)['station'] url = station['streamUrl'] display_id = [station.get('brandSlug'), station.get('slug')] if None not in display_id: display_id = '-'.join(display_id) else: display_id = station.get('brandSlug') or sta...
```suggestion class GlobalPlayerLivePlaylistIE(GlobalPlayerBaseIE): _VALID_URL = r'https?://www\.globalplayer\.com/playlists/(?P<id>\w+)' ```
stream_url = station['streamUrl'] return { 'id': station['id'], 'display_id': join_nonempty('brandSlug', 'slug', from_dict=station) or station.get('legacyStationPrefix'), 'url': stream_url, 'ext': self._request_ext(stream_url, video_id), 'vcod...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.714
suggestion
148
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
} ] # very similar to live radio, but different enough that it's easier to separate them def _real_extract(self, url): video_id = self._match_id(url) station = self._get_pageProps(url, video_id)['playlistData'] url = station['streamUrl'] return { 'url': url...
```suggestion class GlobalPlayerAudioIE(GlobalPlayerBaseIE): _VALID_URL = r'https?://www\.globalplayer\.com/(?:(?P<podcast>podcasts)/|catchup/\w+/\w+/)(?P<id>\w+)/?(?:$|[?#])' ```
return { 'id': video_id, 'url': stream_url, 'ext': self._request_ext(stream_url, video_id), 'vcodec': 'none', 'is_live': True, **traverse_obj(station, { 'title': 'title', 'description': 'description', ...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.857
suggestion
186
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
video_id, podcast = self._match_valid_url(url).group('id', 'podcast') props = self._get_pageProps(url, video_id) if podcast: series = props['podcastInfo'] categories = [i.get('name') for i in series.get('categories')] else: series = props['catchupInfo...
```suggestion class GlobalPlayerAudioEpisodeIE(GlobalPlayerBaseIE): _VALID_URL = r'https?://www\.globalplayer\.com/(?:(?P<podcast>podcasts)|catchup/\w+/\w+)/episodes/(?P<id>\w+)/?(?:$|[?#])' ```
**traverse_obj(series, { 'description': 'description', 'thumbnail': 'imageUrl', 'title': 'title', 'uploader': 'itunesAuthor', # podcasts only }), } class GlobalPlayerAudioEpisodeIE(GlobalPlayerBaseIE): _VALID_URL = r'...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.929
suggestion
201
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'title': 'Nick Ferrari', 'duration': 10800, 'description': 'md5:53b6fa5ef71a3cff6628551bcc416384', 'thumbnail': 'md5:4df24d8a226f5b2508efbcc6ae874ebf', 'series_id': '46vyD7z', 'upload_date': '20230421', 'timestamp': 1682056800, ...
```suggestion class GlobalPlayerVideoIE(GlobalPlayerBaseIE): _VALID_URL = r'https?://www\.globalplayer\.com/videos/(?P<id>\w+)' ```
return self._extract_audio( episode, traverse_obj(episode, 'podcast', 'show', expected_type=dict) or {}) class GlobalPlayerVideoIE(GlobalPlayerBaseIE): _VALID_URL = r'https?://www\.globalplayer\.com/videos/(?P<id>\w+)' _TESTS = [{ 'url': 'https://www.globalplayer.com/videos/2JsSZ7...
@@ -0,0 +1,272 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_pageProps(self, url, video_id):...
yt_dlp/extractor/globalplayer.py
26
Python
0.714
suggestion
138
51
34
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
# radio catchup 'url': 'https://www.globalplayer.com/catchup/lbc/uk/46vyD7z/', 'playlist_mincount': 3, 'info_dict': { 'id': '46vyD7z', 'description': 'Nick Ferrari At Breakfast is Leading Britain\'s Conversation.', 'title': 'Nick Ferrari', ...
should we extract `categories` and `uploader` in `_extract_audio` also/instead?
'url': 'https://www.globalplayer.com/catchup/lbc/uk/46vyD7z/', 'playlist_mincount': 3, 'info_dict': { 'id': '46vyD7z', 'description': 'Nick Ferrari At Breakfast is Leading Britain\'s Conversation.', 'title': 'Nick Ferrari', 'thumbnail': 'md5:4df24d...
@@ -0,0 +1,254 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + join_nonempty, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_page_props(...
yt_dlp/extractor/globalplayer.py
26
Python
0.429
refactor
79
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
from .common import InfoExtractor from ..utils import ( clean_html, join_nonempty, parse_duration, str_or_none, traverse_obj, unified_strdate, unified_timestamp, urlhandle_detect_ext, ) class GlobalPlayerBaseIE(InfoExtractor): def _get_page_props(self, url, video_id): webp...
```suggestion return urlhandle_detect_ext(self._request_webpage( # Server rejects HEAD requests ```
from .common import InfoExtractor from ..utils import ( clean_html, join_nonempty, parse_duration, str_or_none, traverse_obj, unified_strdate, unified_timestamp, urlhandle_detect_ext, ) class GlobalPlayerBaseIE(InfoExtractor): def _get_page_props(self, url, video_id): webpa...
@@ -0,0 +1,256 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + join_nonempty, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_page_props(...
yt_dlp/extractor/globalplayer.py
21
Python
0.857
suggestion
110
46
46
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
def _get_page_props(self, url, video_id): webpage = self._download_webpage(url, video_id) return self._search_nextjs_data(webpage, video_id)['props']['pageProps'] def _request_ext(self, url, video_id): return urlhandle_detect_ext(self._request_webpage( url, video_id, note='...
```suggestion 'timestamp': (('pubDate', 'startDate'), {unified_timestamp}), ```
def _get_page_props(self, url, video_id): webpage = self._download_webpage(url, video_id) return self._search_nextjs_data(webpage, video_id)['props']['pageProps'] def _request_ext(self, url, video_id): return urlhandle_detect_ext(self._request_webpage( # Server rejects HEAD requests ...
@@ -0,0 +1,256 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + join_nonempty, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_page_props(...
yt_dlp/extractor/globalplayer.py
26
Python
0.571
suggestion
97
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
from .common import InfoExtractor from ..utils import ( clean_html, join_nonempty, parse_duration, str_or_none, traverse_obj, unified_strdate, unified_timestamp, urlhandle_detect_ext, ) class GlobalPlayerBaseIE(InfoExtractor): def _get_page_props(self, url, video_id): webp...
```suggestion class GlobalPlayerBaseIE(InfoExtractor): def _get_page_props(self, url, video_id): ```
from .common import InfoExtractor from ..utils import ( clean_html, join_nonempty, parse_duration, str_or_none, traverse_obj, unified_strdate, unified_timestamp, urlhandle_detect_ext, ) class GlobalPlayerBaseIE(InfoExtractor): def _get_page_props(self, url, video_id): webpa...
@@ -0,0 +1,256 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + join_nonempty, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_page_props(...
yt_dlp/extractor/globalplayer.py
16
Python
0.786
refactor
107
41
41
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'url': 'https://www.globalplayer.com/live/heart/london/', 'info_dict': { 'id': 'AMqg', 'ext': 'aac', 'thumbnail': 'https://herald.musicradio.com/media/49b9e8cb-15bf-4bf2-8c28-a4850cc6b0f3.png', 'title': 're:^Heart London.+$', 'live_status': 'is...
```suggestion 'title': (('name', 'brandName'), {str_or_none}), ```
'id': 'AMqg', 'ext': 'aac', 'thumbnail': 'https://herald.musicradio.com/media/49b9e8cb-15bf-4bf2-8c28-a4850cc6b0f3.png', 'title': 're:^Heart London.+$', 'live_status': 'is_live', 'display_id': 'heart-london', 'description': 'turn up the...
@@ -0,0 +1,256 @@ +from .common import InfoExtractor +from ..utils import ( + clean_html, + join_nonempty, + parse_duration, + str_or_none, + traverse_obj, + unified_strdate, + unified_timestamp, + urlhandle_detect_ext, +) + + +class GlobalPlayerBaseIE(InfoExtractor): + + def _get_page_props(...
yt_dlp/extractor/globalplayer.py
26
Python
0.571
suggestion
84
51
51
false
[extractors/globalplayer] add Global Player extractors
6,903
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
self.write_debug(f'Failed to enable VT mode: {e}') color_policy = self.params.get('color') or {} self.params['color'] = { name: ( 'nocolor' if self.params.get('no_color') else color_policy if isinstance(color_policy, str) else colo...
In output rework I swapped `screen` and `out` bc their use seemed to get mixed up. How should we handle this here? Should this stay the way it is and also be applied to output rework or should we try to apply it here as well?
self.write_debug(f'Failed to enable VT mode: {e}') if self.params.get('no_color'): if self.params.get('color') is not None: self.report_warning('Overwriting params from "color" with "no_color"') self.params['color'] = 'no_color' term_allow_color = os...
@@ -603,10 +609,31 @@ def __init__(self, params=None, auto_init=True): except Exception as e: self.write_debug(f'Failed to enable VT mode: {e}') - self._allow_colors = Namespace(**{ - type_: not self.params.get('no_color') and supports_terminal_sequences(stream) - fo...
yt_dlp/YoutubeDL.py
26
Python
0.786
question
225
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
max_sleep_interval:Upper bound of a range for randomized sleep before each download (maximum possible number of seconds to sleep). Must only be used along with sleep_interval. Actual sleep time will be a random float from range ...
The multiline printer already ignored the `--no-color` flag so the default for that flag should be `nocolor`. `--color never` disables sequences completely now.
max_sleep_interval:Upper bound of a range for randomized sleep before each download (maximum possible number of seconds to sleep). Must only be used along with sleep_interval. Actual sleep time will be a random float from range ...
@@ -415,7 +415,13 @@ class YoutubeDL: - Raise utils.DownloadCancelled(msg) to abort remaining downloads when a video is rejected. match_filter_func in utils.py is one example for this. - no_color: Do not emit color codes in output. + ...
yt_dlp/YoutubeDL.py
26
Python
0.571
suggestion
160
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
Grub4K
Grub4K
filter(supports_terminal_sequences, (sys.stderr, sys.stdout)), None) ) try: windows_enable_vt_mode() except Exception as e: self.write_debug(f'Failed to enable VT mode: {e}') color_policy = self.params.get('color') or {} self.params['colo...
This translation should happen in `__init__.py` imo. API can just accept `True/False/None/'nocolor'`
filter(supports_terminal_sequences, (sys.stderr, sys.stdout)), None) ) try: windows_enable_vt_mode() except Exception as e: self.write_debug(f'Failed to enable VT mode: {e}') if self.params.get('no_color'): if self.params.get('color')...
@@ -603,10 +609,31 @@ def __init__(self, params=None, auto_init=True): except Exception as e: self.write_debug(f'Failed to enable VT mode: {e}') - self._allow_colors = Namespace(**{ - type_: not self.params.get('no_color') and supports_terminal_sequences(stream) - fo...
yt_dlp/YoutubeDL.py
26
Python
0.571
suggestion
100
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
color_policy = self.params.get('color') or {} self.params['color'] = { name: ( 'nocolor' if self.params.get('no_color') else color_policy if isinstance(color_policy, str) else color_policy.get(name) or 'auto') for name in ('screen'...
I think there should only be `stderr` and `stdout` options and they should follow `sys.stdout`/`sys.stderr` and not what we internally call the fields. User is setting which of the output channels support color. So this would be like: ```suggestion if self.params.get('no_color'): if self.pa...
if self.params.get('no_color'): if self.params.get('color') is not None: self.report_warning('Overwriting params from "color" with "no_color"') self.params['color'] = 'no_color' term_allow_color = os.environ.get('TERM', '').lower() != 'dumb' def process...
@@ -603,10 +609,31 @@ def __init__(self, params=None, auto_init=True): except Exception as e: self.write_debug(f'Failed to enable VT mode: {e}') - self._allow_colors = Namespace(**{ - type_: not self.params.get('no_color') and supports_terminal_sequences(stream) - fo...
yt_dlp/YoutubeDL.py
26
Python
0.857
suggestion
1,973
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
help='Mark videos watched (even with --simulate)') general.add_option( '--no-mark-watched', action='store_false', dest='mark_watched', help='Do not mark videos watched (default)') general.add_option( '--no-colors', '--no-colours', action='store_const', dest='color...
Should we use `no_color` or `nocolor`?
action='store_true', dest='mark_watched', default=False, help='Mark videos watched (even with --simulate)') general.add_option( '--no-mark-watched', action='store_false', dest='mark_watched', help='Do not mark videos watched (default)') general.add_option( '--no-c...
@@ -440,8 +440,25 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs): help='Do not mark videos watched (default)') general.add_option( '--no-colors', '--no-colours', - action='store_true', dest='no_color', default=False, - help='Do not emit color codes in output (Al...
yt_dlp/options.py
26
Python
0.286
question
38
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
try: requested = orderedSet_from_options(values, collections.ChainMap(aliases, {'all': allowed_values}), start=getattr(parser.values, option.dest)) except ValueError as e: raise optparse.OptionValueError(f'wrong {option.metavar} for...
```suggestion keys, val = variadic(default_key), value ```
values = [process(value)] if delim is None else map(process, value.split(delim)) try: requested = orderedSet_from_options(values, collections.ChainMap(aliases, {'all': allowed_values}), start=getattr(parser.values, option.dest)) except ...
@@ -250,7 +250,7 @@ def _dict_from_options_callback( if multiple_args: val = [val, *value[1:]] elif default_key is not None: - keys, val = [default_key], value + keys, val = default_key if isinstance(default_key, list) else [default_key], value
yt_dlp/options.py
26
Python
0.571
suggestion
72
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
else: exc_info = sys.exc_info() raise DownloadError(message, exc_info) self._download_retcode = 1 Styles = Namespace( HEADERS='yellow', EMPHASIS='light blue', FILENAME='green', ID='green', DELIM='blue', ERROR='red', ...
```suggestion return format_text(text, f) if allow_colors is True else text if fallback is None else fallback ```
HEADERS='yellow', EMPHASIS='light blue', FILENAME='green', ID='green', DELIM='blue', ERROR='red', WARNING='yellow', SUPPRESS='light black', ) def _format_text(self, handle, allow_colors, text, f, fallback=None, *, test_encoding=False): tex...
@@ -975,7 +1002,7 @@ def _format_text(self, handle, allow_colors, text, f, fallback=None, *, test_enc text = text.encode(encoding, 'ignore').decode(encoding) if fallback is not None and text != original_text: text = fallback - return format_text(text, f) if allow_colors...
yt_dlp/YoutubeDL.py
26
Python
0.714
suggestion
123
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
stdout = sys.stderr if self.params.get('logtostderr') else sys.stdout self._out_files = Namespace( out=stdout, error=sys.stderr, screen=sys.stderr if self.params.get('quiet') else stdout, console=None if compat_os_name == 'nt' else next( fi...
I used assert in my suggestion as a way of blocking arbitrary values.
stdout = sys.stderr if self.params.get('logtostderr') else sys.stdout self._out_files = Namespace( out=stdout, error=sys.stderr, screen=sys.stderr if self.params.get('quiet') else stdout, console=None if compat_os_name == 'nt' else next( fi...
@@ -609,31 +609,24 @@ def __init__(self, params=None, auto_init=True): except Exception as e: self.write_debug(f'Failed to enable VT mode: {e}') - color_policy = self.params.get('color') or {} - self.params['color'] = { - name: ( - 'nocolor' if self.params...
yt_dlp/YoutubeDL.py
26
Python
0.286
suggestion
69
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
default_downloader = None for proto, path in opts.external_downloader.items(): if path == 'native': continue ed = get_external_downloader(path) if ed is None: raise ValueError( f'No such {format_field(proto, None, "%s ", ignore="default")}external...
```suggestion for name, policy in opts.color.items(): if policy not in policies: raise ValueError(f'"{policy}" is not a valid color policy') opts.color[name] = policies[policy] ```
default_downloader = None for proto, path in opts.external_downloader.items(): if path == 'native': continue ed = get_external_downloader(path) if ed is None: raise ValueError( f'No such {format_field(proto, None, "%s ", ignore="default")}external...
@@ -435,6 +435,21 @@ def metadataparser_actions(f): elif ed and proto == 'default': default_downloader = ed.get_basename() + if opts.color: + policies = { + 'always': True, + 'auto': None, + 'no_color': 'no_color', + 'never': False, + ...
yt_dlp/__init__.py
26
Python
0.929
suggestion
233
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
self.cache = Cache(self) stdout = sys.stderr if self.params.get('logtostderr') else sys.stdout self._out_files = Namespace( out=stdout, error=sys.stderr, screen=sys.stderr if self.params.get('quiet') else stdout, console=None if compat_os_name == ...
This is fine, but is there a specific reason we support direct strings?
self.cache = Cache(self) stdout = sys.stderr if self.params.get('logtostderr') else sys.stdout self._out_files = Namespace( out=stdout, error=sys.stderr, screen=sys.stderr if self.params.get('quiet') else stdout, console=None if compat_os_name == ...
@@ -609,31 +609,24 @@ def __init__(self, params=None, auto_init=True): except Exception as e: self.write_debug(f'Failed to enable VT mode: {e}') - color_policy = self.params.get('color') or {} - self.params['color'] = { - name: ( - 'nocolor' if self.params...
yt_dlp/YoutubeDL.py
26
Python
0.214
question
71
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
action='store_true', dest='mark_watched', default=False, help='Mark videos watched (even with --simulate)') general.add_option( '--no-mark-watched', action='store_false', dest='mark_watched', help='Do not mark videos watched (default)') general.add_option( '--no-c...
```suggestion 'Whether to emit color codes in output, optionally prefixed by ' 'the STREAM (stdout or stderr) to apply the setting to. ' 'Can be one of "always", "auto" (default), "never", or ' '"no_color" (support terminal sequences except color)')) ```
action='store_true', dest='mark_watched', default=False, help='Mark videos watched (even with --simulate)') general.add_option( '--no-mark-watched', action='store_false', dest='mark_watched', help='Do not mark videos watched (default)') general.add_option( '--no-c...
@@ -440,8 +441,24 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs): help='Do not mark videos watched (default)') general.add_option( '--no-colors', '--no-colours', - action='store_true', dest='no_color', default=False, - help='Do not emit color codes in output (Al...
yt_dlp/options.py
26
Python
0.786
suggestion
307
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
self._num_downloads = 0 self._num_videos = 0 self._playlist_level = 0 self._playlist_urls = set() self.cache = Cache(self) stdout = sys.stderr if self.params.get('logtostderr') else sys.stdout self._out_files = Namespace( out=stdout, error...
Would be useful to indicate this in verbose
self._num_downloads = 0 self._num_videos = 0 self._playlist_level = 0 self._playlist_urls = set() self.cache = Cache(self) stdout = sys.stderr if self.params.get('logtostderr') else sys.stdout self._out_files = Namespace( out=stdout, error...
@@ -603,9 +609,23 @@ def __init__(self, params=None, auto_init=True): except Exception as e: self.write_debug(f'Failed to enable VT mode: {e}') + if self.params.get('no_color'): + if self.params.get('color') is not None: + self.report_warning('Using') + ...
yt_dlp/YoutubeDL.py
26
Python
0.143
suggestion
43
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
self._out_files = Namespace( out=stdout, error=sys.stderr, screen=sys.stderr if self.params.get('quiet') else stdout, console=None if compat_os_name == 'nt' else next( filter(supports_terminal_sequences, (sys.stderr, sys.stdout)), None) ) ...
In retrospect, True/False/None is a bad idea. ```suggestion if policy in ('auto', None): return term_allow_color and supports_terminal_sequences(stream) assert policy in ('always', 'never', 'no_color') return {'always': True, 'never': False}.get(policy, policy) ...
self._out_files = Namespace( out=stdout, error=sys.stderr, screen=sys.stderr if self.params.get('quiet') else stdout, console=None if compat_os_name == 'nt' else next( filter(supports_terminal_sequences, (sys.stderr, sys.stdout)), None) ) ...
@@ -603,9 +609,23 @@ def __init__(self, params=None, auto_init=True): except Exception as e: self.write_debug(f'Failed to enable VT mode: {e}') + if self.params.get('no_color'): + if self.params.get('color') is not None: + self.report_warning('Using') + ...
yt_dlp/YoutubeDL.py
26
Python
0.786
suggestion
323
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
self._playlist_urls = set() self.cache = Cache(self) stdout = sys.stderr if self.params.get('logtostderr') else sys.stdout self._out_files = Namespace( out=stdout, error=sys.stderr, screen=sys.stderr if self.params.get('quiet') else stdout, ...
```suggestion stream_name = {sys.stdout: 'stdout', sys.stderr: 'stderr'}[stream] ``` Anything else means code is broken from our side.
self._playlist_urls = set() self.cache = Cache(self) stdout = sys.stderr if self.params.get('logtostderr') else sys.stdout self._out_files = Namespace( out=stdout, error=sys.stderr, screen=sys.stderr if self.params.get('quiet') else stdout, ...
@@ -603,9 +609,23 @@ def __init__(self, params=None, auto_init=True): except Exception as e: self.write_debug(f'Failed to enable VT mode: {e}') + if self.params.get('no_color'): + if self.params.get('color') is not None: + self.report_warning('Using') + ...
yt_dlp/YoutubeDL.py
26
Python
0.714
bug
149
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
default_downloader = None for proto, path in opts.external_downloader.items(): if path == 'native': continue ed = get_external_downloader(path) if ed is None: raise ValueError( f'No such {format_field(proto, None, "%s ", ignore="default")}external...
```suggestion for name, policy in opts.color.items(): if policy not in ('always', 'auto', 'no_color', 'never'): raise ValueError(f'"{policy}" is not a valid color policy for {name}') ``` https://github.com/yt-dlp/yt-dlp/pull/6904#discussion_r1180397402
default_downloader = None for proto, path in opts.external_downloader.items(): if path == 'native': continue ed = get_external_downloader(path) if ed is None: raise ValueError( f'No such {format_field(proto, None, "%s ", ignore="default")}external...
@@ -435,6 +435,21 @@ def metadataparser_actions(f): elif ed and proto == 'default': default_downloader = ed.get_basename() + if opts.color: + policies = { + 'always': True, + 'auto': None, + 'no_color': 'no_color', + 'never': False, + ...
yt_dlp/__init__.py
26
Python
0.929
suggestion
281
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
out=stdout, error=sys.stderr, screen=sys.stderr if self.params.get('quiet') else stdout, console=None if compat_os_name == 'nt' else next( filter(supports_terminal_sequences, (sys.stderr, sys.stdout)), None) ) try: windows_enab...
Pls add back the assert. We don't want to support arbitrary values. Also, I don't think `{str}` is needed.
out=stdout, error=sys.stderr, screen=sys.stderr if self.params.get('quiet') else stdout, console=None if compat_os_name == 'nt' else next( filter(supports_terminal_sequences, (sys.stderr, sys.stdout)), None) ) try: windows_enab...
@@ -611,22 +611,23 @@ def __init__(self, params=None, auto_init=True): if self.params.get('no_color'): if self.params.get('color') is not None: - self.report_warning('Using') + self.report_warning('Overwriting params from "color" with "no_color"') self....
yt_dlp/YoutubeDL.py
26
Python
0.5
suggestion
106
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
if opts.download_archive is not None: opts.download_archive = expand_path(opts.download_archive) if opts.ffmpeg_location is not None: opts.ffmpeg_location = expand_path(opts.ffmpeg_location) if opts.user_agent is not None: opts.headers.setdefault('User-Agent', opts.user_agent) ...
Not needed since default is `{}`
if opts.download_archive is not None: opts.download_archive = expand_path(opts.download_archive) if opts.ffmpeg_location is not None: opts.ffmpeg_location = expand_path(opts.ffmpeg_location) if opts.user_agent is not None: opts.headers.setdefault('User-Agent', opts.user_agent) ...
@@ -436,19 +436,9 @@ def metadataparser_actions(f): default_downloader = ed.get_basename() if opts.color:
yt_dlp/__init__.py
26
Python
0.214
suggestion
32
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
if opts.ffmpeg_location is not None: opts.ffmpeg_location = expand_path(opts.ffmpeg_location) if opts.user_agent is not None: opts.headers.setdefault('User-Agent', opts.user_agent) if opts.referer is not None: opts.headers.setdefault('Referer', opts.referer) if opts.no_sponsorb...
My suggestion used items so we can write `"{policy}" is not a valid color policy for {name}`. Not a big deal, but idk why you changed it.
if opts.ffmpeg_location is not None: opts.ffmpeg_location = expand_path(opts.ffmpeg_location) if opts.user_agent is not None: opts.headers.setdefault('User-Agent', opts.user_agent) if opts.referer is not None: opts.headers.setdefault('Referer', opts.referer) if opts.no_sponsorb...
@@ -436,19 +436,9 @@ def metadataparser_actions(f): default_downloader = ed.get_basename() if opts.color: - policies = { - 'always': True, - 'auto': None, - 'no_color': 'no_color', - 'never': False, - } - result = {} - for name,...
yt_dlp/__init__.py
26
Python
0.571
suggestion
137
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
action='store_true', dest='mark_watched', default=False, help='Mark videos watched (even with --simulate)') general.add_option( '--no-mark-watched', action='store_false', dest='mark_watched', help='Do not mark videos watched (default)') general.add_option( '--no-c...
I like "non color terminal sequences". It's kinda obvious, but maybe we should explicitly say `This option can be used multiple times to set the different streams`?
action='store_true', dest='mark_watched', default=False, help='Mark videos watched (even with --simulate)') general.add_option( '--no-mark-watched', action='store_false', dest='mark_watched', help='Do not mark videos watched (default)') general.add_option( '--no-c...
@@ -455,10 +455,10 @@ def _alias_callback(option, opt_str, value, parser, opts, nargs): 'default_key': ['stdout', 'stderr'], 'process': str.strip, }, help=( - 'A mapping with output stream names as keys and their respective color policy as values. ' - 'Can also j...
yt_dlp/options.py
26
Python
0.571
question
167
51
51
false
[core] Implement `--color` flag
6,904
yt-dlp/yt-dlp
132,642
Python
pukkandan
Grub4K
# reddit video @ nm reddit 'url': 'https://nm.reddit.com/r/Cricket/comments/8idvby/lousy_cameraman_finds_himself_in_cairns_line_of/', 'only_matching': True, }, { 'url': 'https://www.redditmedia.com/r/serbia/comments/pu9wbx/ako_vu%C4%8Di%C4%87_izgubi_izbore_ja_%C4%87u_da_crknem/', ...
Unnecessary DRY imo ```suggestion errors = ';'.join(traverse_obj(login, ('json', 'errors', ..., 1))) if errors: raise ExtractorError(f'Unable to login, Reddit API says {errors}', expected=True) elif not traverse_obj(login, ('json', 'data', 'cookie', {str})): raise...
# reddit video @ nm reddit 'url': 'https://nm.reddit.com/r/Cricket/comments/8idvby/lousy_cameraman_finds_himself_in_cairns_line_of/', 'only_matching': True, }, { 'url': 'https://www.redditmedia.com/r/serbia/comments/pu9wbx/ako_vu%C4%8Di%C4%87_izgubi_izbore_ja_%C4%87u_da_crknem/', ...
@@ -176,6 +178,25 @@ class RedditIE(InfoExtractor): 'only_matching': True, }] + def _perform_login(self, username, password): + captcha = self._download_json( + 'https://www.reddit.com/api/requires_captcha/login.json', None, + 'Checking login requirement')['required'] + ...
yt_dlp/extractor/reddit.py
26
Python
1
refactor
383
51
51
false
[extractor/reddit] Add login support
6,950
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
headers.update({ 'x-twitter-auth-type': 'OAuth2Session', 'x-twitter-client-language': 'en', 'x-twitter-active-user': 'yes', }) for first_attempt in (True, False): if not self.is_logged_in: if not self._token: ...
```suggestion if first_attempt and not self.is_logged_in and any('bad guest token' in error.lower() for error in errors): ``` correct? Otherwise it may unnecessarily try twice when logged in.
headers.update({ 'x-twitter-auth-type': 'OAuth2Session', 'x-twitter-client-language': 'en', 'x-twitter-active-user': 'yes', }) for first_attempt in (True, False): if not self.is_logged_in and not self._guest_token: ...
@@ -107,54 +105,34 @@ def _call_api(self, path, video_id, query={}, graphql=False): 'x-twitter-active-user': 'yes', }) - last_error = None - for bearer_token in self._TOKENS: - for first_attempt in (True, False): - headers['Authorization'] = f'Bear...
yt_dlp/extractor/twitter.py
26
Python
0.929
suggestion
210
51
51
false
[extractor/twitter] Migrate to GraphQL, handle auth errors
6,957
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
def _call_api(self, path, video_id, query={}, graphql=False): cookies = self._get_cookies(self._API_BASE) headers = self._AUTH.copy() csrf_cookie = cookies.get('ct0') if csrf_cookie: headers['x-csrf-token'] = csrf_cookie.value if self.is_logged_in: ...
```suggestion if not self.is_logged_in and not self._token: headers.pop('x-guest-token', None) self._token = traverse_obj(self._download_json( f'{self._API_BASE}guest/activate.json', video_id, 'Downloading guest token', data=b'', h...
def _call_api(self, path, video_id, query={}, graphql=False): cookies = self._get_cookies(self._API_BASE) headers = self._AUTH.copy() csrf_cookie = cookies.get('ct0') if csrf_cookie: headers['x-csrf-token'] = csrf_cookie.value if self.is_logged_in: ...
@@ -107,54 +105,34 @@ def _call_api(self, path, video_id, query={}, graphql=False): 'x-twitter-active-user': 'yes', }) - last_error = None - for bearer_token in self._TOKENS: - for first_attempt in (True, False): - headers['Authorization'] = f'Bear...
yt_dlp/extractor/twitter.py
26
Python
1
refactor
589
51
51
false
[extractor/twitter] Migrate to GraphQL, handle auth errors
6,957
yt-dlp/yt-dlp
132,642
Python
pukkandan
bashonly
Each of the provided `paths` is tested and the first producing a valid result will be returned. The next path will also be tested if the path branched but no results could be found. Supported values for traversal are `Mapping`, `Sequence` and `re.Match`. Unhelpful values (`{}`, `None`) are treated as th...
As `Iterable` has no `index()`, I chose: ``` For `Iterable`s, `key` is the enumeration count of the value. ```
Safely traverse nested `dict`s and `Iterable`s >>> obj = [{}, {"key": "value"}] >>> traverse_obj(obj, (1, "key")) "value" Each of the provided `paths` is tested and the first producing a valid result will be returned. The next path will also be tested if the path branched but no results could ...
@@ -5492,7 +5498,7 @@ def traverse_obj( Read as: `[traverse_obj(obj, branch) for branch in branches]`. - `function`: Branch out and return values filtered by the function. Read as: `[value for key, value in obj if function(key, value)]`. - ...
yt_dlp/utils.py
26
Python
0.714
suggestion
141
51
51
false
[utils] `traverse_obj`: More fixes
6,959
yt-dlp/yt-dlp
132,642
Python
dirkf
Grub4K
# vod.tvp.pl if info.get('vortalName') == 'vod': info_dict.update({ 'title': '%s, %s' % (info.get('title'), info.get('subtitle')), 'series': info.get('title'), 'season': info.get('season'), 'episode_number': info.get('episode')...
Old code was looking at `video.load.description`. Is this change intentional? Was the old code wrong? Don't tests change accordingly? ```suggestion 'description': traverse_obj(video, 'lead', 'description', expected_type=clean_html), ```
# vod.tvp.pl if info.get('vortalName') == 'vod': info_dict.update({ 'title': '%s, %s' % (info.get('title'), info.get('subtitle')), 'series': info.get('title'), 'season': info.get('season'), 'episode_number': info.get('episode')...
@@ -482,21 +482,32 @@ def _real_extract(self, url): class TVPVODBaseIE(InfoExtractor): _API_BASE_URL = 'https://vod.tvp.pl/api/products' - def _call_api(self, resource, video_id, **kwargs): + def _call_api(self, resource, video_id, query={}, **kwargs): return self._download_json( f'{...
yt_dlp/extractor/tvp.py
26
Python
1
bug
253
51
51
false
[extractor/tvp] switch vod completely to vod api
6,989
yt-dlp/yt-dlp
132,642
Python
pukkandan
selfisekai
return info_dict class TVPVODBaseIE(InfoExtractor): _API_BASE_URL = 'https://vod.tvp.pl/api/products' def _call_api(self, resource, video_id, query={}, **kwargs): return self._download_json( f'{self._API_BASE_URL}/{resource}', video_id, query={'lang': 'pl', 'platform'...
Actually, this whole thing can be simplified with new traverse_obj features. ```suggestion info_dict = traverse_obj(video, { 'id': ('id', {str_or_none}), 'title': 'title', 'age_limit': ('rating', {int_or_none}), 'duration': ('duration', {int_or_none}), ...
return info_dict class TVPVODBaseIE(InfoExtractor): _API_BASE_URL = 'https://vod.tvp.pl/api/products' def _call_api(self, resource, video_id, query={}, **kwargs): is_valid = lambda x: 200 <= x < 300 document, urlh = self._download_json_handle( f'{self._API_BASE_URL}/{reso...
@@ -482,21 +482,32 @@ def _real_extract(self, url): class TVPVODBaseIE(InfoExtractor): _API_BASE_URL = 'https://vod.tvp.pl/api/products' - def _call_api(self, resource, video_id, **kwargs): + def _call_api(self, resource, video_id, query={}, **kwargs): return self._download_json( f'{...
yt_dlp/extractor/tvp.py
26
Python
0.929
suggestion
639
51
51
false
[extractor/tvp] switch vod completely to vod api
6,989
yt-dlp/yt-dlp
132,642
Python
pukkandan
selfisekai
'ext': ext or file.get('type'), 'fps': int_or_none(traverse_obj(file, ('quality', 'fps'))), 'tbr': int_or_none(traverse_obj(file, ('quality', 'bitrate')), scale=1000), 'width': int_or_none(traverse_obj(file, ('quality', 'width'))), ...
```suggestion for sub in content.get('subtitles') or []: ``` unnecessary
'ext': ext or file.get('type'), 'fps': int_or_none(traverse_obj(file, ('quality', 'fps'))), 'tbr': int_or_none(traverse_obj(file, ('quality', 'bitrate')), scale=1000), 'width': int_or_none(traverse_obj(file, ('quality', 'width'))), ...
@@ -447,7 +447,7 @@ def _real_extract(self, url): duration = try_get(info, lambda x: x['duration'], int) if not is_live else None subtitles = {} - for sub in content.get('subtitles') or []: + for sub in content.get('subtitles') or ():
yt_dlp/extractor/tvp.py
26
Python
0.571
suggestion
85
51
51
false
[extractor/tvp] switch vod completely to vod api
6,989
yt-dlp/yt-dlp
132,642
Python
pukkandan
selfisekai
def _real_extract(self, url): video_id = self._match_id(url) info_dict = self._parse_video(self._call_api(f'vods/{video_id}', video_id), with_url=False) playlist = self._call_api(f'{video_id}/videos/playlist', video_id, query={'videoType': 'MOVIE'}) formats = [] for manif...
```suggestion info_dict['formats'] = [] for manifest_url in traverse_obj(playlist, ('sources', 'HLS', ..., 'src')): info_dict['formats'].extend(self._extract_m3u8_formats(manifest_url, video_id, fatal=False)) for manifest_url in traverse_obj(playlist, ('sources', 'DASH', ..., 'sr...
}, 'params': {'skip_download': 'm3u8'}, }] def _real_extract(self, url): video_id = self._match_id(url) info_dict = self._parse_video(self._call_api(f'vods/{video_id}', video_id), with_url=False) playlist = self._call_api(f'{video_id}/videos/playlist', video_id, query=...
@@ -506,37 +517,73 @@ class TVPVODVideoIE(TVPVODBaseIE): _TESTS = [{ 'url': 'https://vod.tvp.pl/dla-dzieci,24/laboratorium-alchemika-odcinki,309338/odcinek-24,S01E24,311357', 'info_dict': { - 'id': '60468609', + 'id': '311357', 'ext': 'mp4', - 'title'...
yt_dlp/extractor/tvp.py
26
Python
0.857
refactor
729
51
51
false
[extractor/tvp] switch vod completely to vod api
6,989
yt-dlp/yt-dlp
132,642
Python
pukkandan
selfisekai
'thumbnails': thumbnails, 'age_limit': age_limit, 'is_live': is_live, 'duration': duration, 'formats': formats, 'subtitles': subtitles, } # vod.tvp.pl if info.get('vortalName') == 'vod': info_dict.update({ ...
```suggestion is_valid = lambda x: 200 <= x < 300 ``` is_handled_error is never used by itself
'thumbnails': thumbnails, 'age_limit': age_limit, 'is_live': is_live, 'duration': duration, 'formats': formats, 'subtitles': subtitles, } # vod.tvp.pl if info.get('vortalName') == 'vod': info_dict.update({ ...
@@ -483,9 +483,16 @@ class TVPVODBaseIE(InfoExtractor): _API_BASE_URL = 'https://vod.tvp.pl/api/products' def _call_api(self, resource, video_id, query={}, **kwargs): - return self._download_json( + is_valid = lambda x: x >= 200 and x < 300 + is_handled_error = lambda x: x >= 400 and x ...
yt_dlp/extractor/tvp.py
26
Python
0.929
suggestion
105
51
51
false
[extractor/tvp] switch vod completely to vod api
6,989
yt-dlp/yt-dlp
132,642
Python
pukkandan
selfisekai
'formats': formats, 'subtitles': subtitles, } # vod.tvp.pl if info.get('vortalName') == 'vod': info_dict.update({ 'title': '%s, %s' % (info.get('title'), info.get('subtitle')), 'series': info.get('title'), 'seas...
```suggestion expected_status=lambda x: is_valid(x) or 400 <= x < 500, **kwargs) ```
'formats': formats, 'subtitles': subtitles, } # vod.tvp.pl if info.get('vortalName') == 'vod': info_dict.update({ 'title': '%s, %s' % (info.get('title'), info.get('subtitle')), 'series': info.get('title'), 'seas...
@@ -483,9 +483,16 @@ class TVPVODBaseIE(InfoExtractor): _API_BASE_URL = 'https://vod.tvp.pl/api/products' def _call_api(self, resource, video_id, query={}, **kwargs): - return self._download_json( + is_valid = lambda x: x >= 200 and x < 300 + is_handled_error = lambda x: x >= 400 and x ...
yt_dlp/extractor/tvp.py
26
Python
0.571
suggestion
98
51
51
false
[extractor/tvp] switch vod completely to vod api
6,989
yt-dlp/yt-dlp
132,642
Python
pukkandan
selfisekai
# vod.tvp.pl if info.get('vortalName') == 'vod': info_dict.update({ 'title': '%s, %s' % (info.get('title'), info.get('subtitle')), 'series': info.get('title'), 'season': info.get('season'), 'episode_number': info.get('episode'),...
```suggestion raise ExtractorError(f'Woronicza said: {document.get("code")}') ```
# vod.tvp.pl if info.get('vortalName') == 'vod': info_dict.update({ 'title': '%s, %s' % (info.get('title'), info.get('subtitle')), 'series': info.get('title'), 'season': info.get('season'), 'episode_number': info.get('episode'),...
@@ -483,9 +483,16 @@ class TVPVODBaseIE(InfoExtractor): _API_BASE_URL = 'https://vod.tvp.pl/api/products' def _call_api(self, resource, video_id, query={}, **kwargs): - return self._download_json( + is_valid = lambda x: x >= 200 and x < 300 + is_handled_error = lambda x: x >= 400 and x ...
yt_dlp/extractor/tvp.py
26
Python
0.786
refactor
91
51
51
false
[extractor/tvp] switch vod completely to vod api
6,989
yt-dlp/yt-dlp
132,642
Python
pukkandan
selfisekai
from datetime import datetime import re from yt_dlp.utils import ExtractorError, determine_ext, extract_attributes, get_element_by_class, unified_strdate from .common import InfoExtractor class NekoHackerIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?nekohacker\.com/(?P<id>[a-zA-Z0-9-_]+)' _ENTRY_URL =...
Use `[\w-]+`, and we can exclude the path we know definitely isn't an album page ```suggestion _VALID_URL = r'https?://(?:www\.)?nekohacker\.com/(?P<id>(?!free-dl)[\w-]+)' ```
import re from .common import InfoExtractor from ..utils import ( ExtractorError, determine_ext, extract_attributes, get_element_by_class, get_element_text_and_html_by_tag, parse_duration, traverse_obj, try_call, url_or_none, ) class NekoHackerIE(InfoExtractor): _VALID_URL = r...
@@ -0,0 +1,125 @@ +from datetime import datetime +import re + +from yt_dlp.utils import ExtractorError, determine_ext, extract_attributes, get_element_by_class, unified_strdate +from .common import InfoExtractor + + +class NekoHackerIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?nekohacker\.com/(?P<id>[a-zA-...
yt_dlp/extractor/nekohacker.py
9
Python
0.786
suggestion
182
34
34
false
[extractor/nekohacker] Add Extractor
7,003
yt-dlp/yt-dlp
132,642
Python
bashonly
hasezoey
from datetime import datetime import re from yt_dlp.utils import ExtractorError, determine_ext, extract_attributes, get_element_by_class, unified_strdate from .common import InfoExtractor class NekoHackerIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?nekohacker\.com/(?P<id>[a-zA-Z0-9-_]+)' _ENTRY_URL =...
```suggestion ``` I think this is the wrong way of going about extracting an entry `id` value for a few reasons: - This is not necessarily going to be unique, e.g. the first test's id is `01-Spaceship`, but what if another release also has a first track named "Spaceship"? - The media URLs won't always match this ...
import re from .common import InfoExtractor from ..utils import ( ExtractorError, determine_ext, extract_attributes, get_element_by_class, get_element_text_and_html_by_tag, parse_duration, traverse_obj, try_call, url_or_none, ) class NekoHackerIE(InfoExtractor): _VALID_URL = r...
@@ -0,0 +1,125 @@ +from datetime import datetime +import re + +from yt_dlp.utils import ExtractorError, determine_ext, extract_attributes, get_element_by_class, unified_strdate +from .common import InfoExtractor + + +class NekoHackerIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?nekohacker\.com/(?P<id>[a-zA-...
yt_dlp/extractor/nekohacker.py
10
Python
0.857
bug
511
35
35
false
[extractor/nekohacker] Add Extractor
7,003
yt-dlp/yt-dlp
132,642
Python
bashonly
hasezoey
}, { 'url': 'https://nekohacker.com/wp-content/uploads/2022/11/04-Crystal-World.mp3', 'md5': 'd8e59a48061764e50d92386a294abd50', 'info_dict': { 'id': '04-Crystal-World', 'ext': 'mp3', 'tit...
For readability, just use a new variable instead of redefining `webpage` since then the name is no longer accurate ```suggestion playlist_id = self._match_id(url) webpage = self._download_webpage(url, playlist_id) playlist = get_element_by_class('playlist', webpage) if playlist is N...
'artist': 'Neko Hacker', 'track': 'City Runner', 'track_number': 2, 'duration': 148.0 } }, { 'url': 'https://nekohacker.com/wp-content/uploads/2022/11/03-Nature-Talk.mp3', ...
@@ -0,0 +1,125 @@ +from datetime import datetime +import re + +from yt_dlp.utils import ExtractorError, determine_ext, extract_attributes, get_element_by_class, unified_strdate +from .common import InfoExtractor + + +class NekoHackerIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?nekohacker\.com/(?P<id>[a-zA-...
yt_dlp/extractor/nekohacker.py
26
Python
1
refactor
444
51
51
false
[extractor/nekohacker] Add Extractor
7,003
yt-dlp/yt-dlp
132,642
Python
bashonly
hasezoey
# full_response = self._request_webpage(trackurl, id, headers={ # 'Accept-Encoding': 'identity', # }) # content_type = full_response.headers.get('Content-Type', '').lower() upload_date = datetime.strptime(attr['data-releasedate'], '%Y.%m.%d Release') ...
This can be simplified and made safer with `traverse_obj` - `upload_date = datetime.strptime(attr['data-releasedate'], '%Y.%m.%d Release')` -- this is fatal and should not be, and it throws on other albums (again see https://nekohacker.com/susume/) - I think `release_date` is more accurate here than `upload_date`...
'url': 'https://nekohacker.com/susume/', 'info_dict': { 'id': 'susume', 'title': '進め!むじなカンパニー', }, 'playlist': [ { 'url': 'https://nekohacker.com/wp-content/uploads/2021/01/進め!むじなカンパニー-feat.-六科なじむ-CV_-日高里菜-割戶真友-CV_-金元寿子-軽井沢ユキ-CV_-上坂すみれ-...
@@ -0,0 +1,125 @@ +from datetime import datetime +import re + +from yt_dlp.utils import ExtractorError, determine_ext, extract_attributes, get_element_by_class, unified_strdate +from .common import InfoExtractor + + +class NekoHackerIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?nekohacker\.com/(?P<id>[a-zA-...
yt_dlp/extractor/nekohacker.py
26
Python
0.857
refactor
2,567
27
51
false
[extractor/nekohacker] Add Extractor
7,003
yt-dlp/yt-dlp
132,642
Python
bashonly
hasezoey
import re from yt_dlp.utils import ExtractorError, determine_ext, extract_attributes, get_element_by_class, parse_duration, traverse_obj, url_or_none from .common import InfoExtractor class NekoHackerIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?nekohacker\.com/(?P<id>(?!free-dl)[\w-]+)' _TESTS = [{ ...
relative imports ```suggestion from .common import InfoExtractor from ..utils import ( ExtractorError, determine_ext, extract_attributes, get_element_by_class, parse_duration, traverse_obj, url_or_none, ) ```
import re from .common import InfoExtractor from ..utils import ( ExtractorError, determine_ext, extract_attributes, get_element_by_class, get_element_text_and_html_by_tag, parse_duration, traverse_obj, try_call, url_or_none, ) class NekoHackerIE(InfoExtractor): _VALID_URL = r...
@@ -0,0 +1,199 @@ +import re + +from yt_dlp.utils import ExtractorError, determine_ext, extract_attributes, get_element_by_class, parse_duration, traverse_obj, url_or_none +from .common import InfoExtractor
yt_dlp/extractor/nekohacker.py
4
Python
1
refactor
248
29
29
false
[extractor/nekohacker] Add Extractor
7,003
yt-dlp/yt-dlp
132,642
Python
bashonly
hasezoey
'thumbnail': 'https://nekohacker.com/wp-content/uploads/2022/11/Nekoverse_Artwork-1024x1024.jpg', 'vcodec': 'none', 'acodec': 'mp3', 'release_date': '20221101', 'album': 'Nekoverse', 'artist': 'Nekoha...
use md5 for long titles/descriptions/track titles
'duration': 174.0 } }, { 'url': 'https://nekohacker.com/wp-content/uploads/2022/11/04-Crystal-World.mp3', 'md5': 'd8e59a48061764e50d92386a294abd50', 'info_dict': { 'id': '1715', ...
@@ -0,0 +1,199 @@ +import re + +from yt_dlp.utils import ExtractorError, determine_ext, extract_attributes, get_element_by_class, parse_duration, traverse_obj, url_or_none +from .common import InfoExtractor + + +class NekoHackerIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?nekohacker\.com/(?P<id>(?!free-dl)...
yt_dlp/extractor/nekohacker.py
26
Python
0.143
suggestion
49
51
51
false
[extractor/nekohacker] Add Extractor
7,003
yt-dlp/yt-dlp
132,642
Python
bashonly
hasezoey
] }] def _real_extract(self, url): playlist_id = self._match_id(url) webpage = self._download_webpage(url, playlist_id) playlist = get_element_by_class('playlist', webpage) # handle cases which match _VALID_URL, but no element is found if playlist is None: ...
- `utils.try_call` makes it easy when you're setting a var and need a simple try/except - I think we don't want to expect the first ExtractorError in my suggestion, since if neither a playlist or iframe is found in the page, that means the website's overall format could have changed and we'd want that to be report...
} ] }] def _real_extract(self, url): playlist_id = self._match_id(url) webpage = self._download_webpage(url, playlist_id) playlist = get_element_by_class('playlist', webpage) if not playlist: iframe = try_call(lambda: get_element_text_and_html_b...
@@ -0,0 +1,223 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + extract_attributes, + get_element_by_class, + get_element_text_and_html_by_tag, + parse_duration, + traverse_obj, + url_or_none, +) + + +class NekoHackerIE(InfoExtractor)...
yt_dlp/extractor/nekohacker.py
26
Python
1
refactor
1,100
48
42
false
[extractor/nekohacker] Add Extractor
7,003
yt-dlp/yt-dlp
132,642
Python
bashonly
hasezoey
# handle iframes instead of playlist if iframe is not None: attr = extract_attributes(iframe[1]) iframesrc = attr['src'] # handle spotify explicitly if iframesrc is not None and re.match(r'https?://(?:www\.|open\.)?spotify\.com', if...
is the artist name actually "Neko Hacker"? just fixing my own previous suggestion ```suggestion entry['artist'] = 'Neko Hacker' ```
raise ExtractorError('Spotify embeds are not supported', expected=True) return self.url_result(url, 'Generic') entries = [] for track_number, track in enumerate(re.findall(r'(<li[^>]+data-audiopath[^>]+>)', playlist), 1): entry = traverse_obj(extract_attributes(t...
@@ -0,0 +1,223 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + extract_attributes, + get_element_by_class, + get_element_text_and_html_by_tag, + parse_duration, + traverse_obj, + url_or_none, +) + + +class NekoHackerIE(InfoExtractor)...
yt_dlp/extractor/nekohacker.py
26
Python
0.714
suggestion
146
32
26
false
[extractor/nekohacker] Add Extractor
7,003
yt-dlp/yt-dlp
132,642
Python
bashonly
hasezoey
iframe = try_call(lambda: get_element_text_and_html_by_tag('iframe', webpage)[1]) or '' iframe_src = url_or_none(extract_attributes(iframe).get('src')) if not iframe_src: raise ExtractorError('No playlist or embed found in webpage') elif re.match(r'https?:...
I'd do: ```py entries.append({ **entry, 'track_number': track_number, ... }) ``` but not a biggie
iframe = try_call(lambda: get_element_text_and_html_by_tag('iframe', webpage)[1]) or '' iframe_src = url_or_none(extract_attributes(iframe).get('src')) if not iframe_src: raise ExtractorError('No playlist or embed found in webpage') elif re.match(r'https?:...
@@ -0,0 +1,215 @@ +import re + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, + determine_ext, + extract_attributes, + get_element_by_class, + get_element_text_and_html_by_tag, + parse_duration, + traverse_obj, + try_call, + url_or_none, +) + + +class NekoHackerIE...
yt_dlp/extractor/nekohacker.py
26
Python
0.714
suggestion
177
29
31
false
[extractor/nekohacker] Add Extractor
7,003
yt-dlp/yt-dlp
132,642
Python
pukkandan
hasezoey
webpage, 'uploader', fatal=False) formats_str = self._html_search_regex( r'class="jp-jplayer[^"]*" data-source="([^"]+)">', webpage, 'audio URLs') formats = [ { 'format_id': fm[0], 'url': fm[1], 'vcodec': 'n...
Not a big deal, but ```suggestion class RadioFranceBaseIE(InfoExtractor): ``` or ```suggestion class RadioFranceBaseInfoExtractor(InfoExtractor): ``` is convention
uploader = self._html_search_regex( r'<div class="credit">&nbsp;&nbsp;&copy;&nbsp;(.*?)</div>', webpage, 'uploader', fatal=False) formats_str = self._html_search_regex( r'class="jp-jplayer[^"]*" data-source="([^"]+)">', webpage, 'audio URLs') form...
@@ -56,8 +65,26 @@ def _real_extract(self, url): } -class FranceCultureIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?radiofrance\.fr/(?:franceculture|fip|francemusique|mouv|franceinter)/podcasts/(?:[^?#]+/)?(?P<display_id>[^?#]+)-(?P<id>\d+)($|[?#])' +class RadioFranceBase(InfoExtractor):
yt_dlp/extractor/radiofrance.py
26
Python
0.786
refactor
171
51
51
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
'id': video_id, 'title': title, 'formats': formats, 'description': description, 'uploader': uploader, } class RadioFranceBase(InfoExtractor): _VALID_URL_BASE = r'https?://(?:www\.)?radiofrance\.fr' _STATIONS = ( 'franceculture', ...
```suggestion /podcasts/(?:[^?#]+/)?(?P<display_id>[^?#]+)-(?P<id>\d{{6,}})(?:$|[?#]) ```
return { 'id': video_id, 'title': title, 'formats': formats, 'description': description, 'uploader': uploader, } class RadioFranceBaseIE(InfoExtractor): _VALID_URL_BASE = r'https?://(?:www\.)?radiofrance\.fr' _STATIONS_RE = '|'.join...
@@ -56,8 +65,26 @@ def _real_extract(self, url): } -class FranceCultureIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?radiofrance\.fr/(?:franceculture|fip|francemusique|mouv|franceinter)/podcasts/(?:[^?#]+/)?(?P<display_id>[^?#]+)-(?P<id>\d+)($|[?#])' +class RadioFranceBase(InfoExtractor): + ...
yt_dlp/extractor/radiofrance.py
26
Python
0.714
suggestion
99
51
51
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
'quality': i, } for i, fm in enumerate(re.findall(r"([a-z0-9]+)\s*:\s*'([^']+)'", formats_str)) ] return { 'id': video_id, 'title': title, 'formats': formats, 'description': description, 'upl...
This is always used as regex, so this would be better imo: ```suggestion _STATIONS_RE = '|'.join(map(re.escape, ( 'franceculture', 'franceinfo', 'franceinter', 'francemusique', 'fip', 'mouv', ))) ```
'url': fm[1], 'vcodec': 'none', 'quality': i, } for i, fm in enumerate(re.findall(r"([a-z0-9]+)\s*:\s*'([^']+)'", formats_str)) ] return { 'id': video_id, 'title': title, 'formats': f...
@@ -56,8 +65,26 @@ def _real_extract(self, url): } -class FranceCultureIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?radiofrance\.fr/(?:franceculture|fip|francemusique|mouv|franceinter)/podcasts/(?:[^?#]+/)?(?P<display_id>[^?#]+)-(?P<id>\d+)($|[?#])' +class RadioFranceBase(InfoExtractor): + ...
yt_dlp/extractor/radiofrance.py
26
Python
0.857
security
265
51
51
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
'live': True, 'ext': 'aac', }, 'params': { 'skip_download': 'Livestream', }, }, { 'url': 'https://www.radiofrance.fr/mouv', 'only_matching': True, }] def _real_extract(self, url): station_id, substation_id = self._match_val...
```suggestion for media_source in traverse_obj( api_response, (('now', None), 'media', 'sources'), get_all=False): ```
'params': { 'skip_download': 'Livestream', }, }, { 'url': 'https://www.radiofrance.fr/fip/radio-rock', 'info_dict': { 'id': 'fip-radio-rock', 'title': str, 'live_status': 'is_live', 'ext': 'aac', }, 'params':...
@@ -102,3 +144,327 @@ def _real_extract(self, url): 'upload_date': unified_strdate(self._search_regex( r'"datePublished"\s*:\s*"([^"]+)', webpage, 'timestamp', fatal=False)) } + + +class RadioFranceLiveIE(RadioFranceBase): + _VALID_URL = rf'''(?x) + https?://(?:www\.)?ra...
yt_dlp/extractor/radiofrance.py
26
Python
0.714
suggestion
145
51
51
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
station_id, substation_id = self._match_valid_url(url).group('id', 'substation_id') if substation_id: webpage = self._download_webpage(url, station_id) api_response = self._parse_json(self._search_json( r'<script[^>]+type\s*=\s*"application/json"[^>]+/webradios/...
```suggestion 'id': join_nonempty(station_id, substation_id), ```
'skip_download': 'Livestream', }, }, { 'url': 'https://www.radiofrance.fr/mouv', 'only_matching': True, }] def _real_extract(self, url): station_id, substation_id = self._match_valid_url(url).group('id', 'substation_id') if substation_id: web...
@@ -102,3 +144,327 @@ def _real_extract(self, url): 'upload_date': unified_strdate(self._search_regex( r'"datePublished"\s*:\s*"([^"]+)', webpage, 'timestamp', fatal=False)) } + + +class RadioFranceLiveIE(RadioFranceBase): + _VALID_URL = rf'''(?x) + https?://(?:www\.)?ra...
yt_dlp/extractor/radiofrance.py
26
Python
0.571
suggestion
79
51
51
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
webpage = self._download_webpage(url, station_id) api_response = self._parse_json(self._search_json( r'<script[^>]+type\s*=\s*"application/json"[^>]+/webradios/[^>]+>', webpage, 'substation_data', station_id)['body'], station_id) else: api_res...
```suggestion 'title': traverse_obj(api_response, ('visual', 'legend')) or join_nonempty( ('now', 'firstLine', 'title'), ('now', 'secondLine', 'title'), from_dict=api_response, delim=' - '), ```
'url': 'https://www.radiofrance.fr/mouv', 'only_matching': True, }] def _real_extract(self, url): station_id, substation_id = self._match_valid_url(url).group('id', 'substation_id') if substation_id: webpage = self._download_webpage(url, station_id) api_...
@@ -102,3 +144,327 @@ def _real_extract(self, url): 'upload_date': unified_strdate(self._search_regex( r'"datePublished"\s*:\s*"([^"]+)', webpage, 'timestamp', fatal=False)) } + + +class RadioFranceLiveIE(RadioFranceBase): + _VALID_URL = rf'''(?x) + https?://(?:www\.)?ra...
yt_dlp/extractor/radiofrance.py
26
Python
0.786
suggestion
242
51
51
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
'only_matching': True, }] _METADATA_KEY = 'documents' def _generate_playlist_entries(self, profile_id, profile_response): for page_num in itertools.count(2): for entry in profile_response['items']: yield self.url_result( f'https://www.radiofr...
This is the only part that is different. You could do something like this and move rest to base class: ```py def _call_api(self, profile_id, cursor, page_num): resp = self._download_json(...) resp['next'] = traverse_obj(resp, ('pagination', 'next')) return resp ```
'display_id': 'thomas-pesquet', 'title': 'Thomas Pesquet', 'description': 'Astronaute à l\'agence spatiale européenne', }, 'playlist_mincount': 212, }, { 'url': 'https://www.radiofrance.fr/personnes/eugenie-bastie', 'info_dict': { 'id':...
@@ -102,3 +144,327 @@ def _real_extract(self, url): 'upload_date': unified_strdate(self._search_regex( r'"datePublished"\s*:\s*"([^"]+)', webpage, 'timestamp', fatal=False)) } + + +class RadioFranceLiveIE(RadioFranceBase): + _VALID_URL = rf'''(?x) + https?://(?:www\.)?ra...
yt_dlp/extractor/radiofrance.py
26
Python
0.857
suggestion
299
51
51
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
}, { 'url': 'https://www.radiofrance.fr/franceculture/grille-programmes', 'only_matching': True, }] def _real_extract(self, url): station, date = self._match_valid_url(url).group('station', 'date') api_response = self._download_json( f'https://www.radiofrance.fr...
Not mandatory, but u could move this to a generator instead of init-append loop
'url': 'https://www.radiofrance.fr/francemusique/grille-programmes?date=18-03-2023', 'info_dict': { 'id': 'francemusique-program-20230318', 'upload_date': '20230318', }, 'playlist_count': 15, }, { 'url': 'https://www.radiofrance.fr/franceculture/grille...
@@ -102,3 +144,327 @@ def _real_extract(self, url): 'upload_date': unified_strdate(self._search_regex( r'"datePublished"\s*:\s*"([^"]+)', webpage, 'timestamp', fatal=False)) } + + +class RadioFranceLiveIE(RadioFranceBase): + _VALID_URL = rf'''(?x) + https?://(?:www\.)?ra...
yt_dlp/extractor/radiofrance.py
26
Python
0.286
refactor
79
30
33
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
pukkandan
elyse0
'live_status': 'is_live', 'ext': 'aac', }, 'params': { 'skip_download': 'Livestream', }, }, { 'url': 'https://www.radiofrance.fr/mouv', 'only_matching': True, }] def _real_extract(self, url): station_id, substation_id = sel...
is `get_all=False` needed here? seems like it's unnecessarily making this potentially fatal
'params': { 'skip_download': 'Livestream', }, }, { 'url': 'https://www.radiofrance.fr/fip/radio-rock', 'info_dict': { 'id': 'fip-radio-rock', 'title': str, 'live_status': 'is_live', 'ext': 'aac', }, 'params':...
@@ -102,3 +144,330 @@ def _real_extract(self, url): 'upload_date': unified_strdate(self._search_regex( r'"datePublished"\s*:\s*"([^"]+)', webpage, 'timestamp', fatal=False)) } + + +class RadioFranceLiveIE(RadioFranceBaseIE): + _VALID_URL = rf'''(?x) + https?://(?:www\.)?...
yt_dlp/extractor/radiofrance.py
26
Python
0.357
suggestion
91
51
51
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
bashonly
elyse0
'info_dict': { 'id': 'fip-radio-rock', 'title': str, 'live_status': 'is_live', 'ext': 'aac', }, 'params': { 'skip_download': 'Livestream', }, }, { 'url': 'https://www.radiofrance.fr/mouv', 'only_matching': Tr...
seems the site has changed somewhat significantly. this is needed: ```suggestion if substation_id: webpage = self._download_webpage(url, station_id) api_response = traverse_obj(self._search_json( r'\bconst\s+data\s*=', webpage, 'substation data', station_id, ...
'live_status': 'is_live', 'ext': 'aac', }, 'params': { 'skip_download': 'Livestream', }, }, { 'url': 'https://www.radiofrance.fr/fip/radio-rock', 'info_dict': { 'id': 'fip-radio-rock', 'title': str, 'live...
@@ -102,3 +144,330 @@ def _real_extract(self, url): 'upload_date': unified_strdate(self._search_regex( r'"datePublished"\s*:\s*"([^"]+)', webpage, 'timestamp', fatal=False)) } + + +class RadioFranceLiveIE(RadioFranceBaseIE): + _VALID_URL = rf'''(?x) + https?://(?:www\.)?...
yt_dlp/extractor/radiofrance.py
26
Python
0.857
suggestion
622
51
51
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
bashonly
elyse0
}, { 'url': 'https://www.radiofrance.fr/franceculture/grille-programmes', 'only_matching': True, }] def _generate_playlist_entries(self, webpage_url, api_response): for entry in api_response['steps']: path = traverse_obj(entry, ('expression', 'path')) if path...
this API endpoint no longer exists / returns 404 error the site seems to be making requests to `https://www.radiofrance.fr/{station}/grille-programmes/__data.json?date={date}&x-sveltekit-invalidated=0001`, but the returned JSON is nearly incomprehensible
'info_dict': { 'id': 'francemusique-program-20230318', 'upload_date': '20230318', }, 'playlist_count': 15, }, { 'url': 'https://www.radiofrance.fr/franceculture/grille-programmes', 'only_matching': True, }] def _generate_playlist_entries(self,...
@@ -102,3 +144,330 @@ def _real_extract(self, url): 'upload_date': unified_strdate(self._search_regex( r'"datePublished"\s*:\s*"([^"]+)', webpage, 'timestamp', fatal=False)) } + + +class RadioFranceLiveIE(RadioFranceBaseIE): + _VALID_URL = rf'''(?x) + https?://(?:www\.)?...
yt_dlp/extractor/radiofrance.py
26
Python
0.714
suggestion
257
32
32
false
[radiofrance] Add live stations, podcast, profile and program schedule extractors
7,006
yt-dlp/yt-dlp
132,642
Python
bashonly
elyse0
}, { 'url': 'https://www.qub.ca/tele/video/lcn-ca-vous-regarde-rev-30s-ap369664-1009357943', 'only_matching': True, }] @staticmethod def _parse_rating(rating): age = str_to_int(rating) if age is not None: return age return { # CBSC ...
```suggestion entity = self._search_nextjs_data(webpage, entity_id)['props']['initialProps']['pageProps']['fallbackData'] ```
import functools import re from .common import InfoExtractor from ..utils import float_or_none, int_or_none, smuggle_url, strip_or_none from ..utils.traversal import traverse_obj class TVAIE(InfoExtractor): _VALID_URL = r'https?://videos?\.tva\.ca/details/_(?P<id>\d+)' _TESTS = [{ 'url': 'https://vid...
@@ -49,37 +56,67 @@ class QubIE(InfoExtractor): 'info_dict': { 'id': '6084352463001', 'ext': 'mp4', - 'title': 'Épisode 01', + 'title': 'Ép 01. Mon dernier jour', 'uploader_id': '5481942443001', 'upload_date': '20190907', 't...
yt_dlp/extractor/tva.py
26
Python
0.714
suggestion
135
45
96
false
[ie/Qub] Fix extractor
7,019
yt-dlp/yt-dlp
132,642
Python
bashonly
alexhuot1
age = str_to_int(rating) if age is not None: return age return { # CBSC 'Exempt': None, 'C': 0, 'C8': 8, 'G': 0, 'PG': 10, # Régie du cinéma 'G-Dec': 8, # "déconseillé" }.get(rati...
```suggestion 'title': episode, ```
import functools import re from .common import InfoExtractor from ..utils import float_or_none, int_or_none, smuggle_url, strip_or_none from ..utils.traversal import traverse_obj class TVAIE(InfoExtractor): _VALID_URL = r'https?://videos?\.tva\.ca/details/_(?P<id>\d+)' _TESTS = [{ 'url': 'https://vid...
@@ -49,37 +56,67 @@ class QubIE(InfoExtractor): 'info_dict': { 'id': '6084352463001', 'ext': 'mp4', - 'title': 'Épisode 01', + 'title': 'Ép 01. Mon dernier jour', 'uploader_id': '5481942443001', 'upload_date': '20190907', 't...
yt_dlp/extractor/tva.py
26
Python
0.429
suggestion
49
38
96
false
[ie/Qub] Fix extractor
7,019
yt-dlp/yt-dlp
132,642
Python
bashonly
alexhuot1
'PG': 10, # Régie du cinéma 'G-Dec': 8, # "déconseillé" }.get(rating) def _real_extract(self, url): entity_id = self._match_id(url) webpage = self._download_webpage(url, entity_id) next_data = get_element_by_id('__NEXT_DATA__', webpage) or '{}' ...
We can make this much easier to read with traversal ```suggestion **traverse_obj(entity, { 'channel': ('knownEntities', 'channel', 'name', {str}), 'series': ('knownEntities', 'videoShow', 'name', {str}), 'season_number': ('slug', {lambda x: re.search(r'/s...
import functools import re from .common import InfoExtractor from ..utils import float_or_none, int_or_none, smuggle_url, strip_or_none from ..utils.traversal import traverse_obj class TVAIE(InfoExtractor): _VALID_URL = r'https?://videos?\.tva\.ca/details/_(?P<id>\d+)' _TESTS = [{ 'url': 'https://vid...
@@ -49,37 +56,67 @@ class QubIE(InfoExtractor): 'info_dict': { 'id': '6084352463001', 'ext': 'mp4', - 'title': 'Épisode 01', + 'title': 'Ép 01. Mon dernier jour', 'uploader_id': '5481942443001', 'upload_date': '20190907', 't...
yt_dlp/extractor/tva.py
26
Python
0.857
suggestion
1,206
29
96
false
[ie/Qub] Fix extractor
7,019
yt-dlp/yt-dlp
132,642
Python
bashonly
alexhuot1
def json2srt(self, json): data = '\n\n'.join( f'{i + 1}\n{srt_subtitles_timecode(line["from"])} --> {srt_subtitles_timecode(line["to"])}\n{line["content"]}' for i, line in enumerate(traverse_obj(json, ( 'body', lambda _, l: l['content'] and l['from'] and l['to'])))) ...
Specifying the encoding like this is not necessary for `_download_webpage`. ```suggestion ``` If it's not specified/specifying `utf-8`, the BOM will be part of the returned string. While with `utg-8-sig` the BOM will be removed. Having the BOM removed from the string would cause the file to be written without a BOM....
'id': '229832', 'ext': 'mp4', 'title': '1 - 课程先导片', 'alt_title': '视频课 · 3分41秒', 'uploader': '马督工', 'uploader_id': '316568752', 'episode': '课程先导片', 'episode_id': '229832', 'epis...
@@ -938,20 +940,44 @@ def _get_subtitles(self, *, ep_id=None, aid=None): 'episode_id': ep_id, 'aid': aid, })) or {} - subtitles = {} - for sub in sub_json.get('subtitles') or []: - sub_url = sub.get('url') - if not sub_url: - ...
yt_dlp/extractor/bilibili.py
26
Python
0.857
suggestion
412
51
51
false
[extractor/biliIntl] Fix subtitle extraction and add more subtitles
7,077
yt-dlp/yt-dlp
132,642
Python
seproDev
HobbyistDev
data = '\n\n'.join( f'{i + 1}\n{srt_subtitles_timecode(line["from"])} --> {srt_subtitles_timecode(line["to"])}\n{line["content"]}' for i, line in enumerate(traverse_obj(json, ( 'body', lambda _, l: l['content'] and l['from'] and l['to'])))) return data def _g...
Missing a space here ```suggestion note=f'Downloading subtitles{format_field(sub, "lang", " for %s")} ({sub_lang})', ```
'ext': 'mp4', 'title': '1 - 课程先导片', 'alt_title': '视频课 · 3分41秒', 'uploader': '马督工', 'uploader_id': '316568752', 'episode': '课程先导片', 'episode_id': '229832', 'episode_number': 1, ...
@@ -938,20 +940,44 @@ def _get_subtitles(self, *, ep_id=None, aid=None): 'episode_id': ep_id, 'aid': aid, })) or {} - subtitles = {} - for sub in sub_json.get('subtitles') or []: - sub_url = sub.get('url') - if not sub_url: - ...
yt_dlp/extractor/bilibili.py
26
Python
0.714
suggestion
139
51
51
false
[extractor/biliIntl] Fix subtitle extraction and add more subtitles
7,077
yt-dlp/yt-dlp
132,642
Python
seproDev
HobbyistDev
sub_data = self._download_webpage( sub['url'], ep_id or aid, fatal=False, encoding='utf-8-sig' if sub_ext == 'ass' else None, note=f'Downloading subtitles{format_field(sub, "lang", "for %s")} ({sub_lang})', errnote='Unable to download subtitles...
```suggestion note=f'Downloading subtitles{format_field(sub, "lang", " for %s")} ({sub_lang})', ```
}, 'playlist_mincount': 5, 'skip': 'paid video in list', }] def _get_cheese_entries(self, season_info): for ep_id in traverse_obj(season_info, ('episodes', lambda _, v: v['episode_can_view'], 'id')): yield self._extract_episode(season_info, ep_id) def _real_extr...
@@ -938,20 +940,44 @@ def _get_subtitles(self, *, ep_id=None, aid=None): 'episode_id': ep_id, 'aid': aid, })) or {} - subtitles = {} - for sub in sub_json.get('subtitles') or []: - sub_url = sub.get('url') - if not sub_url: - ...
yt_dlp/extractor/bilibili.py
26
Python
0.714
suggestion
121
51
51
false
[extractor/biliIntl] Fix subtitle extraction and add more subtitles
7,077
yt-dlp/yt-dlp
132,642
Python
seproDev
HobbyistDev
from re import finditer from urllib.parse import urljoin from .common import InfoExtractor from ..utils import join_nonempty, unified_timestamp class CamFMBaseIE(InfoExtractor): def _absolute_url(self, path, root='https://camfm.co.uk'): return urljoin(root, path) class CamFMShowIE(CamFMBaseIE): _VA...
It's pointless to make a class for this. Just hardcode the urljoin
import re from .common import InfoExtractor from ..utils import ( clean_html, get_element_by_class, get_elements_by_class, join_nonempty, traverse_obj, unified_timestamp, urljoin, ) class CamFMShowIE(InfoExtractor): _VALID_URL = r'https://(?:www\.)?camfm\.co\.uk/shows/(?P<id>[^/]+)' ...
@@ -0,0 +1,87 @@ +from re import finditer +from urllib.parse import urljoin + +from .common import InfoExtractor +from ..utils import join_nonempty, unified_timestamp + + +class CamFMBaseIE(InfoExtractor): + def _absolute_url(self, path, root='https://camfm.co.uk'): + return urljoin(root, path)
yt_dlp/extractor/camfm.py
10
Python
0.214
suggestion
66
35
35
false
Add Cam FM catch up extractors
7,083
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
from re import finditer from urllib.parse import urljoin from .common import InfoExtractor from ..utils import join_nonempty, unified_timestamp class CamFMBaseIE(InfoExtractor): def _absolute_url(self, path, root='https://camfm.co.uk'): return urljoin(root, path) class CamFMShowIE(CamFMBaseIE): _VA...
```suggestion import re import urllib.parse ``` We use from imports only for internal modules for clarity
import re from .common import InfoExtractor from ..utils import ( clean_html, get_element_by_class, get_elements_by_class, join_nonempty, traverse_obj, unified_timestamp, urljoin, ) class CamFMShowIE(InfoExtractor): _VALID_URL = r'https://(?:www\.)?camfm\.co\.uk/shows/(?P<id>[^/]+)' ...
@@ -0,0 +1,87 @@ +from re import finditer +from urllib.parse import urljoin
yt_dlp/extractor/camfm.py
2
Python
0.786
suggestion
111
27
27
false
Add Cam FM catch up extractors
7,083
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
_VALID_URL = r'https://(?:www\.)?camfm\.co\.uk/shows/(?P<id>[^/]+)/?' _TESTS = [{ 'playlist_mincount': 0, 'url': 'https://camfm.co.uk/shows/soul-mining/', 'info_dict': { 'id': 'soul-mining', 'thumbnail': 'md5:6a873091f92c936f23bdcce80f75e66a', 'title':...
`.*` is a bad idea. Can you refine it?
class CamFMShowIE(InfoExtractor): _VALID_URL = r'https://(?:www\.)?camfm\.co\.uk/shows/(?P<id>[^/]+)' _TESTS = [{ 'playlist_mincount': 5, 'url': 'https://camfm.co.uk/shows/soul-mining/', 'info_dict': { 'id': 'soul-mining', 'thumbnail': 'md5:6a873091f92c936f23bdcc...
@@ -0,0 +1,87 @@ +from re import finditer +from urllib.parse import urljoin + +from .common import InfoExtractor +from ..utils import join_nonempty, unified_timestamp + + +class CamFMBaseIE(InfoExtractor): + def _absolute_url(self, path, root='https://camfm.co.uk'): + return urljoin(root, path) + + +class Cam...
yt_dlp/extractor/camfm.py
26
Python
0.214
question
38
51
51
false
Add Cam FM catch up extractors
7,083
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
from ..utils import join_nonempty, unified_timestamp class CamFMBaseIE(InfoExtractor): def _absolute_url(self, path, root='https://camfm.co.uk'): return urljoin(root, path) class CamFMShowIE(CamFMBaseIE): _VALID_URL = r'https://(?:www\.)?camfm\.co\.uk/shows/(?P<id>[^/]+)/?' _TESTS = [{ '...
Unnecessary intermediate list. Construct the url_result directly with `re.findall`.
clean_html, get_element_by_class, get_elements_by_class, join_nonempty, traverse_obj, unified_timestamp, urljoin, ) class CamFMShowIE(InfoExtractor): _VALID_URL = r'https://(?:www\.)?camfm\.co\.uk/shows/(?P<id>[^/]+)' _TESTS = [{ 'playlist_mincount': 5, 'url': 'http...
@@ -0,0 +1,87 @@ +from re import finditer +from urllib.parse import urljoin + +from .common import InfoExtractor +from ..utils import join_nonempty, unified_timestamp + + +class CamFMBaseIE(InfoExtractor): + def _absolute_url(self, path, root='https://camfm.co.uk'): + return urljoin(root, path) + + +class Cam...
yt_dlp/extractor/camfm.py
26
Python
0.357
suggestion
83
51
51
false
Add Cam FM catch up extractors
7,083
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
class CamFMEpisodeIE(CamFMBaseIE): _VALID_URL = r'https://(?:www\.)?camfm\.co\.uk/player/(?P<id>[^/]+)/?' _TESTS = [{ 'url': 'https://camfm.co.uk/player/43336', 'skip': 'Episode will expire - don\'t actually know when, but it will go eventually', 'info_dict': { 'id': '43336'...
```suggestion formats = traverse_obj(audios, (..., 'formats', ...)) ``` Can be inlined in return too. PS: The `...` are literal. See docstring of traverse_obj for details.
class CamFMEpisodeIE(InfoExtractor): _VALID_URL = r'https://(?:www\.)?camfm\.co\.uk/player/(?P<id>[^/]+)' _TESTS = [{ 'url': 'https://camfm.co.uk/player/43336', 'skip': 'Episode will expire - don\'t actually know when, but it will go eventually', 'info_dict': { 'id': '43336'...
@@ -0,0 +1,87 @@ +from re import finditer +from urllib.parse import urljoin + +from .common import InfoExtractor +from ..utils import join_nonempty, unified_timestamp + + +class CamFMBaseIE(InfoExtractor): + def _absolute_url(self, path, root='https://camfm.co.uk'): + return urljoin(root, path) + + +class Cam...
yt_dlp/extractor/camfm.py
26
Python
0.714
suggestion
185
46
44
false
Add Cam FM catch up extractors
7,083
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
'timestamp': 1684263600, 'series': 'AITAA: Am I the Agony Aunt?', 'thumbnail': 'md5:5980a831360d0744c3764551be3d09c1', 'categories': ['Entertainment'], } }] def _real_extract(self, url): episode_id = self._match_id(url) page = self._downlo...
```suggestion 'timestamp': unified_timestamp(date), # XXX: Does not account for UK's daylight savings ``` is clear enough
'timestamp': 1684263600, 'series': 'AITAA: Am I the Agony Aunt?', 'thumbnail': 'md5:5980a831360d0744c3764551be3d09c1', 'categories': ['Entertainment'], } }] def _real_extract(self, url): episode_id = self._match_id(url) page = self._downlo...
@@ -0,0 +1,87 @@ +from re import finditer +from urllib.parse import urljoin + +from .common import InfoExtractor +from ..utils import join_nonempty, unified_timestamp + + +class CamFMBaseIE(InfoExtractor): + def _absolute_url(self, path, root='https://camfm.co.uk'): + return urljoin(root, path) + + +class Cam...
yt_dlp/extractor/camfm.py
26
Python
0.714
suggestion
139
34
32
false
Add Cam FM catch up extractors
7,083
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
'categories': ['Entertainment'], } }] def _real_extract(self, url): episode_id = self._match_id(url) page = self._download_webpage(url, episode_id) audios = self._parse_html5_media_entries('https://audio.camfm.co.uk', page, episode_id) formats = [] fo...
```suggestion 'thumbnail': self._absolute_url(self._search_regex(r'<div[^>]+class="cover-art"[^>]+style="[^"]+url\(\'([^\']+)', ``` trailing part does nothing
'categories': ['Entertainment'], } }] def _real_extract(self, url): episode_id = self._match_id(url) page = self._download_webpage(url, episode_id) audios = self._parse_html5_media_entries('https://audio.camfm.co.uk', page, episode_id) caption = get_element_...
@@ -0,0 +1,87 @@ +from re import finditer +from urllib.parse import urljoin + +from .common import InfoExtractor +from ..utils import join_nonempty, unified_timestamp + + +class CamFMBaseIE(InfoExtractor): + def _absolute_url(self, path, root='https://camfm.co.uk'): + return urljoin(root, path) + + +class Cam...
yt_dlp/extractor/camfm.py
26
Python
0.714
suggestion
173
31
29
false
Add Cam FM catch up extractors
7,083
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
from urllib.request import * # noqa: F403 from .. import compat_os_name from ..compat_utils import passthrough_module import sys passthrough_module(__name__, 'urllib.request') del passthrough_module if compat_os_name == 'nt': # On older python versions, proxies are extracted from Windows registry erroneously. [...
I think it makes sense to start with lowest version and always use `<=`/`<` ```suggestion (3, 9, 13) <= sys.version_info < (3, 10) # https://docs.python.org/3.9/whatsnew/changelog.html#python-3-9-13-final or (3, 10, 5) <= sys.version_info # https://docs.python.org/3.10/whatsnew/changelog.ht...
from urllib.request import * # noqa: F403 from ..compat_utils import passthrough_module passthrough_module(__name__, 'urllib.request') del passthrough_module from .. import compat_os_name if compat_os_name == 'nt': # On older python versions, proxies are extracted from Windows registry erroneously. [1] # ...
@@ -0,0 +1,36 @@ +# flake8: noqa: F405 +from urllib.request import * # noqa: F403 +from .. import compat_os_name +from ..compat_utils import passthrough_module +import sys + +passthrough_module(__name__, 'urllib.request') +del passthrough_module + + +if compat_os_name == 'nt': + # On older python versions, proxies ...
yt_dlp/compat/urllib/request.py
26
Python
0.857
question
421
36
40
false
[core] Workaround erroneous urllib Windows proxy parsing
7,092
yt-dlp/yt-dlp
132,642
Python
Grub4K
coletdjnz
# flake8: noqa: F405 from urllib.request import * # noqa: F403 from .. import compat_os_name from ..compat_utils import passthrough_module import sys passthrough_module(__name__, 'urllib.request') del passthrough_module if compat_os_name == 'nt': # On older python versions, proxies are extracted from Windows re...
```suggestion import sys from .. import compat_os_name from ..compat_utils import passthrough_module passthrough_module(__name__, 'urllib.request') del passthrough_module ``` Same and maybe reordered
# flake8: noqa: F405 from urllib.request import * # noqa: F403 from ..compat_utils import passthrough_module passthrough_module(__name__, 'urllib.request') del passthrough_module from .. import compat_os_name if compat_os_name == 'nt': # On older python versions, proxies are extracted from Windows registry er...
@@ -0,0 +1,36 @@ +# flake8: noqa: F405 +from urllib.request import * # noqa: F403 +from .. import compat_os_name +from ..compat_utils import passthrough_module +import sys + +passthrough_module(__name__, 'urllib.request') +del passthrough_module
yt_dlp/compat/urllib/request.py
8
Python
0.786
suggestion
210
33
33
false
[core] Workaround erroneous urllib Windows proxy parsing
7,092
yt-dlp/yt-dlp
132,642
Python
Grub4K
coletdjnz
'url': 'https://youtube.com/watch?v=HsUATh_Nc2U', 'info_dict': { 'id': 'HsUATh_Nc2U', 'ext': 'mp4', 'title': 'Godzilla 2 (Official Video)', 'description': 'md5:bf77e03fcae5529475e500129b05668a', 'upload_date': '20200...
`None` should be cleaned as a value, and wouldn't have to be added explicitly
'info_dict': { 'id': 'HsUATh_Nc2U', 'ext': 'mp4', 'title': 'Godzilla 2 (Official Video)', 'description': 'md5:bf77e03fcae5529475e500129b05668a', 'upload_date': '20200408', 'age_limit': 18, 'availa...
@@ -1427,6 +1429,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor): 'uploader': 'FlyingKitty', 'uploader_url': 'https://www.youtube.com/@FlyingKitty900', 'uploader_id': '@FlyingKitty900', + 'comment_count': int, + 'heatmap': None,
yt_dlp/extractor/youtube.py
26
Python
0.429
suggestion
77
51
51
false
[extractor/youtube] extract viewership heatmap for info-json
7,100
yt-dlp/yt-dlp
132,642
Python
Grub4K
tntmod54321
), expected_type=self._get_count, get_all=False) try: # This will error if there is no livechat initial_data['contents']['twoColumnWatchNextResults']['conversationBar']['liveChatRenderer']['continuations'][0]['reloadContinuationData']['continuation'] except (KeyError, IndexError, T...
Is there a reason we are returning `[]` and then resetting it using `or None`? ```suggestion info['heatmap'] = self._extract_heatmap_from_player_overlay(initial_data) ```
'video_id': video_id, 'ext': 'json', 'protocol': ('youtube_live_chat' if live_status in ('is_live', 'is_upcoming') else 'youtube_live_chat_replay'), }] if initial_data: info['chapters'] = ( self...
@@ -4317,6 +4340,10 @@ def process_language(container, base_url, lang_code, sub_name, query): or self._extract_chapters_from_description(video_description, duration) or None) + info['heatmap'] = ( + self._extract_heatmap_from_player_overlay(initial_data) + ...
yt_dlp/extractor/youtube.py
26
Python
0.786
refactor
185
51
51
false
[extractor/youtube] extract viewership heatmap for info-json
7,100
yt-dlp/yt-dlp
132,642
Python
Grub4K
tntmod54321
else f'{chapter["start_time"]} < {chapters[-1]["start_time"]}') warn(f'Invalid start time ({issue}) for chapter "{chapter["title"]}"') return chapters[1:] def _extract_chapters_from_description(self, description, duration): duration_re = r'(?:\d+:)?\d{1,2}:\...
Why are we splitting the logic into `strict`? Is there a case where we wouldn't want to sort? This would also simplify the for logic below, since we can assume it will always be sorted?
elif chapters[-1]['start_time'] <= chapter['start_time'] <= duration: chapters.append(chapter) elif chapter not in chapters: issue = (f'{chapter["start_time"]} > {duration}' if chapter['start_time'] > duration else f'{chapter["start_time"]...
@@ -3687,6 +3687,26 @@ def _extract_chapters_from_description(self, description, duration): start_function=lambda x: parse_duration(x[1]), title_function=lambda x: x[0], duration=duration, strict=False) + def _extract_heatmap_helper(self, heatmap_list, start_function, end_function, value_...
yt_dlp/extractor/common.py
26
Python
0.571
refactor
187
51
51
false
[extractor/youtube] extract viewership heatmap for info-json
7,100
yt-dlp/yt-dlp
132,642
Python
Grub4K
tntmod54321
warn(f'Incomplete chapter {idx}') elif chapters[-1]['start_time'] <= chapter['start_time'] <= duration: chapters.append(chapter) elif chapter not in chapters: issue = (f'{chapter["start_time"]} > {duration}' if chapter['start_time'] > duration ...
This seems overengineered. Instead of passing functions, this can be done inline using `traverse_obj` in the caller, like this: ```py scale_mili = functools.partial(float_or_none, scale=1000) generate_end = lambda point: point.get('timeRangeStartMillis') + point.get('markerDurationMillis') ...
chapters = [{'start_time': 0}] for idx, chapter in enumerate(chapter_list): if chapter['start_time'] is None: warn(f'Incomplete chapter {idx}') elif chapters[-1]['start_time'] <= chapter['start_time'] <= duration: chapters.append(chapter) ...
@@ -3687,6 +3687,26 @@ def _extract_chapters_from_description(self, description, duration): start_function=lambda x: parse_duration(x[1]), title_function=lambda x: x[0], duration=duration, strict=False) + def _extract_heatmap_helper(self, heatmap_list, start_function, end_function, value_...
yt_dlp/extractor/common.py
26
Python
0.857
refactor
813
51
51
false
[extractor/youtube] extract viewership heatmap for info-json
7,100
yt-dlp/yt-dlp
132,642
Python
Grub4K
tntmod54321
re.findall(sep_re % (duration_re, r'.+?'), description or ''), start_function=lambda x: parse_duration(x[0]), title_function=lambda x: x[1], duration=duration, strict=False) or self._extract_chapters_helper( re.findall(sep_re % (r'.+?', duration_re), description or ''), ...
I think it makes sense to have it print out the faulty point instead of the index: ```suggestion heatmap = [] for point in heatmap_list: if None in point.values(): warn(f'Incomplete heatmap point: {point}') continue heatmap.append(point) ...
def _extract_chapters_from_description(self, description, duration): duration_re = r'(?:\d+:)?\d{1,2}:\d{2}' sep_re = r'(?m)^\s*(%s)\b\W*\s(%s)\s*$' return self._extract_chapters_helper( re.findall(sep_re % (duration_re, r'.+?'), description or ''), start_function=lam...
@@ -3687,6 +3687,26 @@ def _extract_chapters_from_description(self, description, duration): start_function=lambda x: parse_duration(x[1]), title_function=lambda x: x[0], duration=duration, strict=False) + def _extract_heatmap_helper(self, heatmap_list, start_function, end_function, value_...
yt_dlp/extractor/common.py
26
Python
0.857
suggestion
345
51
51
false
[extractor/youtube] extract viewership heatmap for info-json
7,100
yt-dlp/yt-dlp
132,642
Python
Grub4K
tntmod54321
try: return float(v) * invscale / scale except (ValueError, TypeError): return default def bool_or_none(v, default=None): return v if isinstance(v, bool) else default def strip_or_none(v, default=None): return v.strip() if isinstance(v, str) else default def url_or_none(url): i...
Just do `try_get(vals, sum)`. Not worth a function
try: return float(v) * invscale / scale except (ValueError, TypeError): return default def bool_or_none(v, default=None): return v if isinstance(v, bool) else default def strip_or_none(v, default=None): return v.strip() if isinstance(v, str) else default def url_or_none(url): i...
@@ -2575,6 +2575,13 @@ def url_or_none(url): return url if re.match(r'^(?:(?:https?|rt(?:m(?:pt?[es]?|fp)|sp[su]?)|mms|ftps?):)?//', url) else None +def sum_or_none(*vals): + if None in vals: + return None + else: + return sum(vals)
yt_dlp/utils/_utils.py
26
Python
0.357
suggestion
50
51
51
false
[extractor/youtube] extract viewership heatmap for info-json
7,100
yt-dlp/yt-dlp
132,642
Python
pukkandan
tntmod54321
start_function=lambda chapter: float_or_none( traverse_obj(chapter, ('chapterRenderer', 'timeRangeStartMillis')), scale=1000), title_function=lambda chapter: traverse_obj( chapter, ('chapterRenderer', 'title', 'simpleText'), expected_type=str), duratio...
Cosmetic ```suggestion content_list = traverse_obj(data, ( 'playerOverlays', 'playerOverlayRenderer', 'decoratedPlayerBarRenderer', 'decoratedPlayerBarRenderer', 'playerBar', 'multiMarkersPlayerBarRenderer', 'markersMap', ..., 'value', 'heatmap', 'heatmapRenderer', 'heatMarkers', {li...
start_function=lambda chapter: float_or_none( traverse_obj(chapter, ('chapterRenderer', 'timeRangeStartMillis')), scale=1000), title_function=lambda chapter: traverse_obj( chapter, ('chapterRenderer', 'title', 'simpleText'), expected_type=str), duratio...
@@ -3248,6 +3250,23 @@ def _extract_chapters_from_engagement_panel(self, data, duration): chapter_time, chapter_title, duration) for contents in content_list)), []) + def _extract_heatmap_from_player_overlay(self, data): + content_list = traverse_obj( ...
yt_dlp/extractor/youtube.py
26
Python
0.786
suggestion
330
51
51
false
[extractor/youtube] extract viewership heatmap for info-json
7,100
yt-dlp/yt-dlp
132,642
Python
Grub4K
tntmod54321
duration=duration) def _extract_chapters_from_engagement_panel(self, data, duration): content_list = traverse_obj( data, ('engagementPanels', ..., 'engagementPanelSectionListRenderer', 'content', 'macroMarkersListRenderer', 'contents'), expected_type=list) ...
```suggestion return next(filter(None, ( traverse_obj(contents, (..., 'heatMarkerRenderer', { 'start_time': ('timeRangeStartMillis', {scale_mili}), 'end_time': {lambda x: (x['timeRangeStartMillis'] + x['markerDurationMillis']) / 1000}, ``` transformations `{}` a...
duration=duration) def _extract_chapters_from_engagement_panel(self, data, duration): content_list = traverse_obj( data, ('engagementPanels', ..., 'engagementPanelSectionListRenderer', 'content', 'macroMarkersListRenderer', 'contents'), expected_type=list) ...
@@ -3248,6 +3250,20 @@ def _extract_chapters_from_engagement_panel(self, data, duration): chapter_time, chapter_title, duration) for contents in content_list)), []) + def _extract_heatmap_from_player_overlay(self, data): + content_list = traverse_obj(d...
yt_dlp/extractor/youtube.py
26
Python
0.786
suggestion
354
51
51
false
[extractor/youtube] extract viewership heatmap for info-json
7,100
yt-dlp/yt-dlp
132,642
Python
pukkandan
tntmod54321
if self.params.get('listsubtitles'): if 'automatic_captions' in info_dict: self.list_subtitles( info_dict['id'], automatic_captions, 'automatic captions') self.list_subtitles(info_dict['id'], subtitles, 'subtitles') if self.params.get('listform...
We should always try and use a f-strings instead ```suggestion self.write_debug(f'No format selected, using {req_format}') ```
if self.params.get('listsubtitles'): if 'automatic_captions' in info_dict: self.list_subtitles( info_dict['id'], automatic_captions, 'automatic captions') self.list_subtitles(info_dict['id'], subtitles, 'subtitles') if self.params.get('listform...
@@ -2732,7 +2732,11 @@ def is_wellformed(f): while True: if interactive_format_selection: req_format = input( - self._format_screen('\nEnter format selector: ', self.Styles.EMPHASIS)) + self._format_screen('\nEnter format selector (press ENTER...
yt_dlp/YoutubeDL.py
26
Python
0.929
bug
149
51
51
false
6720: Pressing enter uses default format
7,101
yt-dlp/yt-dlp
132,642
Python
Grub4K
ivanskodje
'thumbnail': 'https://rule34video.com/contents/videos_screenshots/3065000/3065296/preview.jpg', 'duration': 938.0, 'age_limit': 18, 'tags': 'count:50' } }, ] def _real_extract(self, url): video_id = self._match_id(url) ...
idk if tags can have special chars, but wrap this in `unescapeHTML` just in case.
'thumbnail': 'https://rule34video.com/contents/videos_screenshots/3065000/3065296/preview.jpg', 'duration': 938.0, 'age_limit': 18, 'tags': 'count:50' } }, ] def _real_extract(self, url): video_id = self._match_id(url) ...
@@ -50,12 +52,14 @@ def _real_extract(self, url): title = self._html_extract_title(webpage) thumbnail = self._html_search_regex(r'preview_url:\s+\'([^\']+)\'', webpage, 'thumbnail', default=None) duration = self._html_search_regex(r'"icon-clock"></i>\s+<span>((?:\d+:?)+)', webpage, 'duration'...
yt_dlp/extractor/rule34video.py
26
Python
0.357
security
81
37
37
false
[rule34video] Extract tags for videos
7,117
yt-dlp/yt-dlp
132,642
Python
pukkandan
soundchaser128