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 .adobepass import AdobePassIE from ..utils import ( update_url_query, smuggle_url, ) class SyfyIE(AdobePassIE): _VALID_URL = r'https?://(?:www\.)?syfy\.com/(?:[^/]+/)?videos/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'http://www.syfy.com/theinternetruinedmylife/videos/the-internet-ruined-my-life...
```suggestion 'skip': 'Redirects to main page', ```
from .adobepass import AdobePassIE from ..utils import ( update_url_query, smuggle_url, ) class SyfyIE(AdobePassIE): _VALID_URL = r'https?://(?:www\.)?syfy\.com/(?:[^/]+/)?videos/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'http://www.syfy.com/theinternetruinedmylife/videos/the-internet-ruined-my-life...
@@ -23,6 +23,7 @@ class SyfyIE(AdobePassIE): 'skip_download': True, }, 'add_ie': ['ThePlatform'], + 'skip': 'redirects to syfy.com. All videos there seem to be geo-restricted.',
yt_dlp/extractor/syfy.py
26
Python
0.571
suggestion
61
51
51
false
Fixtests
7,718
yt-dlp/yt-dlp
132,642
Python
bashonly
trainman261
'timestamp': 1383239700, 'upload_date': '20131031', 'uploader': 'CBSI-NEW', }, 'params': { # rtmp download 'skip_download': True, }, 'skip': '404 Not Found', }, { # from http://www.cnet.com/videos/tesla-model-s-a-sec...
```suggestion 'skip': 'CNet no longer uses ThePlatform', ```
'ext': 'flv', 'title': 'Blackberry\'s big, bold Z30', 'description': 'The Z30 is Blackberry\'s biggest, baddest mobile messaging device yet.', 'duration': 247, 'timestamp': 1383239700, 'upload_date': '20131031', 'uploader': 'CBSI-NEW', ...
@@ -162,7 +162,8 @@ class ThePlatformIE(ThePlatformBaseIE, AdobePassIE): 'params': { # rtmp download 'skip_download': True, - } + }, + 'skip': 'cnet no longer seems to use theplatform, at least not in this video',
yt_dlp/extractor/theplatform.py
26
Python
0.643
suggestion
70
51
51
false
Fixtests
7,718
yt-dlp/yt-dlp
132,642
Python
bashonly
trainman261
# from http://www.cnet.com/videos/tesla-model-s-a-second-step-towards-a-cleaner-motoring-future/ 'url': 'http://link.theplatform.com/s/kYEXFC/22d_qsQ6MIRT', 'info_dict': { 'id': '22d_qsQ6MIRT', 'ext': 'flv', 'description': 'md5:ac330c9258c04f9d7512cf26b9595409...
```suggestion 'skip': 'Dead link', ```
'skip_download': True, }, 'skip': '404 Not Found', }, { # from http://www.cnet.com/videos/tesla-model-s-a-second-step-towards-a-cleaner-motoring-future/ 'url': 'http://link.theplatform.com/s/kYEXFC/22d_qsQ6MIRT', 'info_dict': { 'id': '22d_qsQ6MIRT', ...
@@ -171,7 +172,8 @@ class ThePlatformIE(ThePlatformBaseIE, AdobePassIE): 'description': 'md5:644ad9188d655b742f942bf2e06b002d', 'title': 'HIGHLIGHTS: USA bag first ever series Cup win', 'uploader': 'EGSM', - } + }, + 'skip': 'no clue where this comes from, and...
yt_dlp/extractor/theplatform.py
26
Python
0.429
suggestion
48
51
51
false
Fixtests
7,718
yt-dlp/yt-dlp
132,642
Python
bashonly
trainman261
'info_dict': { 'id': 'yMBg9E8KFxZD', 'ext': 'mp4', 'description': 'md5:644ad9188d655b742f942bf2e06b002d', 'title': 'HIGHLIGHTS: USA bag first ever series Cup win', 'uploader': 'EGSM', }, 'skip': 'no clue where this comes from, and doesn...
```suggestion 'skip': 'Error: Player PID "nbcNewsOffsite" is disabled', ```
}, 'skip': 'CNet no longer uses ThePlatform', }, { 'url': 'https://player.theplatform.com/p/D6x-PC/pulse_preview/embed/select/media/yMBg9E8KFxZD', 'info_dict': { 'id': 'yMBg9E8KFxZD', 'ext': 'mp4', 'description': 'md5:644ad9188d655b742f942bf2e06b00...
@@ -189,6 +191,7 @@ class ThePlatformIE(ThePlatformBaseIE, AdobePassIE): 'upload_date': '20150701', 'uploader': 'NBCU-NEWS', }, + 'skip': 'Error: Player PID "nbcNewsOffsite" is disabled. Again, no clue where this comes from, someone please fix.'
yt_dlp/extractor/theplatform.py
26
Python
0.714
suggestion
85
51
51
false
Fixtests
7,718
yt-dlp/yt-dlp
132,642
Python
bashonly
trainman261
'secret_key': get('SecretAccessKey'), 'session_token': get('SessionToken'), }, video_id)['results'][0]['mcpId'] return self.url_result( smuggle_url( 'anvato:anvato_scripps_app_web_prod_0837996dbe373629133857ae9eb72e740424d80a:%s' % mcp_id, ...
Is this expected behavior (referring to the `chapters` line)
'access_key': get('AccessKeyId'), 'secret_key': get('SecretAccessKey'), 'session_token': get('SessionToken'), }, video_id)['results'][0]['mcpId'] return self.url_result( smuggle_url( 'anvato:anvato_scripps_app_web_prod_0837996dbe3736291338...
@@ -113,6 +114,9 @@ class ScrippsNetworksIE(InfoExtractor): 'timestamp': 1475678834, 'upload_date': '20161005', 'uploader': 'SCNI-SCND', + 'duration': 29.995, + 'chapters': [{'start_time': 0.0, 'end_time': 29.995, 'title': '<Untitled Chapter 1>'}],
yt_dlp/extractor/scrippsnetworks.py
26
Python
0.357
suggestion
60
51
51
false
Fixtests
7,718
yt-dlp/yt-dlp
132,642
Python
gamer191
trainman261
source_url, channel_id, 'mp4', m3u8_id='hls', fatal=False)) elif source_type == 'html5/video/mp4': formats.append({ 'url': source_url, }) mature = metadata.get('adult') if mature is None: age_limit = None ...
```suggestion _VALID_URL = r'https?://(?:www\.)?picarto\.tv/(?:videopopout|\w+/videos)/(?P<id>[^/?#&]+)' ```
if source_type == 'html5/application/vnd.apple.mpegurl': formats.extend(self._extract_m3u8_formats( source_url, channel_id, 'mp4', m3u8_id='hls', fatal=False)) elif source_type == 'html5/video/mp4': formats.append({ 'url': s...
@@ -84,7 +85,7 @@ def _real_extract(self, url): class PicartoVodIE(InfoExtractor): - _VALID_URL = r'https?://(?:www.)?picarto\.tv/videopopout/(?P<id>[^/?#&]+)' + _VALID_URL = r'https?://(?:www.)?picarto\.tv/(videopopout|[a-zA-Z0-9]+/videos)/(?P<id>[^/?#&]+)'
yt_dlp/extractor/picarto.py
26
Python
0.714
suggestion
114
51
51
false
[ie/PicartoVod] Fix VOD download for picarto.tv
7,727
yt-dlp/yt-dlp
132,642
Python
bashonly
Frankgoji
}, }, { 'url': 'https://picarto.tv/videopopout/Plague', 'only_matching': True, }, { 'url': 'https://picarto.tv/ArtofZod/videos/772650', 'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) data = traverse_obj(sel...
no point in making this non-fatal with `traverse_obj` if `title` and `netloc` are both fatal ```suggestion data = self._download_json( 'https://ptvintern.picarto.tv/ptvapi', video_id, query={ 'query': '''{ video(id: "%s") { id title file_name video_recordin...
'title': 'ArtofZod_2017.12.12.00.13.23.flv', 'thumbnail': r're:^https?://.*\.jpg' }, 'skip': 'The VOD does not exist', }, { 'url': 'https://picarto.tv/ArtofZod/videos/772650', 'md5': '00067a0889f1f6869cc512e3e79c521b', 'info_dict': { 'id': ...
@@ -97,26 +98,39 @@ class PicartoVodIE(InfoExtractor): }, { 'url': 'https://picarto.tv/videopopout/Plague', 'only_matching': True, + }, { + 'url': 'https://picarto.tv/ArtofZod/videos/772650', + 'only_matching': True, }] def _real_extract(self, url): video_id ...
yt_dlp/extractor/picarto.py
26
Python
0.786
suggestion
426
41
51
false
[ie/PicartoVod] Fix VOD download for picarto.tv
7,727
yt-dlp/yt-dlp
132,642
Python
bashonly
Frankgoji
}] def _real_extract(self, url): video_id = self._match_id(url) data = traverse_obj(self._download_json( 'https://ptvintern.picarto.tv/ptvapi', video_id, query={ 'query': '''{ video(id: "%s") { id title file_name video_recording_image_url chann...
```suggestion f'https://{netloc}/stream/hls/{title}/index.m3u8', video_id, 'mp4', m3u8_id='hls') ```
'info_dict': { 'id': '772650', 'ext': 'mp4', 'title': 'Art of Zod - Drawing and Painting', 'thumbnail': r're:^https?://.*\.jpg', 'channel': 'ArtofZod', 'age_limit': 18, } }, { 'url': 'https://picarto.tv/videopopout/Plagu...
@@ -97,26 +98,39 @@ class PicartoVodIE(InfoExtractor): }, { 'url': 'https://picarto.tv/videopopout/Plague', 'only_matching': True, + }, { + 'url': 'https://picarto.tv/ArtofZod/videos/772650', + 'only_matching': True, }] def _real_extract(self, url): video_id ...
yt_dlp/extractor/picarto.py
26
Python
0.714
suggestion
114
34
50
false
[ie/PicartoVod] Fix VOD download for picarto.tv
7,727
yt-dlp/yt-dlp
132,642
Python
bashonly
Frankgoji
data = traverse_obj(self._download_json( 'https://ptvintern.picarto.tv/ptvapi', video_id, query={ 'query': '''{ video(id: "%s") { id title file_name video_recording_image_url channel { name } } }''' % (video_id), }), ('data', 'video')) ...
metadata extraction should be non-fatal ```suggestion 'thumbnail': data.get('video_recording_image_url'), ```
'channel': 'ArtofZod', 'age_limit': 18, } }, { 'url': 'https://picarto.tv/videopopout/Plague', 'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) data = self._download_json( 'https://ptvintern.p...
@@ -97,26 +98,39 @@ class PicartoVodIE(InfoExtractor): }, { 'url': 'https://picarto.tv/videopopout/Plague', 'only_matching': True, + }, { + 'url': 'https://picarto.tv/ArtofZod/videos/772650', + 'only_matching': True, }] def _real_extract(self, url): video_id ...
yt_dlp/extractor/picarto.py
26
Python
0.786
refactor
124
29
45
false
[ie/PicartoVod] Fix VOD download for picarto.tv
7,727
yt-dlp/yt-dlp
132,642
Python
bashonly
Frankgoji
}) mature = metadata.get('adult') if mature is None: age_limit = None else: age_limit = 18 if mature is True else 0 return { 'id': channel_id, 'title': title.strip(), 'is_live': True, 'channel': cha...
does this test pass? if not, add `skip` to it and make your new `only_matching` test into a proper test
formats.append({ 'url': source_url, }) mature = metadata.get('adult') if mature is None: age_limit = None else: age_limit = 18 if mature is True else 0 return { 'id': channel_id, 'title'...
@@ -84,7 +85,7 @@ def _real_extract(self, url): class PicartoVodIE(InfoExtractor): - _VALID_URL = r'https?://(?:www.)?picarto\.tv/videopopout/(?P<id>[^/?#&]+)' + _VALID_URL = r'https?://(?:www.)?picarto\.tv/(videopopout|[a-zA-Z0-9]+/videos)/(?P<id>[^/?#&]+)' _TESTS = [{ 'url': 'https://picarto....
yt_dlp/extractor/picarto.py
26
Python
0.5
question
106
51
51
false
[ie/PicartoVod] Fix VOD download for picarto.tv
7,727
yt-dlp/yt-dlp
132,642
Python
bashonly
Frankgoji
'skip': 'The VOD does not exist', }, { 'url': 'https://picarto.tv/ArtofZod/videos/772650', 'md5': '00067a0889f1f6869cc512e3e79c521b', 'info_dict': { 'id': '772650', 'ext': 'mp4', 'title': 'govod+golive+ArtofZod_2023.06.12.23.28.30_nsfw.mkv', ...
This shares some common code with the API call in `PicartoIE._real_extract`, but not enough to make adding a baseclass worth it IMO
'ext': 'mp4', 'title': 'ArtofZod_2017.12.12.00.13.23.flv', 'thumbnail': r're:^https?://.*\.jpg' }, 'skip': 'The VOD does not exist', }, { 'url': 'https://picarto.tv/ArtofZod/videos/772650', 'md5': '00067a0889f1f6869cc512e3e79c521b', 'info_d...
@@ -102,21 +111,30 @@ class PicartoVodIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) + data = self._download_json( + 'https://ptvintern.picarto.tv/ptvapi', video_id, query={
yt_dlp/extractor/picarto.py
26
Python
0.571
refactor
131
46
51
false
[ie/PicartoVod] Fix VOD download for picarto.tv
7,727
yt-dlp/yt-dlp
132,642
Python
bashonly
Frankgoji
'info_dict': { 'id': '772650', 'ext': 'mp4', 'title': 'govod+golive+ArtofZod_2023.06.12.23.28.30_nsfw.mkv', 'thumbnail': r're:^https?://.*\.jpg' } }, { 'url': 'https://picarto.tv/videopopout/Plague', 'only_matching': True, }] d...
Remove fields you are not using
'skip': 'The VOD does not exist', }, { 'url': 'https://picarto.tv/ArtofZod/videos/772650', 'md5': '00067a0889f1f6869cc512e3e79c521b', 'info_dict': { 'id': '772650', 'ext': 'mp4', 'title': 'Art of Zod - Drawing and Painting', 'thumbnail'...
@@ -102,21 +111,30 @@ class PicartoVodIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) + data = self._download_json( + 'https://ptvintern.picarto.tv/ptvapi', video_id, query={ + 'quer...
yt_dlp/extractor/picarto.py
26
Python
0.143
suggestion
31
42
51
false
[ie/PicartoVod] Fix VOD download for picarto.tv
7,727
yt-dlp/yt-dlp
132,642
Python
pukkandan
Frankgoji
'id': '772650', 'ext': 'mp4', 'title': 'govod+golive+ArtofZod_2023.06.12.23.28.30_nsfw.mkv', 'thumbnail': r're:^https?://.*\.jpg' } }, { 'url': 'https://picarto.tv/videopopout/Plague', 'only_matching': True, }] def _real_extract(self, ...
could use fstring imo, but I won't insist
}, { 'url': 'https://picarto.tv/ArtofZod/videos/772650', 'md5': '00067a0889f1f6869cc512e3e79c521b', 'info_dict': { 'id': '772650', 'ext': 'mp4', 'title': 'Art of Zod - Drawing and Painting', 'thumbnail': r're:^https?://.*\.jpg', 'ch...
@@ -102,21 +111,30 @@ class PicartoVodIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) + data = self._download_json( + 'https://ptvintern.picarto.tv/ptvapi', video_id, query={ + 'quer...
yt_dlp/extractor/picarto.py
26
Python
0.143
suggestion
41
41
51
false
[ie/PicartoVod] Fix VOD download for picarto.tv
7,727
yt-dlp/yt-dlp
132,642
Python
pukkandan
Frankgoji
data = self._download_json( 'https://ptvintern.picarto.tv/ptvapi', video_id, query={ 'query': '''{ video(id: "%s") { id title file_name video_recording_image_url channel { name } } }''' % video_id, })['data']['video'] title = da...
could do this and leave the graphql query as-is ```suggestion **traverse_obj(data, { 'id': ('id', {str_or_none}), 'title': ('title', {str}), 'thumbnail': 'video_recording_image_url', 'channel': ('channel', 'name', {str}), }),...
'url': 'https://picarto.tv/videopopout/Plague', 'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) data = self._download_json( 'https://ptvintern.picarto.tv/ptvapi', video_id, query={ 'query': f'''{{ video(id: "{...
@@ -102,21 +111,30 @@ class PicartoVodIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id) + data = self._download_json( + 'https://ptvintern.picarto.tv/ptvapi', video_id, query={ + 'quer...
yt_dlp/extractor/picarto.py
26
Python
0.857
suggestion
325
29
41
false
[ie/PicartoVod] Fix VOD download for picarto.tv
7,727
yt-dlp/yt-dlp
132,642
Python
bashonly
Frankgoji
RutubePersonIE, RutubePlaylistIE, RutubeTagsIE, ) from .glomex import ( GlomexIE, GlomexEmbedIE, ) from .megatvcom import ( MegaTVComIE, MegaTVComEmbedIE, ) from .ant1newsgr import ( Ant1NewsGrWatchIE, Ant1NewsGrArticleIE, Ant1NewsGrEmbedIE, ) from .rutv import RUTVIE from .ruutu...
```suggestion from .s4c import S4CIE ```
RutubePersonIE, RutubePlaylistIE, RutubeTagsIE, ) from .glomex import ( GlomexIE, GlomexEmbedIE, ) from .megatvcom import ( MegaTVComIE, MegaTVComEmbedIE, ) from .ant1newsgr import ( Ant1NewsGrWatchIE, Ant1NewsGrArticleIE, Ant1NewsGrEmbedIE, ) from .rutv import RUTVIE from .ruutu...
@@ -1709,6 +1709,9 @@ RuvIE, RuvSpilaIE ) +from .s4c import ( + S4CIE +)
yt_dlp/extractor/_extractors.py
26
Python
0.429
suggestion
42
51
51
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
from .common import InfoExtractor from ..utils import ( traverse_obj ) class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>[0-9]+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209',...
```suggestion from ..utils import traverse_obj ```
from .common import InfoExtractor from ..utils import traverse_obj class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', ...
@@ -0,0 +1,61 @@ +from .common import InfoExtractor + +from ..utils import ( + traverse_obj +)
yt_dlp/extractor/s4c.py
5
Python
0.571
suggestion
52
30
30
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
from .common import InfoExtractor from ..utils import ( traverse_obj ) class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>[0-9]+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209',...
```suggestion _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' ```
from .common import InfoExtractor from ..utils import traverse_obj class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', ...
@@ -0,0 +1,61 @@ +from .common import InfoExtractor + +from ..utils import ( + traverse_obj +) + + +class S4CIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>[0-9]+)'
yt_dlp/extractor/s4c.py
9
Python
0.571
suggestion
96
34
34
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
from ..utils import ( traverse_obj ) class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>[0-9]+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', 'ext': 'mp4', ...
Use md5 for long descriptions Replace value of `description` with `md5:TODO`, run the test; it will fail and output an md5 hash you can use instead
from ..utils import traverse_obj class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', 'ext': 'mp4', 'title'...
@@ -0,0 +1,61 @@ +from .common import InfoExtractor + +from ..utils import ( + traverse_obj +) + + +class S4CIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>[0-9]+)' + _TESTS = [{ + 'url': 'https://www.s4c.cymru/clic/programme/861362209', + 'info_dict': { +...
yt_dlp/extractor/s4c.py
26
Python
0.571
bug
150
51
51
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', 'ext': 'mp4', 'title': 'Y Swn', 'description': 'When Margaret Thatcher\'s government breaks a promise to establish a Welsh language channel in 1979 it unleashes a wa...
`programme_metadata` is only used once, we can reduce this to a single var/line. And `details` will only be used for metadata, so it should be non-fatal ```suggestion details = self._download_json( f'https://www.s4c.cymru/df/full_prog_details?lang=e&programme_id={video_id}', video_id...
'ext': 'mp4', 'title': 'Y Swn', 'description': 'md5:f7681a30e4955b250b3224aa9fe70cf0', 'duration': 5340 }, }, { 'url': 'https://www.s4c.cymru/clic/programme/856636948', 'info_dict': { 'id': '856636948', 'ext': 'mp4', ...
@@ -0,0 +1,61 @@ +from .common import InfoExtractor + +from ..utils import ( + traverse_obj +) + + +class S4CIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>[0-9]+)' + _TESTS = [{ + 'url': 'https://www.s4c.cymru/clic/programme/861362209', + 'info_dict': { +...
yt_dlp/extractor/s4c.py
26
Python
0.857
suggestion
339
51
51
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
'id': '856636948', 'ext': 'mp4', 'title': 'Am Dro', 'duration': 2880, 'description': 'In this programme Geraint will be leading the crew on a walk through Llanelli while introducing them to some unusual creatures. Barney will be taking them on a walk along the...
this can be inlined in the return ```suggestion ```
'description': 'md5:100d8686fc9a632a0cb2db52a3433ffe', }, }] def _real_extract(self, url): video_id = self._match_id(url) details = self._download_json( f'https://www.s4c.cymru/df/full_prog_details?lang=e&programme_id={video_id}', video_id, fatal=Fals...
@@ -0,0 +1,61 @@ +from .common import InfoExtractor + +from ..utils import ( + traverse_obj +) + + +class S4CIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>[0-9]+)' + _TESTS = [{ + 'url': 'https://www.s4c.cymru/clic/programme/861362209', + 'info_dict': { +...
yt_dlp/extractor/s4c.py
26
Python
0.571
suggestion
53
40
41
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
def _real_extract(self, url): video_id = self._match_id(url) programme_metadata = self._download_json(f'https://www.s4c.cymru/df/full_prog_details?lang=e&programme_id={video_id}', video_id) programme_details = programme_metadata.get('full_prog_details') or [] metadata = { ...
Avoid one-time use vars, we can get by using 2 instead of 4. Make use of the `query` param instead of long URLs; lines were too long ```suggestion filename = self._download_json( 'https://player-api.s4c-cdn.co.uk/player-configuration/prod', video_id, query={ 'programme_id': vide...
video_id, fatal=False) filename = self._download_json( 'https://player-api.s4c-cdn.co.uk/player-configuration/prod', video_id, query={ 'programme_id': video_id, 'signed': '0', 'lang': 'en', 'mode': 'od', 'ap...
@@ -0,0 +1,61 @@ +from .common import InfoExtractor + +from ..utils import ( + traverse_obj +) + + +class S4CIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>[0-9]+)' + _TESTS = [{ + 'url': 'https://www.s4c.cymru/clic/programme/861362209', + 'info_dict': { +...
yt_dlp/extractor/s4c.py
26
Python
0.857
refactor
969
32
33
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
programme_details = programme_metadata.get('full_prog_details') or [] metadata = { 'id': video_id, **traverse_obj(programme_details[0], { 'description': ('full_billing', {str.strip}), 'duration': ('duration', {lambda x: int(x) * 60}), }...
It doesn't hurt to also try extracting subtitles just in case they exist & this is what I mean by inline all metadata in return ```suggestion formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4', m3u8_id='hls') return { 'id': video_id, ...
'signed': '0', 'lang': 'en', 'mode': 'od', 'appId': 'clic', 'streamName': '', }, note='Downloading player config JSON')['filename'] m3u8_url = self._download_json( 'https://player-api.s4c-cdn.co.uk/streaming-...
@@ -0,0 +1,61 @@ +from .common import InfoExtractor + +from ..utils import ( + traverse_obj +) + + +class S4CIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>[0-9]+)' + _TESTS = [{ + 'url': 'https://www.s4c.cymru/clic/programme/861362209', + 'info_dict': { +...
yt_dlp/extractor/s4c.py
26
Python
0.857
refactor
693
27
28
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
from .common import InfoExtractor from ..utils import traverse_obj class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', ...
```suggestion from .common import InfoExtractor from ..utils import traverse_obj ```
from .common import InfoExtractor from ..utils import traverse_obj class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', ...
@@ -0,0 +1,65 @@ +from .common import InfoExtractor + +from ..utils import traverse_obj
yt_dlp/extractor/s4c.py
3
Python
0.643
refactor
87
28
28
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
from .common import InfoExtractor from ..utils import traverse_obj class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', ...
```suggestion }, }, { ```
from .common import InfoExtractor from ..utils import traverse_obj class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', ...
@@ -0,0 +1,65 @@ +from .common import InfoExtractor + +from ..utils import traverse_obj + + +class S4CIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' + _TESTS = [{ + 'url': 'https://www.s4c.cymru/clic/programme/861362209', + 'info_dict': { + '...
yt_dlp/extractor/s4c.py
18
Python
0.429
suggestion
40
43
43
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
from ..utils import traverse_obj class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', 'ext': 'mp4', 'title'...
```suggestion }, }] ```
class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209', 'ext': 'mp4', 'title': 'Y Swn', 'descripti...
@@ -0,0 +1,65 @@ +from .common import InfoExtractor + +from ..utils import traverse_obj + + +class S4CIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' + _TESTS = [{ + 'url': 'https://www.s4c.cymru/clic/programme/861362209', + 'info_dict': { + '...
yt_dlp/extractor/s4c.py
26
Python
0.429
suggestion
38
51
51
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
video_id = self._match_id(url) details = self._download_json( f'https://www.s4c.cymru/df/full_prog_details?lang=e&programme_id={video_id}', video_id, fatal=False) filename = self._download_json( 'https://player-api.s4c-cdn.co.uk/player-configuration/prod', vi...
```suggestion }, note='Downloading streaming urls JSON')['hls'] formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4', m3u8_id='hls') return { ```
video_id, fatal=False) filename = self._download_json( 'https://player-api.s4c-cdn.co.uk/player-configuration/prod', video_id, query={ 'programme_id': video_id, 'signed': '0', 'lang': 'en', 'mode': 'od', 'ap...
@@ -0,0 +1,65 @@ +from .common import InfoExtractor + +from ..utils import traverse_obj + + +class S4CIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' + _TESTS = [{ + 'url': 'https://www.s4c.cymru/clic/programme/861362209', + 'info_dict': { + '...
yt_dlp/extractor/s4c.py
26
Python
0.857
refactor
214
36
33
false
[extractor/s4c]: Add extractor
7,730
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
class TBSJPEpisodeIE(InfoExtractor): _VALID_URL = r'https://cu\.tbs\.co\.jp/episode/(?P<id>[\d_]+)' _TESTS = [{ 'url': 'https://cu.tbs.co.jp/episode/23613_2044134_1000049010', 'skip': 'streams geo-restricted, Japan only. Also, will likely expire eventually', 'info_dict': { '...
`webpage` is the conventional var name. Doesn't really matter here I guess, but IMO it helps to avoid confusion if dealing with paginated playlists in the same extractor module
unified_timestamp, urljoin, ) class TBSJPEpisodeIE(InfoExtractor): _VALID_URL = r'https?://cu\.tbs\.co\.jp/episode/(?P<id>[\d_]+)' _GEO_BYPASS = False _TESTS = [{ 'url': 'https://cu.tbs.co.jp/episode/23613_2044134_1000049010', 'skip': 'streams geo-restricted, Japan only. Also, will...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.571
refactor
176
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
class TBSJPEpisodeIE(InfoExtractor): _VALID_URL = r'https://cu\.tbs\.co\.jp/episode/(?P<id>[\d_]+)' _TESTS = [{ 'url': 'https://cu.tbs.co.jp/episode/23613_2044134_1000049010', 'skip': 'streams geo-restricted, Japan only. Also, will likely expire eventually', 'info_dict': { 't...
regex fix, and if it's only used for metadata it can be non-fatal ```suggestion meta = self._search_json('window\.app\s*=', page, 'episode info', video_id, fatal=False) ```
urljoin, ) class TBSJPEpisodeIE(InfoExtractor): _VALID_URL = r'https?://cu\.tbs\.co\.jp/episode/(?P<id>[\d_]+)' _GEO_BYPASS = False _TESTS = [{ 'url': 'https://cu.tbs.co.jp/episode/23613_2044134_1000049010', 'skip': 'streams geo-restricted, Japan only. Also, will likely expire eventual...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.786
suggestion
183
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'id': '23613_2044134_1000049010', 'ext': 'mp4', 'upload_date': '20230728', 'duration': 3517, 'release_timestamp': 1690869448, 'episode': '第三話 誤送金完結へ!絶体絶命の反撃開始', 'release_date': '20230801', 'categories': 'count:11', ...
this could all be inlined in return
_TESTS = [{ 'url': 'https://cu.tbs.co.jp/episode/23613_2044134_1000049010', 'skip': 'streams geo-restricted, Japan only. Also, will likely expire eventually', 'info_dict': { 'title': 'VIVANT 第三話 誤送金完結へ!絶体絶命の反撃開始', 'id': '23613_2044134_1000049010', 'ext': '...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.143
suggestion
35
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'release_timestamp': 1690869448, 'episode': '第三話 誤送金完結へ!絶体絶命の反撃開始', 'release_date': '20230801', 'categories': 'count:11', 'episode_number': 3, 'timestamp': 1690522538, 'description': 'md5:2b796341af1ef772034133174ba4a895', '...
```suggestion 'duration': ('tv_episode_info', 'duration', {int_or_none}), 'episode_number': ('tv_episode_info', 'episode_number', {int_or_none}), ```
'title': 'VIVANT 第三話 誤送金完結へ!絶体絶命の反撃開始', 'id': '23613_2044134_1000049010', 'ext': 'mp4', 'upload_date': '20230728', 'duration': 3517, 'release_timestamp': 1691118230, 'episode': '第三話 誤送金完結へ!絶体絶命の反撃開始', 'release_date': '202308...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.714
suggestion
176
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
}, }] def _real_extract(self, url): video_id = self._match_id(url) page = self._download_webpage(url, video_id) meta = self._search_json('window.app=', page, 'episode info', video_id) episode = traverse_obj(meta, ('falcorCache', 'catalog', 'episode', video_id, 'value'))...
I'd write it like this ```suggestion tf_path = self._search_regex( r'<script[^>]+src=["\'](/assets/tf\.[^"\']+\.js)["\']', page, 'stream API config') tf_js = self._download_webpage(urljoin(url, tf_path), video_id, note='Downloading stream API config') ``` but your way is OK too if you ...
'categories': 'count:11', 'episode_number': 3, 'timestamp': 1690522538, 'description': 'md5:2b796341af1ef772034133174ba4a895', 'series': 'VIVANT', }, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = sel...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.786
suggestion
604
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
def _real_extract(self, url): video_id = self._match_id(url) page = self._download_webpage(url, video_id) meta = self._search_json('window.app=', page, 'episode info', video_id) episode = traverse_obj(meta, ('falcorCache', 'catalog', 'episode', video_id, 'value')) episode_...
```suggestion video_url = self._search_regex(r'videoPlaybackUrl:\s*[\'"]([^\'"]+)[\'"]', tf_js, 'stream API url') api_key = self._search_regex(r'api_key:\s*[\'"]([^\'"]+)[\'"]', tf_js, 'stream API key') ```
'timestamp': 1690522538, 'description': 'md5:2b796341af1ef772034133174ba4a895', 'series': 'VIVANT', }, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) meta = self._search_json(r'w...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.786
suggestion
225
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'timestamp': ('created_at', {unified_timestamp}), 'release_timestamp': ('pub_date', {unified_timestamp}), 'duration': ('tv_episode_info', 'duration'), 'episode_number': ('tv_episode_info', 'episode_number'), 'series': ('custom_data', 'program_name'), }...
subtitles need to be returned as a dict, and the `subs` var isn't being returned at all rn ```suggestion formats, subtitles = [], {} ```
tf_path = self._search_regex( r'<script[^>]+src=["\'](/assets/tf\.[^"\']+\.js)["\']', webpage, 'stream API config') tf_js = self._download_webpage(urljoin(url, tf_path), video_id, note='Downloading stream API config') video_url = self._search_regex(r'videoPlaybackUrl:\s*[\'"]([^\'"]+...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.714
suggestion
147
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'series': ('custom_data', 'program_name'), }) tf_url = urljoin( url, self._search_regex(r'<script src=["\'](/assets/tf\.[^"\']+\.js)["\']', page, 'stream API config') ) tf_js = self._download_webpage(tf_url, video_id, note='Downloading stream API conf...
- avoid redefining built-ins like `format` - use `_merge_subtitles()` - IMO don't use `i` as var name if it's not an index value - if multiple m3u8 URLs, make m3u8 extraction non-fatal so that 1 bad URL doesn't throw ```suggestion for src in traverse_obj(source_meta, ('sources', ..., 'src')): ...
api_key = self._search_regex(r'api_key:\s*[\'"]([^\'"]+)[\'"]', tf_js, 'stream API key') try: source_meta = self._download_json(f'{video_url}ref:{video_id}', video_id, headers={'X-Streaks-Api-Key': api_key}, ...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.857
refactor
504
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
tf_url = urljoin( url, self._search_regex(r'<script src=["\'](/assets/tf\.[^"\']+\.js)["\']', page, 'stream API config') ) tf_js = self._download_webpage(tf_url, video_id, note='Downloading stream API config') video_url = self._search_regex(r'videoPlaybackUrl: *[\...
make `title` non-fatal ```suggestion 'title': try_call(lambda: get_element_text_and_html_by_tag('h3', page)[0]), ```
source_meta = self._download_json(f'{video_url}ref:{video_id}', video_id, headers={'X-Streaks-Api-Key': api_key}, note='Downloading stream metadata') except ExtractorError as e: if isinstance(e.ca...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.714
suggestion
131
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
tf_js = self._download_webpage(tf_url, video_id, note='Downloading stream API config') video_url = self._search_regex(r'videoPlaybackUrl: *[\'"]([^\'"]+)[\'"]', tf_js, 'stream API url') api_key = self._search_regex(r'api_key: *[\'"]([^\'"]+)[\'"]', tf_js, 'stream API key') try: ...
if applying above suggestions for `subtitles` ```suggestion 'subtitles': subtitles, ```
if isinstance(e.cause, HTTPError) and e.cause.status == 403: self.raise_geo_restricted(countries=['JP']) raise formats, subtitles = [], {} for src in traverse_obj(source_meta, ('sources', ..., 'src')): fmts, subs = self._extract_m3u8_formats_and_subti...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.714
suggestion
102
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
**episode_meta, 'formats': formats, 'subtitles': sub, } class TBSJPProgramIE(InfoExtractor): _VALID_URL = r'https://cu\.tbs\.co\.jp/program/(?P<id>[\d]+)' _TESTS = [{ 'url': 'https://cu.tbs.co.jp/program/23601', 'playlist_mincount': 4, 'info_...
- same regex suggestion as above extractor - it's confusing to have this var be `video_id` since it's a playlist ID and never returned as the id of anything ```suggestion program_id = self._match_id(url) page = self._download_webpage(url, program_id) meta = self._search_json('window\.app\...
}, get_all=False), 'formats': formats, 'subtitles': subtitles, } class TBSJPProgramIE(InfoExtractor): _VALID_URL = r'https?://cu\.tbs\.co\.jp/program/(?P<id>\d+)' _TESTS = [{ 'url': 'https://cu.tbs.co.jp/program/23601', 'playlist_mincount': 4, ...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.857
performance
475
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
class TBSJPProgramIE(InfoExtractor): _VALID_URL = r'https://cu\.tbs\.co\.jp/program/(?P<id>[\d]+)' _TESTS = [{ 'url': 'https://cu.tbs.co.jp/program/23601', 'playlist_mincount': 4, 'info_dict': { 'id': '23601', 'categories': ['エンタメ', 'ミライカプセル', '会社', '働く', 'バラエティ'...
`id` is another built-in. we can use `video_id` instead (if applying my above suggestion) since it makes sense here ```suggestion 'entries': [self.url_result(f'https://cu.tbs.co.jp/episode/{video_id}', TBSJPEpisodeIE, video_id) for video_id in traverse_obj(programme, ('custom_data...
class TBSJPProgramIE(InfoExtractor): _VALID_URL = r'https?://cu\.tbs\.co\.jp/program/(?P<id>\d+)' _TESTS = [{ 'url': 'https://cu.tbs.co.jp/program/23601', 'playlist_mincount': 4, 'info_dict': { 'id': '23601', 'categories': ['エンタメ', 'ミライカプセル', '会社', '働く', 'バラエティ',...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.857
suggestion
364
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
_TESTS = [{ 'url': 'https://cu.tbs.co.jp/program/23601', 'playlist_mincount': 4, 'info_dict': { 'id': '23601', 'categories': ['エンタメ', 'ミライカプセル', '会社', '働く', 'バラエティ', '動画'], 'description': '幼少期の夢は大人になって、どう成長したのだろうか?\nそしてその夢は今後、どのように広がっていくのか?\nいま話題の会社で働く人の「夢...
- wouldn't hurt to have a fallback for the playlist id - it's a good idea to call `str_or_none` if the `id` is numeric and could possibly be returned as int ```suggestion 'id': program_id, **traverse_obj(programme, { 'categories': 'keywords', 'id': ('tv_ep...
_TESTS = [{ 'url': 'https://cu.tbs.co.jp/program/23601', 'playlist_mincount': 4, 'info_dict': { 'id': '23601', 'categories': ['エンタメ', 'ミライカプセル', '会社', '働く', 'バラエティ', '動画'], 'description': '幼少期の夢は大人になって、どう成長したのだろうか?\nそしてその夢は今後、どのように広がっていくのか?\nいま話題の会社で働く人の「夢...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.857
suggestion
372
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
**traverse_obj(programme, { 'categories': 'keywords', 'id': ('tv_episode_info', 'show_content_id'), 'description': ('custom_data', 'program_description'), 'series': ('custom_data', 'program_name'), 'title': ('custom_data', 'prog...
same as above ```suggestion playlist_id = self._match_id(url) page = self._download_webpage(url, playlist_id) meta = self._search_json('window\.app\s*=', page, 'playlist info', playlist_id) playlist = traverse_obj(meta, ('falcorCache', 'playList', playlist_id)) ```
'id': programme_id, **traverse_obj(programme, { 'categories': ('keywords', ...), 'id': ('tv_episode_info', 'show_content_id', {str_or_none}), 'description': ('custom_data', 'program_description'), 'series': ('custom_data', 'program_...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.786
performance
303
51
44
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
def _real_extract(self, url): video_id = self._match_id(url) page = self._download_webpage(url, video_id) meta = self._search_json('window.app=', page, 'playlist info', video_id) playlist = traverse_obj(meta, ('falcorCache', 'playList', video_id)) entries = [] for e...
fallback id again ```suggestion '_type': 'playlist', 'id': playlist_id, **traverse_obj(playlist, { ```
from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, clean_html, get_element_text_and_html_by_tag, int_or_none, str_or_none, traverse_obj, try_call, unified_timestamp, urljoin, ) class TBSJPEpisodeIE(InfoExtractor): ...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.857
suggestion
143
33
153
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'id': '184f9970e7ba48e4915f1b252c55015e', } }] def _real_extract(self, url): video_id = self._match_id(url) page = self._download_webpage(url, video_id) meta = self._search_json('window.app=', page, 'playlist info', video_id) playlist = traverse_obj(meta, ('...
`if url:` is problematic because `url` is already the input URL, so if the first entry's `content_type` is unrecognized, the extractor will yield a recursively nested playlist. And `url` will never be falsy if `content_type` is unrecognized, because it will still have its value from the last iteration. Instead we c...
'info_dict': { 'title': 'まもなく配信終了', 'id': '184f9970e7ba48e4915f1b252c55015e', } }] def _real_extract(self, url): playlist_id = self._match_id(url) page = self._download_webpage(url, playlist_id) meta = self._search_json(r'window\.app\s*=', page, '...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
1
refactor
1,324
37
28
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'id': '23601', 'categories': ['エンタメ', 'ミライカプセル', '会社', '働く', 'バラエティ', '動画'], 'description': '幼少期の夢は大人になって、どう成長したのだろうか?\nそしてその夢は今後、どのように広がっていくのか?\nいま話題の会社で働く人の「夢の成長」を描く', 'series': 'ミライカプセル -I have a dream-', 'title': 'ミライカプセル -I have a dream-' } }]...
```suggestion }), } ```
'id': '23601', 'categories': ['エンタメ', 'ミライカプセル', '会社', '働く', 'バラエティ', '動画'], 'description': '幼少期の夢は大人になって、どう成長したのだろうか?\nそしてその夢は今後、どのように広がっていくのか?\nいま話題の会社で働く人の「夢の成長」を描く', 'series': 'ミライカプセル -I have a dream-', 'title': 'ミライカプセル -I have a dream-' } }]...
@@ -0,0 +1,161 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + traverse_obj, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(InfoExtractor): + _VALID_URL = r'https://cu\.tbs...
yt_dlp/extractor/tbsjp.py
26
Python
0.429
suggestion
46
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
meta = self._search_json(r'window\.app\s*=', webpage, 'episode info', video_id, fatal=False) episode = traverse_obj(meta, ('falcorCache', 'catalog', 'episode', video_id, 'value')) tf_path = self._search_regex( r'<script[^>]+src=["\'](/assets/tf\.[^"\']+\.js)["\']', webpage, 'stream ...
Maybe we oughtta do this too just in case ```suggestion 'title': try_call(lambda: clean_html(get_element_text_and_html_by_tag('h3', webpage)[0])), ```
video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) meta = self._search_json(r'window\.app\s*=', webpage, 'episode info', video_id, fatal=False) episode = traverse_obj(meta, ('falcorCache', 'catalog', 'episode', video_id, 'value')) tf_path = self._sear...
@@ -0,0 +1,157 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(...
yt_dlp/extractor/tbsjp.py
26
Python
0.714
suggestion
165
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
headers={'X-Streaks-Api-Key': api_key}, note='Downloading stream metadata') except ExtractorError as e: if isinstance(e.cause, HTTPError) and e.cause.status == 403: self.raise_geo_restricted(c...
- we can use `video_id` from URL as fallback here too - move `episode` inside the dict key traversal - can add some expected types ```suggestion 'id': video_id, **traverse_obj(episode, { 'categories': ('keywords', {list}) 'id': ('content_id', {str}), ...
try: source_meta = self._download_json(f'{video_url}ref:{video_id}', video_id, headers={'X-Streaks-Api-Key': api_key}, note='Downloading stream metadata') except ExtractorError as e: if is...
@@ -0,0 +1,157 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(...
yt_dlp/extractor/tbsjp.py
26
Python
1
suggestion
860
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
meta = self._search_json(r'window\.app\s*=', page, 'playlist info', playlist_id) playlist = traverse_obj(meta, ('falcorCache', 'playList', playlist_id)) entries = [] for entry in traverse_obj(playlist, ('catalogs', 'value', lambda _, v: v['content_id'])): # it's likely possi...
if we can count on the `playlist_id` extracted from the URL as being correct, then this is much simpler/cleaner: ```suggestion return self.playlist_result(entries, playlist_id, traverse_obj(playlist, ('display_name', 'value'))) ```
from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, clean_html, get_element_text_and_html_by_tag, int_or_none, str_or_none, traverse_obj, try_call, unified_timestamp, urljoin, ) class TBSJPEpisodeIE(InfoExtractor): ...
@@ -0,0 +1,157 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(...
yt_dlp/extractor/tbsjp.py
26
Python
0.857
refactor
242
27
153
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
_TESTS = [{ 'url': 'https://cu.tbs.co.jp/program/23601', 'playlist_mincount': 4, 'info_dict': { 'id': '23601', 'categories': ['エンタメ', 'ミライカプセル', '会社', '働く', 'バラエティ', '動画'], 'description': '幼少期の夢は大人になって、どう成長したのだろうか?\nそしてその夢は今後、どのように広がっていくのか?\nいま話題の会社で働く人の「夢...
not really necessary but we can make sure we're getting a list ```suggestion 'categories': ('keywords', ...), ```
class TBSJPProgramIE(InfoExtractor): _VALID_URL = r'https?://cu\.tbs\.co\.jp/program/(?P<id>\d+)' _TESTS = [{ 'url': 'https://cu.tbs.co.jp/program/23601', 'playlist_mincount': 4, 'info_dict': { 'id': '23601', 'categories': ['エンタメ', 'ミライカプセル', '会社', '働く', 'バラエティ',...
@@ -0,0 +1,157 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +class TBSJPEpisodeIE(...
yt_dlp/extractor/tbsjp.py
26
Python
0.714
suggestion
132
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
) class TBSJPEpisodeIE(InfoExtractor): _VALID_URL = r'https://cu\.tbs\.co\.jp/episode/(?P<id>[\d_]+)' _TESTS = [{ 'url': 'https://cu.tbs.co.jp/episode/23613_2044134_1000049010', 'skip': 'streams geo-restricted, Japan only. Also, will likely expire eventually', 'info_dict': { ...
if geo bypass doesn't work then we should do this so that `raise_geo_restricted` doesn't cause a retry w/xff ```suggestion _GEO_BYPASS = False ```
) class TBSJPEpisodeIE(InfoExtractor): _VALID_URL = r'https?://cu\.tbs\.co\.jp/episode/(?P<id>[\d_]+)' _GEO_BYPASS = False _TESTS = [{ 'url': 'https://cu.tbs.co.jp/episode/23613_2044134_1000049010', 'skip': 'streams geo-restricted, Japan only. Also, will likely expire eventually', ...
@@ -0,0 +1,151 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +clas...
yt_dlp/extractor/tbsjp.py
26
Python
0.786
suggestion
155
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'series': ('custom_data', 'program_name'), 'title': ('custom_data', 'program_name'), }), } class TBSJPPlaylistIE(InfoExtractor): _VALID_URL = r'https://cu\.tbs\.co\.jp/playlist/(?P<id>[\da-f]+)' _TESTS = [{ 'url': 'https://cu.tbs.co.jp/playlist/184f9...
```suggestion # TODO: it's likely possible to get most/all of the metadata from the playlist page json instead ``` Is this meant to be a todo?
'series': ('custom_data', 'program_name'), 'title': ('custom_data', 'program_name'), }), } class TBSJPPlaylistIE(InfoExtractor): _VALID_URL = r'https?://cu\.tbs\.co\.jp/playlist/(?P<id>[\da-f]+)' _TESTS = [{ 'url': 'https://cu.tbs.co.jp/playlist/184f...
@@ -0,0 +1,152 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +clas...
yt_dlp/extractor/tbsjp.py
26
Python
0.786
question
157
39
39
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
'playlist_mincount': 4, 'info_dict': { 'title': 'まもなく配信終了', 'id': '184f9970e7ba48e4915f1b252c55015e', } }] def _real_extract(self, url): playlist_id = self._match_id(url) page = self._download_webpage(url, playlist_id) meta = self._search_...
Generally use generators instead of append-loop, but don't really matter here
'playlist_mincount': 4, 'info_dict': { 'title': 'まもなく配信終了', 'id': '184f9970e7ba48e4915f1b252c55015e', } }] def _real_extract(self, url): playlist_id = self._match_id(url) page = self._download_webpage(url, playlist_id) meta = self._search_...
@@ -0,0 +1,152 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +clas...
yt_dlp/extractor/tbsjp.py
26
Python
0.286
suggestion
77
29
29
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
pukkandan
garret1317
for src in traverse_obj(source_meta, ('sources', ..., 'src')): fmts, subs = self._extract_m3u8_formats_and_subtitles(src, video_id, fatal=False) formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) return { 'title': try_call(lambda: clean_ht...
```suggestion _VALID_URL = r'https?://cu\.tbs\.co\.jp/program/(?P<id>\d+)' ```
for src in traverse_obj(source_meta, ('sources', ..., 'src')): fmts, subs = self._extract_m3u8_formats_and_subtitles(src, video_id, fatal=False) formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) return { 'title': try_call(lambda: clean_ht...
@@ -0,0 +1,152 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +clas...
yt_dlp/extractor/tbsjp.py
26
Python
0.571
suggestion
84
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
}] def _real_extract(self, url): programme_id = self._match_id(url) webpage = self._download_webpage(url, programme_id) meta = self._search_json(r'window\.app\s*=', webpage, 'programme info', programme_id) programme = traverse_obj(meta, ('falcorCache', 'catalog', 'program', pro...
```suggestion _VALID_URL = r'https?://cu\.tbs\.co\.jp/playlist/(?P<id>[\da-f]+)' ```
}] def _real_extract(self, url): programme_id = self._match_id(url) webpage = self._download_webpage(url, programme_id) meta = self._search_json(r'window\.app\s*=', webpage, 'programme info', programme_id) programme = traverse_obj(meta, ('falcorCache', 'catalog', 'program', pro...
@@ -0,0 +1,152 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +clas...
yt_dlp/extractor/tbsjp.py
26
Python
0.571
suggestion
90
51
51
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
'title': 'まもなく配信終了', 'id': '184f9970e7ba48e4915f1b252c55015e', } }] def _real_extract(self, url): playlist_id = self._match_id(url) page = self._download_webpage(url, playlist_id) meta = self._search_json(r'window\.app\s*=', page, 'playlist info', playlis...
```suggestion def entries(): for entry in traverse_obj(playlist, ('catalogs', 'value', lambda _, v: v['content_id'])): # TODO: it's likely possible to get all metadata from the playlist page json instead content_id = entry['content_id'] content_ty...
'title': 'まもなく配信終了', 'id': '184f9970e7ba48e4915f1b252c55015e', } }] def _real_extract(self, url): playlist_id = self._match_id(url) page = self._download_webpage(url, playlist_id) meta = self._search_json(r'window\.app\s*=', page, 'playlist info', playlis...
@@ -0,0 +1,152 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +clas...
yt_dlp/extractor/tbsjp.py
26
Python
1
suggestion
993
27
27
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, clean_html, get_element_text_and_html_by_tag, int_or_none, str_or_none, traverse_obj, try_call, unified_timestamp, urljoin, ) class TBSJPEpisodeIE(InfoExtractor): ...
```suggestion _VALID_URL = r'https?://cu\.tbs\.co\.jp/episode/(?P<id>[\d_]+)' ```
from .common import InfoExtractor from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, clean_html, get_element_text_and_html_by_tag, int_or_none, str_or_none, traverse_obj, try_call, unified_timestamp, urljoin, ) class TBSJPEpisodeIE(InfoExtractor): ...
@@ -0,0 +1,152 @@ +from .common import InfoExtractor +from ..networking.exceptions import HTTPError +from ..utils import ( + ExtractorError, + clean_html, + get_element_text_and_html_by_tag, + int_or_none, + str_or_none, + traverse_obj, + try_call, + unified_timestamp, + urljoin, +) + + +clas...
yt_dlp/extractor/tbsjp.py
17
Python
0.571
suggestion
87
42
42
false
TBS Free (Japan) extractor
7,765
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
@functools.cached_property def _preferred_lang(self): """ Returns a language code supported by YouTube for the user preferred language. Returns None if no preferred language set. """ preferred_lang = self._configuration_arg('lang', ie_key='Youtube', casesense=True, defaul...
Why not just: ```suggestion if cookies.get('__Secure-3PSID') or cookies.get('SOCS'): return self._set_cookie('.youtube.com', 'SOCS', 'CAI', secure=True) # accept all (required for mixes) ``` If user has exported consent cookie, we should always obey it, no?
@functools.cached_property def _preferred_lang(self): """ Returns a language code supported by YouTube for the user preferred language. Returns None if no preferred language set. """ preferred_lang = self._configuration_arg('lang', ie_key='Youtube', casesense=True, defaul...
@@ -496,16 +496,10 @@ def _initialize_consent(self): cookies = self._get_cookies('https://www.youtube.com/') if cookies.get('__Secure-3PSID'): return - consent_id = None - consent = cookies.get('CONSENT') - if consent: - if 'YES' in consent.value: - ...
yt_dlp/extractor/youtube.py
26
Python
0.857
question
294
51
51
false
[ie/youtube] Fix consent cookie
7,774
yt-dlp/yt-dlp
132,642
Python
pukkandan
coletdjnz
'id': '861362209', 'ext': 'mp4', 'title': 'Y Swn', 'description': 'md5:f7681a30e4955b250b3224aa9fe70cf0', 'duration': 5340, 'thumbnail': 'https://www.s4c.cymru/amg/1920x1080/Y_Swn_2023S4C_099_ii.jpg' }, }, { 'url': 'https://www....
snake_case ```suggestion player_config = self._download_json( ```
'id': '861362209', 'ext': 'mp4', 'title': 'Y Swn', 'description': 'md5:f7681a30e4955b250b3224aa9fe70cf0', 'duration': 5340, 'thumbnail': 'https://www.s4c.cymru/amg/1920x1080/Y_Swn_2023S4C_099_ii.jpg' }, }, { 'url': 'https://www....
@@ -30,15 +32,24 @@ def _real_extract(self, url): f'https://www.s4c.cymru/df/full_prog_details?lang=e&programme_id={video_id}', video_id, fatal=False) - filename = self._download_json( + playerConfig = self._download_json(
yt_dlp/extractor/s4c.py
26
Python
0.571
suggestion
76
51
51
false
S4C extractor:Add subtitles, thumbnail, and ability to download a series.
7,776
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
'info_dict': { 'id': '856636948', 'ext': 'mp4', 'title': 'Am Dro', 'duration': 2880, 'description': 'md5:100d8686fc9a632a0cb2db52a3433ffe', 'thumbnail': 'https://www.s4c.cymru/amg/1920x1080/Am_Dro_2022-23S4C_P6_4005.jpg' }, }] ...
metadata extraction should be non-fatal, and this can be inlined in the return ```suggestion ```
'info_dict': { 'id': '856636948', 'ext': 'mp4', 'title': 'Am Dro', 'duration': 2880, 'description': 'md5:100d8686fc9a632a0cb2db52a3433ffe', 'thumbnail': 'https://www.s4c.cymru/amg/1920x1080/Am_Dro_2022-23S4C_P6_4005.jpg' }, }] ...
@@ -30,15 +32,24 @@ def _real_extract(self, url): f'https://www.s4c.cymru/df/full_prog_details?lang=e&programme_id={video_id}', video_id, fatal=False) - filename = self._download_json( + playerConfig = self._download_json( 'https://player-api.s4c-cdn.co.uk/player-c...
yt_dlp/extractor/s4c.py
26
Python
0.643
refactor
98
51
51
false
S4C extractor:Add subtitles, thumbnail, and ability to download a series.
7,776
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
}] def _real_extract(self, url): video_id = self._match_id(url) details = self._download_json( f'https://www.s4c.cymru/df/full_prog_details?lang=e&programme_id={video_id}', video_id, fatal=False) playerConfig = self._download_json( 'https://player-ap...
extract subs safely ```suggestion subtitles = {} for sub in traverse_obj(player_config, ('subtitles', lambda _, v: url_or_none(v['0']))): subtitles.setdefault(sub.get('3', 'en'), []).append({ 'url': sub['0'], 'name': sub.get('1'), }) ``` i...
}] def _real_extract(self, url): video_id = self._match_id(url) details = self._download_json( f'https://www.s4c.cymru/df/full_prog_details?lang=e&programme_id={video_id}', video_id, fatal=False) player_config = self._download_json( 'https://player-a...
@@ -30,15 +32,24 @@ def _real_extract(self, url): f'https://www.s4c.cymru/df/full_prog_details?lang=e&programme_id={video_id}', video_id, fatal=False) - filename = self._download_json( + playerConfig = self._download_json( 'https://player-api.s4c-cdn.co.uk/player-c...
yt_dlp/extractor/s4c.py
26
Python
0.857
refactor
350
51
51
false
S4C extractor:Add subtitles, thumbnail, and ability to download a series.
7,776
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
playerConfig = self._download_json( 'https://player-api.s4c-cdn.co.uk/player-configuration/prod', video_id, query={ 'programme_id': video_id, 'signed': '0', 'lang': 'en', 'mode': 'od', 'appId': 'clic', 's...
instead of using a var we can inline it in the query here ```suggestion 'filename': player_config['filename'], ```
player_config = self._download_json( 'https://player-api.s4c-cdn.co.uk/player-configuration/prod', video_id, query={ 'programme_id': video_id, 'signed': '0', 'lang': 'en', 'mode': 'od', 'appId': 'clic', '...
@@ -48,15 +59,57 @@ def _real_extract(self, url): 'thirdParty': 'false', 'filename': filename,
yt_dlp/extractor/s4c.py
26
Python
0.786
suggestion
133
51
51
false
S4C extractor:Add subtitles, thumbnail, and ability to download a series.
7,776
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
'streamName': '', }, note='Downloading player config JSON') thumbnail = playerConfig['poster'] subtitlesList = playerConfig['subtitles'] subtitles = {} for i in subtitlesList: subtitles[i['3']] = [{'url': i['0']}] filename = playerConfig[...
inline when possible ```suggestion return { 'id': video_id, 'formats': self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', m3u8_id='hls'), 'subtitles': subtitles, 'thumbnail': url_or_none(player_config.get('poster')), ```
'streamName': '', }, note='Downloading player config JSON') subtitles = {} for sub in traverse_obj(player_config, ('subtitles', lambda _, v: url_or_none(v['0']))): subtitles.setdefault(sub.get('3', 'en'), []).append({ 'url': sub['0'], ...
@@ -48,15 +59,57 @@ def _real_extract(self, url): 'thirdParty': 'false', 'filename': filename, }, note='Downloading streaming urls JSON')['hls'] - formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4', m3u8_id='hls') - + form...
yt_dlp/extractor/s4c.py
26
Python
0.857
refactor
288
51
51
false
S4C extractor:Add subtitles, thumbnail, and ability to download a series.
7,776
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
} class S4CSeriesIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/series/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/series/864982911', 'playlist_mincount': 6, 'info_dict': { 'id': '864982911', 'title': 'Iaith ar Daith...
snake_case ```suggestion series_details = self._download_json( ```
class S4CSeriesIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/series/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/series/864982911', 'playlist_mincount': 6, 'info_dict': { 'id': '864982911', 'title': 'Iaith ar Daith', ...
@@ -48,15 +59,57 @@ def _real_extract(self, url): 'thirdParty': 'false', 'filename': filename, }, note='Downloading streaming urls JSON')['hls'] - formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4', m3u8_id='hls') - + form...
yt_dlp/extractor/s4c.py
26
Python
0.571
suggestion
77
44
34
false
S4C extractor:Add subtitles, thumbnail, and ability to download a series.
7,776
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
_TESTS = [{ 'url': 'https://www.s4c.cymru/clic/series/864982911', 'playlist_mincount': 6, 'info_dict': { 'id': '864982911', 'title': 'Iaith ar Daith', 'description': 'md5:e878ebf660dce89bd2ef521d7ce06397' }, }, { 'url': 'https://www.s4c...
```suggestion }, note='Downloading series details JSON') ```
'info_dict': { 'id': '864982911', 'title': 'Iaith ar Daith', 'description': 'md5:e878ebf660dce89bd2ef521d7ce06397' }, }, { 'url': 'https://www.s4c.cymru/clic/series/866852587', 'playlist_mincount': 8, 'info_dict': { 'id': '86685...
@@ -48,15 +59,57 @@ def _real_extract(self, url): 'thirdParty': 'false', 'filename': filename, }, note='Downloading streaming urls JSON')['hls'] - formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4', m3u8_id='hls') - + form...
yt_dlp/extractor/s4c.py
26
Python
0.571
suggestion
74
39
29
false
S4C extractor:Add subtitles, thumbnail, and ability to download a series.
7,776
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
'id': '866852587', 'title': 'FFIT Cymru', 'description': 'md5:abcb3c129cb68dbb6cd304fd33b07e96' }, }] def _real_extract(self, url): series_id = self._match_id(url) seriesDetails = self._download_json( 'https://www.s4c.cymru/df/series_detai...
Use `...` with traversal to branch and ensure that it will return a list We don't need a whole `episode` dict, just the ID F-strings are preferred ```suggestion return self.playlist_result( [self.url_result(f'https://www.s4c.cymru/clic/programme/{episode_id}', S4CIE, episode_id) ...
from .common import InfoExtractor from ..utils import traverse_obj, url_or_none class S4CIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?s4c\.cymru/clic/programme/(?P<id>\d+)' _TESTS = [{ 'url': 'https://www.s4c.cymru/clic/programme/861362209', 'info_dict': { 'id': '861362209'...
@@ -48,15 +59,57 @@ def _real_extract(self, url): 'thirdParty': 'false', 'filename': filename, }, note='Downloading streaming urls JSON')['hls'] - formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4', m3u8_id='hls') - + form...
yt_dlp/extractor/s4c.py
26
Python
0.857
suggestion
515
27
106
false
S4C extractor:Add subtitles, thumbnail, and ability to download a series.
7,776
yt-dlp/yt-dlp
132,642
Python
bashonly
ifan-t
}, { 'url': 'https://www.litv.tv/vod/drama/content.do?brc_id=root&id=VOD00041610&isUHEnabled=true&autoPlay=1', 'md5': 'b90ff1e9f1d8f5cfcd0a44c3e2b34c7a', 'info_dict': { 'id': 'VOD00041610', 'ext': 'mp4', 'title': '花千骨第1集', 'thumbnail': r're:htt...
why was this removed? it was already being skipped
'playlist_count': 51, # 50 episodes + 1 trailer }, { 'url': 'https://www.litv.tv/vod/drama/content.do?brc_id=root&id=VOD00041610&isUHEnabled=true&autoPlay=1', 'md5': 'b90ff1e9f1d8f5cfcd0a44c3e2b34c7a', 'info_dict': { 'id': 'VOD00041610', 'ext': 'mp4', ...
@@ -5,59 +5,51 @@ ExtractorError, int_or_none, smuggle_url, - traverse_obj, unsmuggle_url, ) class LiTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?litv\.tv/(?:vod|promo)/[^/]+/(?:content\.do)?\?.*?\b(?:content_)?id=(?P<id>[^&]+)' - _URL_TEMPLATE = 'https://www.litv.tv/vod...
yt_dlp/extractor/litv.py
26
Python
0.286
question
50
51
51
false
[extractor/litv] Fix playlist and video download
7,785
yt-dlp/yt-dlp
132,642
Python
bashonly
jiru
for episode in season['episode']] return self.playlist_result(all_episodes, content_id, episode_title) def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) if ...
why send a `Content-Type` header if this is not a POST request? Also, is this request where the 405 error was happening in the linked issue? What has been done to fix/handle that?
}] def _extract_playlist(self, playlist_data, content_type): all_episodes = [ self.url_result(smuggle_url( self._URL_TEMPLATE % (content_type, episode['contentId']), {'force_noplaylist': True})) # To prevent infinite recursion for episode in trav...
@@ -68,24 +60,33 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) + if '<meta http-equiv="refresh" content="1;url=https://www.litv.tv/"' in webpage: + raise ExtractorError('No such content', expected=True) + program_info = self._parse_json(self._se...
yt_dlp/extractor/litv.py
26
Python
0.643
question
182
51
51
false
[extractor/litv] Fix playlist and video download
7,785
yt-dlp/yt-dlp
132,642
Python
bashonly
jiru
webpage = self._download_webpage(url, video_id) if '<meta http-equiv="refresh" content="1;url=https://www.litv.tv/"' in webpage: raise ExtractorError('No such content', expected=True) program_info = self._parse_json(self._search_regex( r'var\s+programInfo\s*=\s*([^;]+)'...
same question as above about the `Content-Type` header
return self.playlist_result(all_episodes, playlist_data['contentId'], playlist_data.get('title')) def _real_extract(self, url): url, smuggled_data = unsmuggle_url(url, {}) video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) if self._search_regex...
@@ -68,24 +60,33 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) + if '<meta http-equiv="refresh" content="1;url=https://www.litv.tv/"' in webpage: + raise ExtractorError('No such content', expected=True) + program_info = self._parse_json(self._se...
yt_dlp/extractor/litv.py
26
Python
0.5
suggestion
54
51
51
false
[extractor/litv] Fix playlist and video download
7,785
yt-dlp/yt-dlp
132,642
Python
bashonly
jiru
}, 'skip': 'Georestricted to Taiwan', }] def _extract_playlist(self, seasons_list, content_type): episode_title = seasons_list['title'] content_id = seasons_list['contentId'] all_episodes = [ self.url_result(smuggle_url( self._URL_TEMPLATE % ...
should we use regex to match slight variations in this pattern?
'noplaylist': True, }, 'skip': 'Georestricted to Taiwan', }, { 'url': 'https://www.litv.tv/promo/miyuezhuan/?content_id=VOD00044841&', 'md5': '88322ea132f848d6e3e18b32a832b918', 'info_dict': { 'id': 'VOD00044841', 'ext': 'mp4', ...
@@ -68,24 +60,33 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) + if '<meta http-equiv="refresh" content="1;url=https://www.litv.tv/"' in webpage: + raise ExtractorError('No such content', expected=True)
yt_dlp/extractor/litv.py
26
Python
0.286
question
63
51
51
false
[extractor/litv] Fix playlist and video download
7,785
yt-dlp/yt-dlp
132,642
Python
bashonly
jiru
'id': 'VOD00041606', 'title': '花千骨', }, 'playlist_count': 51, # 50 episodes + 1 trailer }, { 'url': 'https://www.litv.tv/vod/drama/content.do?brc_id=root&id=VOD00041610&isUHEnabled=true&autoPlay=1', 'md5': 'b90ff1e9f1d8f5cfcd0a44c3e2b34c7a', 'info_dic...
Can we change the name of the `seasons_list` var since it is not actually a `list`? It makes the code hard to read. `playlist_data` would fine, since that is the name of the var being passed to it in `_real_extract()` Also, can we inline the id and title in the `playlist_result()`?
'info_dict': { 'id': 'VOD00041606', 'title': '花千骨', }, 'playlist_count': 51, # 50 episodes + 1 trailer }, { 'url': 'https://www.litv.tv/vod/drama/content.do?brc_id=root&id=VOD00041610&isUHEnabled=true&autoPlay=1', 'md5': 'b90ff1e9f1d8f5cfcd0a44c3e2b34...
@@ -5,59 +5,51 @@ ExtractorError, int_or_none, smuggle_url, - traverse_obj, unsmuggle_url, ) class LiTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?litv\.tv/(?:vod|promo)/[^/]+/(?:content\.do)?\?.*?\b(?:content_)?id=(?P<id>[^&]+)' - _URL_TEMPLATE = 'https://www.litv.tv/vod...
yt_dlp/extractor/litv.py
26
Python
0.643
refactor
285
51
51
false
[extractor/litv] Fix playlist and video download
7,785
yt-dlp/yt-dlp
132,642
Python
bashonly
jiru
'info_dict': { 'id': 'VOD00041610', 'ext': 'mp4', 'title': '花千骨第1集', 'thumbnail': r're:https?://.*\.jpg$', 'description': '《花千骨》陸劇線上看。十六年前,平靜的村莊內,一名女嬰隨異相出生,途徑此地的蜀山掌門清虛道長算出此女命運非同一般,她體內散發的異香易招惹妖魔。一念慈悲下,他在村莊周邊設下結界阻擋妖魔入侵,讓其年滿十六後去蜀山,並賜名花千骨。', 'c...
We don't need 2 `for` loops: ```py all_episodes = [ self.url_result(smuggle_url( self._URL_TEMPLATE % (content_type, episode['contentId']), {'force_noplaylist': True})) # To prevent infinite recursion for episode in traverse_obj(playlist_data, ('s...
'md5': 'b90ff1e9f1d8f5cfcd0a44c3e2b34c7a', 'info_dict': { 'id': 'VOD00041610', 'ext': 'mp4', 'title': '花千骨第1集', 'thumbnail': r're:https?://.*\.jpg$', 'description': '《花千骨》陸劇線上看。十六年前,平靜的村莊內,一名女嬰隨異相出生,途徑此地的蜀山掌門清虛道長算出此女命運非同一般,她體內散發的異香易招惹妖魔。一念慈悲下,他...
@@ -5,59 +5,51 @@ ExtractorError, int_or_none, smuggle_url, - traverse_obj, unsmuggle_url, ) class LiTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?litv\.tv/(?:vod|promo)/[^/]+/(?:content\.do)?\?.*?\b(?:content_)?id=(?P<id>[^&]+)' - _URL_TEMPLATE = 'https://www.litv.tv/vod...
yt_dlp/extractor/litv.py
26
Python
0.929
suggestion
380
51
51
false
[extractor/litv] Fix playlist and video download
7,785
yt-dlp/yt-dlp
132,642
Python
bashonly
jiru
'episode_number': 1, }, 'params': { 'noplaylist': True, }, 'skip': 'Georestricted to Taiwan', }, { 'url': 'https://www.litv.tv/promo/miyuezhuan/?content_id=VOD00044841&', 'md5': '88322ea132f848d6e3e18b32a832b918', 'info_dict': { ...
```suggestion return self.playlist_result(all_episodes, playlist_data['contentId'], playlist_data.get('title')) ```
'episode_number': 1, }, 'params': { 'noplaylist': True, }, 'skip': 'Georestricted to Taiwan', }, { 'url': 'https://www.litv.tv/promo/miyuezhuan/?content_id=VOD00044841&', 'md5': '88322ea132f848d6e3e18b32a832b918', 'info_dict': { ...
@@ -46,20 +48,17 @@ class LiTVIE(InfoExtractor): 'title': '芈月傳第1集 霸星芈月降世楚國', 'description': '楚威王二年,太史令唐昧夜觀星象,發現霸星即將現世。王后得知霸星的預言後,想盡辦法不讓孩子順利出生,幸得莒姬相護化解危機。沒想到眾人期待下出生的霸星卻是位公主,楚威王對此失望至極。楚王后命人將女嬰丟棄河中,居然奇蹟似的被少司命像攔下,楚威王認為此女非同凡響,為她取名芈月。', }, - 'skip': 'Georestricted to Taiwan', + ...
yt_dlp/extractor/litv.py
26
Python
0.714
suggestion
125
51
51
false
[extractor/litv] Fix playlist and video download
7,785
yt-dlp/yt-dlp
132,642
Python
bashonly
jiru
if self._search_regex( r'(?i)<meta\s[^>]*http-equiv="refresh"\s[^>]*content="[0-9]+;\s*url=https://www\.litv\.tv/"', webpage, 'meta refresh redirect', default=False, group=0): raise ExtractorError('No such content', expected=True) program_info = self._parse_...
```suggestion playlist_data = self._download_json( 'https://www.litv.tv/vod/ajax/getSeriesTree', video_id, query={'seriesId': series_id}, headers={'Accept': 'application/json'}) ```
if self._search_regex( r'(?i)<meta\s[^>]*http-equiv="refresh"\s[^>]*content="[0-9]+;\s*url=https://www\.litv\.tv/"', webpage, 'meta refresh redirect', default=False, group=0): raise ExtractorError('No such content found', expected=True) program_info = self._...
@@ -68,24 +67,33 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) + if self._search_regex( + r'(?i)<meta\s[^>]*http-equiv="refresh"\s[^>]*content="[0-9]+;\s*url=https://www\.litv\.tv/"', + webpage, 'meta refresh redirect', default=False, ...
yt_dlp/extractor/litv.py
26
Python
0.786
suggestion
229
51
51
false
[extractor/litv] Fix playlist and video download
7,785
yt-dlp/yt-dlp
132,642
Python
bashonly
jiru
'title': '芈月傳第1集 霸星芈月降世楚國', 'description': '楚威王二年,太史令唐昧夜觀星象,發現霸星即將現世。王后得知霸星的預言後,想盡辦法不讓孩子順利出生,幸得莒姬相護化解危機。沒想到眾人期待下出生的霸星卻是位公主,楚威王對此失望至極。楚王后命人將女嬰丟棄河中,居然奇蹟似的被少司命像攔下,楚威王認為此女非同凡響,為她取名芈月。', }, 'skip': 'No longer exists', }] def _extract_playlist(self, playlist_data, content_type...
```suggestion raise ExtractorError('No such content found', expected=True) ```
'title': '芈月傳第1集 霸星芈月降世楚國', 'description': '楚威王二年,太史令唐昧夜觀星象,發現霸星即將現世。王后得知霸星的預言後,想盡辦法不讓孩子順利出生,幸得莒姬相護化解危機。沒想到眾人期待下出生的霸星卻是位公主,楚威王對此失望至極。楚王后命人將女嬰丟棄河中,居然奇蹟似的被少司命像攔下,楚威王認為此女非同凡響,為她取名芈月。', }, 'skip': 'No longer exists', }] def _extract_playlist(self, playlist_data, content_type...
@@ -68,24 +67,33 @@ def _real_extract(self, url): webpage = self._download_webpage(url, video_id) + if self._search_regex( + r'(?i)<meta\s[^>]*http-equiv="refresh"\s[^>]*content="[0-9]+;\s*url=https://www\.litv\.tv/"', + webpage, 'meta refresh redirect', default=False, ...
yt_dlp/extractor/litv.py
26
Python
0.786
refactor
92
51
51
false
[extractor/litv] Fix playlist and video download
7,785
yt-dlp/yt-dlp
132,642
Python
bashonly
jiru
import json from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, smuggle_url, unsmuggle_url, traverse_obj, ) class LiTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?litv\.tv/(?:vod|promo)/[^/]+/(?:content\.do)?\?.*?\b(?:content_)?id=(?P<id>[^&]+)' _...
```suggestion traverse_obj, unsmuggle_url, ```
import json from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, smuggle_url, traverse_obj, unsmuggle_url, ) class LiTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?litv\.tv/(?:vod|promo)/[^/]+/(?:content\.do)?\?.*?\b(?:content_)?id=(?P<id>[^&]+)' _...
@@ -5,32 +5,34 @@ ExtractorError, int_or_none, smuggle_url, - traverse_obj, unsmuggle_url, + traverse_obj,
yt_dlp/extractor/litv.py
9
Python
0.571
suggestion
57
34
34
false
[extractor/litv] Fix playlist and video download
7,785
yt-dlp/yt-dlp
132,642
Python
Grub4K
jiru
duration = int_or_none( current_programme.get('duration', {}).get('value')) thumbnail = None image_url = current_programme.get('image_url') if image_url: thumbnail = image_url.replace('{recipe}', 'raw') ...
You could inline and make it completely non-fatal by doing this: ```suggestion 'chapters': traverse_obj(preload_state, ( 'tracklist', 'tracks', lambda _, v: float_or_none(v['offset']['start']), { 'title': ('titles', {lambda x: join_nonempty( ...
duration = int_or_none( current_programme.get('duration', {}).get('value')) thumbnail = None image_url = current_programme.get('image_url') if image_url: thumbnail = image_url.replace('{recipe}', 'raw') ...
@@ -1128,6 +1138,7 @@ def _real_extract(self, url): 'uploader_id': network.get('id'), 'formats': formats, 'subtitles': subtitles, + 'chapters': tracklist,
yt_dlp/extractor/bbc.py
26
Python
0.857
suggestion
616
51
51
false
[BBC Sounds] Tracklist Extraction
7,788
yt-dlp/yt-dlp
132,642
Python
bashonly
garret1317
# AssertionError: Expected test_SVTPlay_jNwpV9P.mp4 to be at least 9.77KiB, but it's only 864.00B 'skip_download': True, }, }, { 'url': 'https://www.svtplay.se/video/emBxBQj', 'md5': '2382036fd6f8c994856c323fe51c426e', 'info_dict': { 'id': 'eyBd9aj...
```suggestion 'sv': 'count:3' }, ``` is good enough
}, 'skip': 'Episode is no longer available', }, { 'url': 'https://www.svtplay.se/video/emBxBQj', 'md5': '2382036fd6f8c994856c323fe51c426e', 'info_dict': { 'id': 'eyBd9aj', 'ext': 'mp4', 'title': '1. Farlig kryssning', 'timestamp...
@@ -168,6 +169,36 @@ class SVTPlayIE(SVTPlayBaseIE): # AssertionError: Expected test_SVTPlay_jNwpV9P.mp4 to be at least 9.77KiB, but it's only 864.00B 'skip_download': True, }, + }, { + 'url': 'https://www.svtplay.se/video/emBxBQj', + 'md5': '2382036fd6f8c994856c323fe...
yt_dlp/extractor/svt.py
26
Python
0.571
suggestion
83
51
51
false
[svt] Fix download of wrong episode and update test
7,789
yt-dlp/yt-dlp
132,642
Python
pukkandan
wader
'info_dict': { 'id': 'eyBd9aj', 'ext': 'mp4', 'title': '1. Farlig kryssning', 'timestamp': 1491019200, 'upload_date': '20170401', 'duration': 2566, 'thumbnail': r're:^https?://(?:.*[\.-]jpg|www.svtstatic.se/image/.*)$', ...
```suggestion 'skip_download': 'm3u8', ``` This is a known issue affecting many IEs. Extra comment isnt needed
'id': 'eyBd9aj', 'ext': 'mp4', 'title': '1. Farlig kryssning', 'timestamp': 1491019200, 'upload_date': '20170401', 'duration': 2566, 'thumbnail': r're:^https?://(?:.*[\.-]jpg|www.svtstatic.se/image/.*)$', 'age_limit': 0, ...
@@ -168,6 +169,36 @@ class SVTPlayIE(SVTPlayBaseIE): # AssertionError: Expected test_SVTPlay_jNwpV9P.mp4 to be at least 9.77KiB, but it's only 864.00B 'skip_download': True, }, + }, { + 'url': 'https://www.svtplay.se/video/emBxBQj', + 'md5': '2382036fd6f8c994856c323fe...
yt_dlp/extractor/svt.py
26
Python
0.714
suggestion
127
51
51
false
[svt] Fix download of wrong episode and update test
7,789
yt-dlp/yt-dlp
132,642
Python
pukkandan
wader
self._SVTPLAY_RE, webpage, 'embedded data', default='{}', group='json'), video_id, fatal=False) thumbnail = self._og_search_thumbnail(webpage) if data: video_info = try_get( data, lambda x: x['context']['dispatcher']['stores']['Vi...
```suggestion r'<[^>]+\bdata-rt=["\']top-area-play-button["\'][^>]+\bhref=["\'][^"\']*video/[\w-]+/[^"\']*\b(?:modalId|id)=([\w-]+)', ```
if svt_id: return self._extract_by_video_id(svt_id) webpage = self._download_webpage(url, video_id) data = self._parse_json( self._search_regex( self._SVTPLAY_RE, webpage, 'embedded data', default='{}', group='json'), video_id...
@@ -250,12 +281,8 @@ def _real_extract(self, url): if not svt_id: svt_id = self._search_regex( (r'<video[^>]+data-video-id=["\']([\da-zA-Z-]+)', - r'<[^>]+\bdata-rt=["\']top-area-play-button["\'][^>]+\bhref=["\'][^"\']*video/%s/[^"\']*\b(?:modalId|id)=([\da-zA-Z-]+...
yt_dlp/extractor/svt.py
26
Python
0.714
suggestion
156
51
51
false
[svt] Fix download of wrong episode and update test
7,789
yt-dlp/yt-dlp
132,642
Python
pukkandan
wader
info_dict.update({ 'title': data['context']['dispatcher']['stores']['MetaStore']['title'], 'thumbnail': thumbnail, }) return info_dict svt_id = try_get( data, lambda x: x['statistics']['dataLake']['conte...
TIL huh that is a handy function
data = self._parse_json( self._search_regex( self._SVTPLAY_RE, webpage, 'embedded data', default='{}', group='json'), video_id, fatal=False) thumbnail = self._og_search_thumbnail(webpage) if data: video_info = try_get( ...
@@ -247,15 +271,16 @@ def _real_extract(self, url): data, lambda x: x['statistics']['dataLake']['content']['id'], compat_str) + if not svt_id: + nextjs_data = self._search_nextjs_data(webpage, video_id, fatal=False)
yt_dlp/extractor/svt.py
26
Python
0.071
suggestion
32
51
51
false
[svt] Fix download of wrong episode and update test
7,789
yt-dlp/yt-dlp
132,642
Python
wader
wader
'md5': 'd82dd4748f55fc91957094546aaf8584', 'info_dict': { 'id': '9208205928595409235', 'ext': 'mp4', 'title': 'Marty Friedman: W:O:A 2023', 'duration': 2760 } }] def _real_extract(self, url): video_id = self._match_id(url) ...
Since https://github.com/yt-dlp/yt-dlp/pull/8504 got merged, this can be simplified to ```suggestion formats = self._extract_smil_formats(smil_url, video_id) ```
_TESTS = [{ 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', 'md5': 'd82dd4748f55fc91957094546aaf8584', 'info_dict': { 'id': '9208205928595409235', 'display_id': 'marty-friedman-woa-2023-9208205928595409235', 'ext': 'mp4', ...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor + + +class MagentaMusikIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>.*)' + + _TESTS = [{ + 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', + 'md5': 'd82dd4748f55fc91957094546aaf858...
yt_dlp/extractor/magentamusik.py
26
Python
0.786
refactor
172
34
51
false
[extractor] Add magentamusik.de
7,790
yt-dlp/yt-dlp
132,642
Python
seproDev
pwaldhauer
from .common import InfoExtractor class MagentaMusikIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>.*)' _TESTS = [{ 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', 'md5': 'd82dd4748f55fc91957094546aaf8584', 'info_dict': {...
The webpage currently uses v2. Any reason to use v3? Should use single quotes. I would also use f-strings instead and give the variable a more descriptive name.
from .common import InfoExtractor from ..utils import ExtractorError, int_or_none, join_nonempty, url_or_none from ..utils.traversal import traverse_obj class MagentaMusikIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'https://www.magentamusi...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor + + +class MagentaMusikIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>.*)' + + _TESTS = [{ + 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', + 'md5': 'd82dd4748f55fc91957094546aaf858...
yt_dlp/extractor/magentamusik.py
23
Python
0.429
suggestion
161
42
48
false
[extractor] Add magentamusik.de
7,790
yt-dlp/yt-dlp
132,642
Python
seproDev
pwaldhauer
from .common import InfoExtractor class MagentaMusikIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>.*)' _TESTS = [{ 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', 'md5': 'd82dd4748f55fc91957094546aaf8584', 'info_dict': {...
```suggestion smil_url = traverse_obj( vod_data, ('content', 'feature', 'representations', ..., 'contentPackages', ..., 'media', 'href', {url_or_none}), get_all=False) ``` Could potentially even use `get_all=True` and then iterate over all formats, in case they ever add m...
from .common import InfoExtractor from ..utils import ExtractorError, int_or_none, join_nonempty, url_or_none from ..utils.traversal import traverse_obj class MagentaMusikIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'https://www.magentamusi...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor + + +class MagentaMusikIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>.*)' + + _TESTS = [{ + 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', + 'md5': 'd82dd4748f55fc91957094546aaf858...
yt_dlp/extractor/magentamusik.py
24
Python
0.857
suggestion
349
42
49
false
[extractor] Add magentamusik.de
7,790
yt-dlp/yt-dlp
132,642
Python
seproDev
pwaldhauer
} }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) video_id = self._html_search_regex(r'"assetId":"[^\d]+([0-9]+)"', webpage, 'video_id') json = self._download_json("https://wcps.t-online.de/cvss/magentamusi...
There is some more metadata we can extract: ```suggestion 'id': video_id, 'display_id': display_id, 'formats': formats, **traverse_obj(vod_data, ('content', 'feature', 'metadata', { 'title': 'title', 'alt_title': 'originalTitle', ...
'ext': 'mp4', 'title': 'Marty Friedman: W:O:A 2023', 'alt_title': 'Konzert vom: 05.08.2023 13:00', 'duration': 2760, 'categories': ['Musikkonzert'], 'release_year': 2023, 'location': 'Deutschland', } }] def _real_extrac...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor + + +class MagentaMusikIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>.*)' + + _TESTS = [{ + 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', + 'md5': 'd82dd4748f55fc91957094546aaf858...
yt_dlp/extractor/magentamusik.py
26
Python
0.857
refactor
871
28
49
false
[extractor] Add magentamusik.de
7,790
yt-dlp/yt-dlp
132,642
Python
seproDev
pwaldhauer
from .common import InfoExtractor class MagentaMusikIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>.*)' _TESTS = [{ 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', 'md5': 'd82dd4748f55fc91957094546aaf8584', 'info_dict': {...
I would change this to be the `display_id` and also return it in the info dict. ```suggestion display_id = self._match_id(url) webpage = self._download_webpage(url, display_id ) ```
from .common import InfoExtractor from ..utils import ExtractorError, int_or_none, join_nonempty, url_or_none from ..utils.traversal import traverse_obj class MagentaMusikIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'https://www.magentamusi...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor + + +class MagentaMusikIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>.*)' + + _TESTS = [{ + 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', + 'md5': 'd82dd4748f55fc91957094546aaf858...
yt_dlp/extractor/magentamusik.py
20
Python
0.857
suggestion
201
42
45
false
[extractor] Add magentamusik.de
7,790
yt-dlp/yt-dlp
132,642
Python
seproDev
pwaldhauer
from .common import InfoExtractor class MagentaMusikIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>.*)' _TESTS = [{ 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', 'md5': 'd82dd4748f55fc91957094546aaf8584', 'info_dict': {...
Could potentially be made more robust with something like this: ```suggestion player_config = self._search_json(r'data-js-element="o-video-player__config">\s*', webpage, 'player config', display_id) if 'assetId' not in player_config: raise ExtractorError('No assetId found in player confi...
from .common import InfoExtractor from ..utils import ExtractorError, int_or_none, join_nonempty, url_or_none from ..utils.traversal import traverse_obj class MagentaMusikIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>[^/?#]+)' _TESTS = [{ 'url': 'https://www.magentamusi...
@@ -0,0 +1,41 @@ +from .common import InfoExtractor + + +class MagentaMusikIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>.*)' + + _TESTS = [{ + 'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', + 'md5': 'd82dd4748f55fc91957094546aaf858...
yt_dlp/extractor/magentamusik.py
21
Python
1
refactor
843
42
46
false
[extractor] Add magentamusik.de
7,790
yt-dlp/yt-dlp
132,642
Python
seproDev
pwaldhauer
'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', 'md5': 'd82dd4748f55fc91957094546aaf8584', 'info_dict': { 'id': '9208205928595409235', 'display_id': 'marty-friedman-woa-2023-9208205928595409235', 'ext': 'mp4', 'tit...
We could just let this `KeyError` if it's not expected; the verbose output would get the same point across
'url': 'https://www.magentamusik.de/marty-friedman-woa-2023-9208205928595409235', 'md5': 'd82dd4748f55fc91957094546aaf8584', 'info_dict': { 'id': '9208205928595409235', 'display_id': 'marty-friedman-woa-2023-9208205928595409235', 'ext': 'mp4', 'tit...
@@ -0,0 +1,61 @@ +from .common import InfoExtractor +from ..utils import ExtractorError, int_or_none, join_nonempty, url_or_none +from ..utils.traversal import traverse_obj + + +class MagentaMusikIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>[^/?#]+)' + + _TESTS = [{ + 'url...
yt_dlp/extractor/magentamusik.py
26
Python
0.714
suggestion
106
51
51
false
[extractor] Add magentamusik.de
7,790
yt-dlp/yt-dlp
132,642
Python
bashonly
pwaldhauer
'ext': 'mp4', 'title': 'Marty Friedman: W:O:A 2023', 'alt_title': 'Konzert vom: 05.08.2023 13:00', 'duration': 2760, 'categories': ['Musikkonzert'], 'release_year': 2023, 'location': 'Deutschland', } }] def _real_extrac...
seems like it would be more important to `raise ExtractorError` with an appropriate message here rather than f-stringing `None` into the url below ```suggestion video_id = traverse_obj( asset_details, ('content', 'partnerInformation', ..., 'reference', {str}), get_all=False) if not video...
'ext': 'mp4', 'title': 'Marty Friedman: W:O:A 2023', 'alt_title': 'Konzert vom: 05.08.2023 13:00', 'duration': 2760, 'categories': ['Musikkonzert'], 'release_year': 2023, 'location': 'Deutschland', } }] def _real_extrac...
@@ -0,0 +1,61 @@ +from .common import InfoExtractor +from ..utils import ExtractorError, int_or_none, join_nonempty, url_or_none +from ..utils.traversal import traverse_obj + + +class MagentaMusikIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?magentamusik\.de/(?P<id>[^/?#]+)' + + _TESTS = [{ + 'url...
yt_dlp/extractor/magentamusik.py
26
Python
1
refactor
393
48
49
false
[extractor] Add magentamusik.de
7,790
yt-dlp/yt-dlp
132,642
Python
bashonly
pwaldhauer
furl, episode, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)) else: formats.append({ 'url': furl, 'format_id': determine_ext(furl), }) for (durl, format_id, width, height, filesize) i...
```suggestion r'<span[^>]+\bid=["\']clip-title["\'][^>]*>([^<]+)', webpage, 'title', fatal=False)), ```
furl, episode, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)) else: formats.append({ 'url': furl, 'format_id': determine_ext(furl), }) for (durl, format_id, width, height, filesize) i...
@@ -67,7 +65,8 @@ def _real_extract(self, url): return { 'id': episode, - 'title': title, + 'title': clean_html(self._html_search_regex( + '<[^>]+ (?:id|ID)=["\']clip-title["\'][^>]*>([^<]+)', webpage, 'title', fatal=False)),
yt_dlp/extractor/massengeschmacktv.py
26
Python
0.714
suggestion
121
30
30
false
[massengeschmacktv] Update extractor
7,813
yt-dlp/yt-dlp
132,642
Python
bashonly
sb0stn
'id': '-67421364_456239604', 'title': 'Aria alexander manojob', 'thumbnail': r're:^https://.*\.jpg', 'ext': 'mp4', 'duration': 903, 'view_count': int, 'like_count': int, 'description': 'Aria alexander manojob', '...
If we want the iframe url/path, this is more of a sure thing ```suggestion player_path = extract_attributes(get_element_html_by_id('iplayer', webpage) or '')['src'] ``` import `extract_attributes` and `get_element_html_by_id` from utils
_TEST = { 'url': 'https://adult.noodlemagazine.com/watch/-67421364_456239604', 'md5': '9e02aa763612929d0b4b850591a9248b', 'info_dict': { 'id': '-67421364_456239604', 'title': 'Aria alexander manojob', 'thumbnail': r're:^https://.*\.jpg', 'ext':...
@@ -37,15 +38,21 @@ def _real_extract(self, url): like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None)) upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default='')) - key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=...
yt_dlp/extractor/noodlemagazine.py
26
Python
0.857
refactor
248
51
51
false
[extractor/noodlemagazine] Fix format metadata not found
7,830
yt-dlp/yt-dlp
132,642
Python
bashonly
RedDeffender
'title': 'Aria alexander manojob', 'thumbnail': r're:^https://.*\.jpg', 'ext': 'mp4', 'duration': 903, 'view_count': int, 'like_count': int, 'description': 'Aria alexander manojob', 'tags': ['aria', 'alexander', 'manojob'], ...
`urljoin` will join the `player_path` to base URL, or if the site ever uses a full URL for `player_path` instead of a relative URL, `urljoin` will use full URL ```suggestion player_iframe = self._download_webpage( urljoin('https://adult.noodlemagazine.com', player_path), video_id, 'Downloading if...
'url': 'https://adult.noodlemagazine.com/watch/-67421364_456239604', 'md5': '9e02aa763612929d0b4b850591a9248b', 'info_dict': { 'id': '-67421364_456239604', 'title': 'Aria alexander manojob', 'thumbnail': r're:^https://.*\.jpg', 'ext': 'mp4', ...
@@ -37,15 +38,21 @@ def _real_extract(self, url): like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None)) upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default='')) - key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=...
yt_dlp/extractor/noodlemagazine.py
26
Python
0.857
suggestion
365
51
51
false
[extractor/noodlemagazine] Fix format metadata not found
7,830
yt-dlp/yt-dlp
132,642
Python
bashonly
RedDeffender
'thumbnail': r're:^https://.*\.jpg', 'ext': 'mp4', 'duration': 903, 'view_count': int, 'like_count': int, 'description': 'Aria alexander manojob', 'tags': ['aria', 'alexander', 'manojob'], 'upload_date': '20190218', ...
```suggestion playlist_url = self._search_regex( r'window\.playlistUrl\s*=\s*["\']([^"\']+)["\']', player_iframe, 'playlist url') ```
'md5': '9e02aa763612929d0b4b850591a9248b', 'info_dict': { 'id': '-67421364_456239604', 'title': 'Aria alexander manojob', 'thumbnail': r're:^https://.*\.jpg', 'ext': 'mp4', 'duration': 903, 'view_count': int, 'like_count...
@@ -37,15 +38,21 @@ def _real_extract(self, url): like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None)) upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default='')) - key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=...
yt_dlp/extractor/noodlemagazine.py
26
Python
0.714
suggestion
156
51
51
false
[extractor/noodlemagazine] Fix format metadata not found
7,830
yt-dlp/yt-dlp
132,642
Python
bashonly
RedDeffender
'ext': 'mp4', 'duration': 903, 'view_count': int, 'like_count': int, 'description': 'Aria alexander manojob', 'tags': ['aria', 'alexander', 'manojob'], 'upload_date': '20190218', 'age_limit': 18 } } def _rea...
we can add the `Referer` header to this API call to prevent the 403 ```suggestion playlist_info = self._download_json( urljoin('https://adult.noodlemagazine.com', playlist_url), video_id, headers={'Referer': url}) ```
'info_dict': { 'id': '-67421364_456239604', 'title': 'Aria alexander manojob', 'thumbnail': r're:^https://.*\.jpg', 'ext': 'mp4', 'duration': 903, 'view_count': int, 'like_count': int, 'description': 'Aria alexander ...
@@ -37,15 +38,21 @@ def _real_extract(self, url): like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None)) upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default='')) - key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=...
yt_dlp/extractor/noodlemagazine.py
26
Python
0.786
suggestion
241
51
51
false
[extractor/noodlemagazine] Fix format metadata not found
7,830
yt-dlp/yt-dlp
132,642
Python
bashonly
RedDeffender
def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) title = self._og_search_title(webpage) duration = parse_duration(self._html_search_meta('video:duration', webpage, 'duration', default=None)) description = self._og_se...
let's do this instead ```py formats = traverse_obj(playlist_info, ('sources', lambda _, v: v['file'], { 'url': 'file', 'format_id': 'label', 'height': ('label', {int_or_none}), 'ext': 'type', })) ``` import `traverse_obj` from utils.traversal
'age_limit': 18 } } def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) title = self._og_search_title(webpage) duration = parse_duration(self._html_search_meta('video:duration', webpage, 'duration', def...
@@ -37,15 +38,21 @@ def _real_extract(self, url): like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None)) upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default='')) - key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=...
yt_dlp/extractor/noodlemagazine.py
26
Python
1
suggestion
315
41
45
false
[extractor/noodlemagazine] Fix format metadata not found
7,830
yt-dlp/yt-dlp
132,642
Python
bashonly
RedDeffender
from .common import InfoExtractor from ..utils import ( extract_attributes, get_element_html_by_id, int_or_none, parse_count, parse_duration, unified_strdate, urljoin, ) from ..utils.traversal import traverse_obj class NoodleMagazineIE(InfoExtractor): _VALID_URL = r'https?://(?:www|adul...
```suggestion class NoodleMagazineIE(InfoExtractor): ```
from .common import InfoExtractor from ..utils import ( extract_attributes, get_element_html_by_id, int_or_none, parse_count, parse_duration, unified_strdate, urljoin, ) from ..utils.traversal import traverse_obj class NoodleMagazineIE(InfoExtractor): _VALID_URL = r'https?://(?:www|adu...
@@ -1,10 +1,14 @@ from .common import InfoExtractor from ..utils import ( - parse_duration, + extract_attributes, + get_element_html_by_id, + int_or_none, parse_count, - unified_strdate + parse_duration, + unified_strdate, + urljoin, ) - +from ..utils.traversal import traverse_obj cla...
yt_dlp/extractor/noodlemagazine.py
14
Python
0.643
refactor
62
39
39
false
[extractor/noodlemagazine] Fix format metadata not found
7,830
yt-dlp/yt-dlp
132,642
Python
bashonly
RedDeffender
if f.get('vcodec') != 'none' and not f.get('dynamic_range'): f['dynamic_range'] = tag_dict.get('dynamic_range') if f.get('acodec') != 'none' and not f.get('audio_channels'): f['audio_channels'] = { 'stereo': 2, ...
```suggestion 'release_year': int_or_none(video_data.get('year')), ```
if not format_url: continue format_url = re.sub(r'(?<=//staragvod)(\d)', r'web\1', format_url) ext = determine_ext(format_url) current_formats, current_subs = [], {} try: if 'package:hls' in tags or ext == 'm3u8': ...
@@ -283,6 +283,7 @@ def _real_extract(self, url): return { 'id': video_id, 'title': video_data.get('title'), + 'year': video_data.get('year'),
yt_dlp/extractor/hotstar.py
26
Python
0.571
suggestion
84
51
51
false
[ie/Hotstar] year added in hotstar metadata
7,869
yt-dlp/yt-dlp
132,642
Python
bashonly
Rajeshwaran2001
'duration': 2716.333, 'subtitles': {'eng': [{'ext': 'vtt', 'protocol': 'm3u8_native'}]}, 'thumbnail': 'https://thumbnails.cbc.ca/maven_legacy/thumbnails/481/326/thumbnail.jpeg', 'uploader': 'CBCC-NEW', 'chapters': 'count:5', 'upload_date': '2023072...
- `cbcplayer:` prefix should only be matched by `CBCPlayerIE` - `.+` is too broad, we want to exclude query and fragment, yeah? ```suggestion _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(?:player/)(?!play/)(?P<id>[^?#]+)' ```
'duration': 2716.333, 'subtitles': {'eng': [{'ext': 'vtt', 'protocol': 'm3u8_native'}]}, 'thumbnail': 'https://thumbnails.cbc.ca/maven_legacy/thumbnails/481/326/thumbnail.jpeg', 'uploader': 'CBCC-NEW', 'chapters': 'count:5', 'upload_date': '2023072...
@@ -228,6 +229,63 @@ def _real_extract(self, url): } +class CBCPlayerPlaylistIE(InfoExtractor): + IE_NAME = 'cbc.ca:player:playlist' + _VALID_URL = r'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/)(?!play/))(?P<id>.+)'
yt_dlp/extractor/cbc.py
26
Python
0.857
suggestion
233
51
51
false
Added CBCPlayerPlaylistIE
7,870
yt-dlp/yt-dlp
132,642
Python
bashonly
trainman261
'_format_sort_fields': ('res', 'proto') # Prioritize direct http formats over HLS } class CBCPlayerPlaylistIE(InfoExtractor): IE_NAME = 'cbc.ca:player:playlist' _VALID_URL = r'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/)(?!play/))(?P<id>.+)' _TESTS = [{ 'url': 'https:/...
IMO use `urllib.parse.unqouote` (and add `import urllib.parse` to top of file) in case there is other percent-encoding in URL ```suggestion playlist_id = urllib.parse.unquote(self._match_id(url)).lower() ```
'_format_sort_fields': ('res', 'proto') # Prioritize direct http formats over HLS } class CBCPlayerPlaylistIE(InfoExtractor): IE_NAME = 'cbc.ca:player:playlist' _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(?:player/)(?!play/)(?P<id>[^?#]+)' _TESTS = [{ 'url': 'https://www.cbc.ca...
@@ -228,6 +229,63 @@ def _real_extract(self, url): } +class CBCPlayerPlaylistIE(InfoExtractor): + IE_NAME = 'cbc.ca:player:playlist' + _VALID_URL = r'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/)(?!play/))(?P<id>.+)' + _TESTS = [{ + 'url': 'https://www.cbc.ca/player/news/TV%20Shows/T...
yt_dlp/extractor/cbc.py
26
Python
0.857
suggestion
218
51
51
false
Added CBCPlayerPlaylistIE
7,870
yt-dlp/yt-dlp
132,642
Python
bashonly
trainman261
_TESTS = [{ 'url': 'https://www.cbc.ca/player/news/TV%20Shows/The%20National/Latest%20Broadcast', 'playlist_mincount': 25, 'info_dict': { 'id': 'news/tv shows/the national/latest broadcast', 'ie_key': 'CBCPlayer', } }, { 'url': 'https://www.cbc.ca/...
use `_search_json()` ```suggestion webpage = self._download_webpage(url, playlist_id) json_content = self._search_json( r'window\.__INITIAL_STATE__\s*=', webpage, 'initial state', playlist_id) ```
_TESTS = [{ 'url': 'https://www.cbc.ca/player/news/TV%20Shows/The%20National/Latest%20Broadcast', 'playlist_mincount': 25, 'info_dict': { 'id': 'news/tv shows/the national/latest broadcast', } }, { 'url': 'https://www.cbc.ca/player/news/Canada/North', ...
@@ -228,6 +229,63 @@ def _real_extract(self, url): } +class CBCPlayerPlaylistIE(InfoExtractor): + IE_NAME = 'cbc.ca:player:playlist' + _VALID_URL = r'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/)(?!play/))(?P<id>.+)' + _TESTS = [{ + 'url': 'https://www.cbc.ca/player/news/TV%20Shows/T...
yt_dlp/extractor/cbc.py
26
Python
0.857
suggestion
229
51
51
false
Added CBCPlayerPlaylistIE
7,870
yt-dlp/yt-dlp
132,642
Python
bashonly
trainman261
playlist_items = [] for key, value in json_content.get('video').get('clipsByCategory').items(): # We need to do a case insensitive match. If anyone has a better way, feel free to improve. if key.lower() == playlist_id: for video in value.get('items'): ...
- Do not do `a.get('b').get('c')`, use `traverse_obj(a, ('b', 'c'))` - Use `traverse_obj` with for loop, it will be non-fatal and it can be used to filter - Metadata extraction should be non-fatal (not risking a KeyError), again use `traverse_obj` here - Use `int_or_none` or `float_or_none` with metadata fields that...
return self.playlist_result(entries(), playlist_id) class CBCGemIE(InfoExtractor): IE_NAME = 'gem.cbc.ca' _VALID_URL = r'https?://gem\.cbc\.ca/(?:media/)?(?P<id>[0-9a-z-]+/s[0-9]+[a-z][0-9]+)' _TESTS = [{ # This is a normal, public, TV show video 'url': 'https://gem.cbc.ca/media/sc...
@@ -228,6 +229,63 @@ def _real_extract(self, url): } +class CBCPlayerPlaylistIE(InfoExtractor): + IE_NAME = 'cbc.ca:player:playlist' + _VALID_URL = r'(?:cbcplayer:|https?://(?:www\.)?cbc\.ca/(?:player/)(?!play/))(?P<id>.+)' + _TESTS = [{ + 'url': 'https://www.cbc.ca/player/news/TV%20Shows/T...
yt_dlp/extractor/cbc.py
26
Python
1
refactor
1,619
51
51
false
Added CBCPlayerPlaylistIE
7,870
yt-dlp/yt-dlp
132,642
Python
bashonly
trainman261
_VALID_URL = r'https?://(?:www\.)?cbc\.ca/(?:player/)(?!play/)(?P<id>[^?#]+)' _TESTS = [{ 'url': 'https://www.cbc.ca/player/news/TV%20Shows/The%20National/Latest%20Broadcast', 'playlist_mincount': 25, 'info_dict': { 'id': 'news/tv shows/the national/latest broadcast', ...
```suggestion for video_id in traverse_obj(json_content, ( 'video', 'clipsByCategory', lambda k, _: k.lower() == playlist_id, 'items', ..., 'id' )): yield self.url_result(f'https://www.cbc.ca/player/play/{video_id}', CBCPlayerIE) ```
_VALID_URL = r'https?://(?:www\.)?cbc\.ca/(?:player/)(?!play/)(?P<id>[^?#]+)' _TESTS = [{ 'url': 'https://www.cbc.ca/player/news/TV%20Shows/The%20National/Latest%20Broadcast', 'playlist_mincount': 25, 'info_dict': { 'id': 'news/tv shows/the national/latest broadcast', ...
@@ -228,6 +229,38 @@ def _real_extract(self, url): } +class CBCPlayerPlaylistIE(InfoExtractor): + IE_NAME = 'cbc.ca:player:playlist' + _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(?:player/)(?!play/)(?P<id>[^?#]+)' + _TESTS = [{ + 'url': 'https://www.cbc.ca/player/news/TV%20Shows/The%20Nation...
yt_dlp/extractor/cbc.py
26
Python
0.786
suggestion
294
51
51
false
Added CBCPlayerPlaylistIE
7,870
yt-dlp/yt-dlp
132,642
Python
bashonly
trainman261
if not fb_dtsg or not h: return check_form = { 'fb_dtsg': fb_dtsg, 'h': h, 'name_action_selected': 'dont_save', } check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form)) check_...
```suggestion r'data-sjs>({.*?ScheduledServerJS.*?})</script>', webpage)] ```
if not fb_dtsg or not h: return check_form = { 'fb_dtsg': fb_dtsg, 'h': h, 'name_action_selected': 'dont_save', } check_req = Request(self._CHECKPOINT_URL, urlencode_postdata(check_form)) check_...
@@ -401,9 +417,9 @@ def _extract_from_url(self, url, video_id): def extract_metadata(webpage): post_data = [self._parse_json(j, video_id, fatal=False) for j in re.findall( - r'handleWithCustomApplyEach\(\s*ScheduledApplyEach\s*,\s*(\{.+?\})\s*\);', webpage)] + r'dat...
yt_dlp/extractor/facebook.py
26
Python
0.571
suggestion
95
51
51
false
[extractor/Facebook] fix: Changed json data retrieval
7,890
yt-dlp/yt-dlp
132,642
Python
bashonly
ringus1