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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
class NetAppCollectionIE(NetAppBaseIE):
_VALID_URL = r'https?://media\.netapp\.com/collection/(?P<id>[0-9a-f-]+)'
_TESTS = [{
'url': 'https://media.netapp.com/collection/9820e190-f2a6-47ac-9c0a-98e5e64234a4',
'info_dict': {
'title': 'Featured sessions',
'id': '9820e190-... | Can inline
```suggestion
metadata = self._download_json(
f'https://api.media.netapp.com/client/collection/{collection_uuid}', collection_uuid)
``` | from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import parse_iso8601
from ..utils.traversal import require, traverse_obj
class NetAppBaseIE(InfoExtractor):
_BC_URL = 'https://players.brightcove.net/6255154784001/default_default/index.html?videoId={}'
@staticmethod
d... | @@ -0,0 +1,86 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class NetAppBaseIE(InfoExtractor):
+ _ACCOUNT_ID = '6255154784001'
+ _VIDEO_METADATA_URL = 'https://api.media.netapp.com/client/detail/%s'
+ _COLLECTION_METADATA_URL = 'https://api.media.netapp.com/client/collection/%s... | yt_dlp/extractor/netapp.py | 26 | Python | 0.714 | suggestion | 170 | 29 | 80 | false | [ie/NetApp] Add extractor | 15,122 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | darkstar |
class NetAppCollectionIE(NetAppBaseIE):
_VALID_URL = r'https?://media\.netapp\.com/collection/(?P<id>[0-9a-f-]+)'
_TESTS = [{
'url': 'https://media.netapp.com/collection/9820e190-f2a6-47ac-9c0a-98e5e64234a4',
'info_dict': {
'title': 'Featured sessions',
'id': '9820e190-f2... | ```suggestion
return self.playlist_result(
self._entries(metadata), collection_uuid, playlist_title=metadata.get('name'))
``` | from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import parse_iso8601
from ..utils.traversal import require, traverse_obj
class NetAppBaseIE(InfoExtractor):
_BC_URL = 'https://players.brightcove.net/6255154784001/default_default/index.html?videoId={}'
@staticmethod
d... | @@ -0,0 +1,86 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError
+
+
+class NetAppBaseIE(InfoExtractor):
+ _ACCOUNT_ID = '6255154784001'
+ _VIDEO_METADATA_URL = 'https://api.media.netapp.com/client/detail/%s'
+ _COLLECTION_METADATA_URL = 'https://api.media.netapp.com/client/collection/%s... | yt_dlp/extractor/netapp.py | 26 | Python | 0.714 | suggestion | 148 | 27 | 80 | false | [ie/NetApp] Add extractor | 15,122 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | darkstar |
from .common import InfoExtractor
from ..utils import ExtractorError
class NetAppBaseIE(InfoExtractor):
_ACCOUNT_ID = '6255154784001'
_VIDEO_METADATA_URL = 'https://api.media.netapp.com/client/detail/%s'
_COLLECTION_METADATA_URL = 'https://api.media.netapp.com/client/collection/%s'
_BC_URL = f'https:/... | ```suggestion
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import parse_iso8601
from ..utils.traversal import require, traverse_obj
``` | from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..utils import parse_iso8601
from ..utils.traversal import require, traverse_obj
class NetAppBaseIE(InfoExtractor):
_BC_URL = 'https://players.brightcove.net/6255154784001/default_default/index.html?videoId={}'
@staticmethod
d... | @@ -0,0 +1,86 @@
+from .common import InfoExtractor
+from ..utils import ExtractorError | yt_dlp/extractor/netapp.py | 2 | Python | 0.786 | refactor | 182 | 27 | 27 | false | [ie/NetApp] Add extractor | 15,122 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | darkstar |
subtitles, base_url, lang_code, lang_name, client_name, pot_params)
if not caption_track.get('isTranslatable'):
continue
for trans_code, trans_name in translation_languages.items():
if not trans_code:
... | ```suggestion
# Extract automatic captions when the language is not in 'translationLanguages'
``` | subtitles, base_url, lang_code, lang_name, client_name, pot_params)
if not caption_track.get('isTranslatable'):
continue
for trans_code, trans_name in translation_languages.items():
if not trans_code:
... | @@ -4119,6 +4123,21 @@ def process_language(container, base_url, lang_code, sub_name, client_name, quer
automatic_captions, base_url, trans_code, trans_name, client_name,
pot_params if orig_lang == orig_trans_code else {'tlang': trans_code, **pot_params})
+ ... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.786 | refactor | 115 | 51 | 51 | false | [ie/youtube] Extract all automatic caption languages | 15,156 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
'release_timestamp': live_start_time,
'_format_sort_fields': ( # source_preference is lower for potentially damaged formats
'quality', 'res', 'fps', 'hdr:12', 'source',
'vcodec:vp9.2' if 'prefer-vp9-sort' in self.get_param('compat_opts', []) else 'vcodec',
... | Wouldn't, say, `set_default_audio_lang()` have better described what it does? It's up to the caller where the `lang_code` comes froo. | 'release_timestamp': live_start_time,
'_format_sort_fields': ( # source_preference is lower for potentially damaged formats
'quality', 'res', 'fps', 'hdr:12', 'source',
'vcodec:vp9.2' if 'prefer-vp9-sort' in self.get_param('compat_opts', []) else 'vcodec',
... | @@ -4029,6 +4029,11 @@ def process_language(container, base_url, lang_code, sub_name, client_name, quer
STREAMING_DATA_CLIENT_NAME: client_name,
})
+ def set_audio_lang_from_orig_subs_lang(lang_code): | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.571 | suggestion | 133 | 51 | 51 | false | [ie/youtube] Extract all automatic caption languages | 15,156 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | bashonly |
from .common import InfoExtractor
from ..utils import unified_strdate
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=pNOyrdC8Bmu',
'info_dict': {
'id': 'pNOyrdC8Bmu',
... | Why ***all*** of these code comments? Why do we need a comment above a `_download_webpage()` call explaining that it downloads the webpage?
This style of excessive, obvious, pointless commentary is a telltale sign of LLM-generated code. Are you sure about this:
> - [X] I have read the [policy against AI/LLM contr... | from .common import InfoExtractor
from ..utils import join_nonempty, unified_strdate
from ..utils.traversal import traverse_obj
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjz... | @@ -0,0 +1,59 @@
+from .common import InfoExtractor
+from ..utils import unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=pNOyrdC8Bmu',
+ 'info_dict': {
+ ... | yt_dlp/extractor/matchitv.py | 24 | Python | 0.571 | question | 500 | 49 | 39 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=pNOyrdC8Bmu',
'info_dict': {
'id': 'pNOyrdC8Bmu',
'ext': 'mp4',
'title': str,
'thumbnail': 'https://thumbnails.padelgo.tv/pN... | No, it's almost always preferable to properly parse the JSON than to cherry-pick it with brittle regex searches. Use `_search_json()` | class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
'info_dict': {
'id': '0euhjzrxsjm',
'ext': 'mp4',
'title': 'Court 2 at Stratfo... | @@ -0,0 +1,57 @@
+from .common import InfoExtractor
+from ..utils import unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=pNOyrdC8Bmu',
+ 'info_dict': {
+ ... | yt_dlp/extractor/matchitv.py | 26 | Python | 0.571 | suggestion | 133 | 51 | 34 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
from .common import InfoExtractor
from ..utils import unified_strdate
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=pNOyrdC8Bmu',
'info_dict': {
'id': 'pNOyrdC8Bmu',
... | This is fine to do, but the comment is unnecessary and you can/should inline the f-string in the `_extract_m3u8_formats` call | from .common import InfoExtractor
from ..utils import join_nonempty, unified_strdate
from ..utils.traversal import traverse_obj
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjz... | @@ -0,0 +1,57 @@
+from .common import InfoExtractor
+from ..utils import unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=pNOyrdC8Bmu',
+ 'info_dict': {
+ ... | yt_dlp/extractor/matchitv.py | 26 | Python | 0.571 | refactor | 125 | 51 | 39 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
# The stream ID can be generated without needing any further information,
# however it does not contain any of the video metadata such as title and date.
m3u8_url = f'https://streams.padelgo.tv/v2/streams/m3u8/{video_id}/anonymous/playlist.m3u8'
thumbnail = f'https://thumbnails.padelgo.t... | inline these in the `return`
please (re-)review the coding conventions and style guide in CONTRIBUTORS.md | from .common import InfoExtractor
from ..utils import join_nonempty, unified_strdate
from ..utils.traversal import traverse_obj
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjz... | @@ -0,0 +1,57 @@
+from .common import InfoExtractor
+from ..utils import unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=pNOyrdC8Bmu',
+ 'info_dict': {
+ ... | yt_dlp/extractor/matchitv.py | 26 | Python | 0.5 | style | 108 | 35 | 39 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
from .common import InfoExtractor
from ..utils import unified_strdate
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=pNOyrdC8Bmu',
'info_dict': {
'id': 'pNOyrdC8Bmu',
... | Don't use `str` as the test values. Why even bother testing then? | from .common import InfoExtractor
from ..utils import join_nonempty, unified_strdate
from ..utils.traversal import traverse_obj
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjz... | @@ -0,0 +1,57 @@
+from .common import InfoExtractor
+from ..utils import unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=pNOyrdC8Bmu',
+ 'info_dict': {
+ ... | yt_dlp/extractor/matchitv.py | 14 | Python | 0.429 | question | 65 | 39 | 39 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
from .common import InfoExtractor
from ..utils import unified_strdate
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=pNOyrdC8Bmu',
'info_dict': {
'id': 'pNOyrdC8Bmu',
... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
``` | from .common import InfoExtractor
from ..utils import join_nonempty, unified_strdate
from ..utils.traversal import traverse_obj
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjz... | @@ -0,0 +1,57 @@
+from .common import InfoExtractor
+from ..utils import unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[A-Za-z0-9_-]+)' | yt_dlp/extractor/matchitv.py | 6 | Python | 0.571 | suggestion | 93 | 31 | 31 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
from .common import InfoExtractor
from ..utils import traverse_obj, unified_strdate
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
'info_dict': {
'id': '0euhjzrxsjm',... | ```suggestion
webpage = self._download_webpage(url, video_id)
loaded_media = traverse_obj(
self._search_nextjs_data(webpage, video_id, fatal=False),
('props', 'pageProps', 'loadedMedia', {dict})) or {}
``` | from .common import InfoExtractor
from ..utils import join_nonempty, unified_strdate
from ..utils.traversal import traverse_obj
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjz... | @@ -0,0 +1,42 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
+ 'info_dict': {
+ ... | yt_dlp/extractor/matchitv.py | 26 | Python | 0.786 | suggestion | 250 | 43 | 39 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
'info_dict': {
'id': '0euhjzrxsjm',
'ext': 'mp4',
'title': 'Court 2 at Stratford Padel Club 2024-07-13T18:32:24',
'thumbnail': 'https://thumbnails.padelgo.tv/0euhjzrxsjm.jpg',
'upload_date': '20240713',
},
}]
def _real_extract(self, ur... | import `join_nonempty` from utils:
```suggestion
start_date_time = traverse_obj(loaded_media, ('startDateTime', {str}))
return {
'id': video_id,
'title': join_nonempty(loaded_media.get('courtDescription'), start_date_time, delim=' '),
'thumbnail': f'https://th... | 'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
'info_dict': {
'id': '0euhjzrxsjm',
'ext': 'mp4',
'title': 'Court 2 at Stratford Padel Club 2024-07-13T18:32:24',
'thumbnail': 'https://thumbnails.padelgo.tv/0euhjzrxsjm.jpg',
'upload_date': '2024... | @@ -0,0 +1,42 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
+ 'info_dict': {
+ ... | yt_dlp/extractor/matchitv.py | 26 | Python | 0.857 | suggestion | 893 | 35 | 31 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
# Extract JSON data from __NEXT_DATA__ script tag
page_data = self._search_json(
r'<script[^>]+id="__NEXT_DATA__"[^>]*>', webpage, 'next data', video_id, ... | - style
- `m3u8_native` is the default `entry_protocol`
- this should not be `fatal=False` if we are barely extracting any metadata and won't have any metadata at all sometimes
```suggestion
'formats': self._extract_m3u8_formats(
f'https://streams.padelgo.tv/v2/streams/m3u8/{video_id}/a... | from .common import InfoExtractor
from ..utils import join_nonempty, unified_strdate
from ..utils.traversal import traverse_obj
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjz... | @@ -0,0 +1,42 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
+ 'info_dict': {
+ ... | yt_dlp/extractor/matchitv.py | 26 | Python | 0.857 | refactor | 399 | 28 | 39 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
from .common import InfoExtractor
from ..utils import join_nonempty, traverse_obj, unified_strdate
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
'info_dict': {
'id':... | please don't make me have to re-suggest the same thing over again
```suggestion
webpage = self._download_webpage(url, video_id)
loaded_media = traverse_obj(
self._search_nextjs_data(webpage, video_id, fatal=False),
('props', 'pageProps', 'loadedMedia', {dict})) or {}
``` | from .common import InfoExtractor
from ..utils import join_nonempty, unified_strdate
from ..utils.traversal import traverse_obj
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjz... | @@ -0,0 +1,35 @@
+from .common import InfoExtractor
+from ..utils import join_nonempty, traverse_obj, unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
+ 'info_... | yt_dlp/extractor/matchitv.py | 23 | Python | 0.786 | suggestion | 317 | 36 | 39 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
from .common import InfoExtractor
from ..utils import join_nonempty, traverse_obj, unified_strdate
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
'info_dict': {
'id':... | ```suggestion
start_date_time = traverse_obj(loaded_media, ('startDateTime', {str}))
``` | from .common import InfoExtractor
from ..utils import join_nonempty, unified_strdate
from ..utils.traversal import traverse_obj
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjz... | @@ -0,0 +1,35 @@
+from .common import InfoExtractor
+from ..utils import join_nonempty, traverse_obj, unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
+ 'info_... | yt_dlp/extractor/matchitv.py | 25 | Python | 0.571 | suggestion | 98 | 36 | 39 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
'info_dict': {
'id': '0euhjzrxsjm',
'ext': 'mp4',
'title': 'Court 2 at Stratford Padel Club 2024... | ```suggestion
'title': join_nonempty(loaded_media.get('courtDescription'), start_date_time, delim=' '),
``` |
class MatchiTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch/?\?(?:[^#]+&)?s=(?P<id>[0-9a-zA-Z]+)'
_TESTS = [{
'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
'info_dict': {
'id': '0euhjzrxsjm',
'ext': 'mp4',
'title': 'Court 2 at Strat... | @@ -0,0 +1,35 @@
+from .common import InfoExtractor
+from ..utils import join_nonempty, traverse_obj, unified_strdate
+
+
+class MatchiTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?matchi\.tv/watch\?s=(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'https://matchi.tv/watch?s=0euhjzrxsjm',
+ 'info_... | yt_dlp/extractor/matchitv.py | 26 | Python | 0.714 | suggestion | 121 | 33 | 36 | false | [ie/MatchiTV] Add extractor | 15,204 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | gseddon |
track_info = tralbum.get('trackinfo')
if not track_info:
raise ExtractorError('The page doesn\'t contain any tracks')
# Only tracks with duration info have songs
entries = [
self.url_result(
urljoin(url, t['title_link']), BandcampIE.ie_key(),
... | 1. Would match `...bandcamp.comradio?...`.
2. Captures `radio` if present, which is not used.
```suggestion
_VALID_URL = r'https?://(?:www\.)?bandcamp\.com(?:/radio)?/?\?.*?(?<[?&])show=(?P<id>\d+)'
``` | playlist_id = album_id or uploader_id
webpage = self._download_webpage(url, playlist_id)
tralbum = self._extract_data_attr(webpage, playlist_id)
track_info = tralbum.get('trackinfo')
if not track_info:
raise ExtractorError('The page doesn\'t contain any tracks')
... | @@ -411,7 +410,7 @@ def _real_extract(self, url):
class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
IE_NAME = 'Bandcamp:weekly'
- _VALID_URL = r'https?://(?:www\.)?bandcamp\.com/?\?(?:.*?&)?show=(?P<id>\d+)'
+ _VALID_URL = r'https?://(?:www\.)?bandcamp\.com/?(radio)?\?(?:.*?&)?s... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.857 | suggestion | 212 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | 0xvd |
}]
def _real_extract(self, url):
show_id = self._match_id(url)
show_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id,
'Downloading Show Data.',
data=json.dumps({'id': show_id}).encode(),
headers={
... | ```suggestion
metadata = traverse_obj(raw_metadata, (
'appData', 'shows', lambda _, mb: int(mb.get('showId')) == int(show_id),
any))
``` | },
}, {
'url': 'https://bandcamp.com/radio/?foo=bar&show=224',
'only_matching': True,
}]
def _real_extract(self, url):
show_id = self._match_id(url)
audio_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id, ... | @@ -436,45 +435,49 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.714 | suggestion | 172 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | 0xvd |
show_id = self._match_id(url)
show_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id,
'Downloading Show Data.',
data=json.dumps({'id': show_id}).encode(),
headers={
'Content-Type': 'applicati... | Redundant given subsequent `if ...`.
```suggestion
thum_id = metadata.get('imageId')
``` | 'only_matching': True,
}]
def _real_extract(self, url):
show_id = self._match_id(url)
audio_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id, 'Downloading radio show JSON',
data=json.dumps({'id': show_id}).encode(... | @@ -436,45 +435,49 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.571 | suggestion | 99 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | 0xvd |
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id,
'Downloading Show Data.',
data=json.dumps({'id': show_id}).encode(),
headers={
'Content-Type': 'application/json',
'Origin': 'https://bandcamp.com',
'Re... | Ensure the variable is set.
```suggestion
thum_url = f'https://f4.bcbits.com/img/000{thum_id}_171.jpg' if thum_id else None
```
Or use `format_field()`. |
def _real_extract(self, url):
show_id = self._match_id(url)
audio_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id, 'Downloading radio show JSON',
data=json.dumps({'id': show_id}).encode(),
headers={'Content-Type'... | @@ -436,45 +435,49 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.786 | suggestion | 164 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | 0xvd |
)
metadata = None
for mb in traverse_obj(raw_metadata, ('appData', 'shows')):
if int(mb.get('showId')) == int(show_id):
metadata = mb
audio_data = show_data['radioShowAudio']
thum_id = metadata.get('imageId') or None
if thum_id:
th... | Is it certain that the `streamUrl` will link to mp3 audio?
Consider:
* conditioning the value with `stream_url = url_or_none(stream_url)`
* using the value of `determine_ext(stream_url, default_ext='mp3')` as `ext` and in the `format_id`.
| ('appData', 'shows', lambda _, v: str(v['showId']) == show_id, any)) or {}
series_title = audio_data.get('title') or metadata.get('title')
release_timestamp = unified_timestamp(audio_data.get('date')) or unified_timestamp(metadata.get('date'))
return {
'id': show_id,
... | @@ -436,45 +435,49 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.643 | suggestion | 247 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | 0xvd |
},
}, {
'url': 'https://bandcamp.com/?blah/blah@&show=228',
'only_matching': True,
}]
def _real_extract(self, url):
show_id = self._match_id(url)
show_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id,
... | Could these nested calls both have `fatal=False`?
| 'duration': 5829.77,
},
'params': {
'format': 'mp3-128',
},
}, {
'url': 'https://bandcamp.com/radio/?foo=bar&show=224',
'only_matching': True,
}]
def _real_extract(self, url):
show_id = self._match_id(url)
audio_data = self._do... | @@ -436,45 +435,49 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.286 | question | 51 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | 0xvd |
track_info = tralbum.get('trackinfo')
if not track_info:
raise ExtractorError('The page doesn\'t contain any tracks')
# Only tracks with duration info have songs
entries = [
self.url_result(
urljoin(url, t['title_link']), BandcampIE.ie_key(),
... | Sorry, I had a missing `=`: what I meant was `r'https?://(?:www\.)?bandcamp\.com(?:/radio)?/?\?.*?(?<=[?&])show=(?P<id>\d+)'`:
* `https?://(?:www\.)?bandcamp\.com(?:/radio)?/?\?` to match the scheme://domain possibly followed by `/radio` and then possibly by `/`, before `?` that introduces the query parameter part
* ... | playlist_id = album_id or uploader_id
webpage = self._download_webpage(url, playlist_id)
tralbum = self._extract_data_attr(webpage, playlist_id)
track_info = tralbum.get('trackinfo')
if not track_info:
raise ExtractorError('The page doesn\'t contain any tracks')
... | @@ -411,7 +410,7 @@ def _real_extract(self, url):
class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
IE_NAME = 'Bandcamp:weekly'
- _VALID_URL = r'https?://(?:www\.)?bandcamp\.com/?\?(?:.*?&)?show=(?P<id>\d+)'
+ _VALID_URL = r'https?://(?:www\.)?bandcamp\.com(?:/radio)?/?.*?([?&])... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.571 | security | 537 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | 0xvd |
track_info = tralbum.get('trackinfo')
if not track_info:
raise ExtractorError('The page doesn\'t contain any tracks')
# Only tracks with duration info have songs
entries = [
self.url_result(
urljoin(url, t['title_link']), BandcampIE.ie_key(),
... | Let's change this. Because:
- When browsing the site you can only copy `https://bandcamp.com/radio?show=` URLs now
- `bandcamp.com/?show=` and `bandcamp.com?show=` URLs redirect to their `/radio?show=` equivalent, so GenericIE can handle the redirect and feed the result to this extractor
- The bogus URL format in ... | playlist_id = album_id or uploader_id
webpage = self._download_webpage(url, playlist_id)
tralbum = self._extract_data_attr(webpage, playlist_id)
track_info = tralbum.get('trackinfo')
if not track_info:
raise ExtractorError('The page doesn\'t contain any tracks')
... | @@ -411,7 +410,7 @@ def _real_extract(self, url):
class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
IE_NAME = 'Bandcamp:weekly'
- _VALID_URL = r'https?://(?:www\.)?bandcamp\.com/?\?(?:.*?&)?show=(?P<id>\d+)'
+ _VALID_URL = r'https?://(?:www\.)?bandcamp\.com(?:/radio)?/?\?.*?(?<=... | yt_dlp/extractor/bandcamp.py | 26 | Python | 1 | refactor | 621 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
raise ExtractorError('The page doesn\'t contain any tracks')
# Only tracks with duration info have songs
entries = [
self.url_result(
urljoin(url, t['title_link']), BandcampIE.ie_key(),
str_or_none(t.get('track_id') or t.get('id')), t.get('title'))... | ```suggestion
'url': 'https://bandcamp.com/radio?show=224',
```
please actually run the test, as well
and you then change the `only_matching` test URL below to:
```py
'url': 'https://bandcamp.com/radio/?foo=bar&show=224',
```
| tralbum = self._extract_data_attr(webpage, playlist_id)
track_info = tralbum.get('trackinfo')
if not track_info:
raise ExtractorError('The page doesn\'t contain any tracks')
# Only tracks with duration info have songs
entries = [
self.url_result(
... | @@ -411,7 +410,7 @@ def _real_extract(self, url):
class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
IE_NAME = 'Bandcamp:weekly'
- _VALID_URL = r'https?://(?:www\.)?bandcamp\.com/?\?(?:.*?&)?show=(?P<id>\d+)'
+ _VALID_URL = r'https?://(?:www\.)?bandcamp\.com(?:/radio)?/?\?.*?(?<=... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.857 | suggestion | 264 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'release_date': '20170404',
'series': 'Bandcamp Weekly',
'episode': 'Magic Moments',
'episode_id': '224',
},
'params': {
'format': 'mp3-128',
},
}, {
'url': 'https://bandcamp.com/?blah/blah@&show=228',
'only_matching... | - only the `content-type` header is necessary
- no hanging parentheses per the contributing guide
- conventionally the request notes are formatted like "Downloading lowercase description" without any trailing punctuation
- we don't use any of the root data, so let's skip the intermediate variable: directly access `r... | 'title': 'Bandcamp Weekly, 2017-04-04',
'description': 'md5:5d48150916e8e02d030623a48512c874',
'thumbnail': 'https://f4.bcbits.com/img/9982549_0.jpg',
'series': 'Bandcamp Weekly',
'episode_id': '224',
'release_timestamp': 1491264000,
'r... | @@ -436,45 +435,47 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 1 | suggestion | 678 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
def _real_extract(self, url):
show_id = self._match_id(url)
show_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id,
'Downloading Show Data.',
data=json.dumps({'id': show_id}).encode(),
headers={
... | remove per above suggestion
```suggestion
``` | }, {
'url': 'https://bandcamp.com/radio/?foo=bar&show=224',
'only_matching': True,
}]
def _real_extract(self, url):
show_id = self._match_id(url)
audio_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id, 'Downloadin... | @@ -436,45 +435,47 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.5 | suggestion | 47 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'Content-Type': 'application/json',
'Origin': 'https://bandcamp.com',
'Referer': 'https://bandcamp.com/',
},
)
raw_metadata = self._extract_data_attr(
self._download_webpage(
url,
show_id,
... | `duration` extraction was wrong to begin with, `duration` key is in `audio_data` not `show_data` | show_id, 'Downloading radio show JSON',
data=json.dumps({'id': show_id}).encode(),
headers={'Content-Type': 'application/json'})['radioShowAudio']
stream_url = audio_data['streamUrl']
format_id = traverse_obj(stream_url, ({parse_qs}, 'enc', -1))
encoding, _, ... | @@ -436,45 +435,47 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.429 | bug | 96 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'Downloading Show Data.',
data=json.dumps({'id': show_id}).encode(),
headers={
'Content-Type': 'application/json',
'Origin': 'https://bandcamp.com',
'Referer': 'https://bandcamp.com/',
},
)
raw_metadata = sel... | for `title` we should fall back the one available in `audio_data` | show_id = self._match_id(url)
audio_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id, 'Downloading radio show JSON',
data=json.dumps({'id': show_id}).encode(),
headers={'Content-Type': 'application/json'})['radioShowAu... | @@ -436,45 +435,47 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.429 | suggestion | 65 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
},
)
raw_metadata = self._extract_data_attr(
self._download_webpage(
url,
show_id,
'Downloading Show Metadata.',
), show_id, 'blob',
)
metadata = traverse_obj(raw_metadata, (
'appData', 'shows... | don't add `timestamp` if you're just duplicating `release_date`
I would change `release_date` to `release_timestamp` and add a fallback to the value given in `audio_data` |
stream_url = audio_data['streamUrl']
format_id = traverse_obj(stream_url, ({parse_qs}, 'enc', -1))
encoding, _, bitrate_str = (format_id or '').partition('-')
webpage = self._download_webpage(url, show_id, fatal=False)
metadata = traverse_obj(
self._extract_data_att... | @@ -436,45 +435,47 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.571 | suggestion | 173 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'Downloading Show Metadata.',
), show_id, 'blob',
)
metadata = traverse_obj(raw_metadata, (
'appData', 'shows', lambda _, mb: int(mb.get('showId')) == int(show_id),
any))
audio_data = show_data['radioShowAudio']
thum_id = metadata.get(... | You don't need to set `format_id` if there's only ever 1 format
Putting the `show_id` in the `format_id` isn't helpful anyways | metadata = traverse_obj(
self._extract_data_attr(webpage, show_id, 'blob', fatal=False),
('appData', 'shows', lambda _, v: str(v['showId']) == show_id, any)) or {}
series_title = audio_data.get('title') or metadata.get('title')
release_timestamp = unified_timestamp(audio... | @@ -436,45 +435,47 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.5 | style | 129 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
show_id = self._match_id(url)
show_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id,
'Downloading Show Data.',
data=json.dumps({'id': show_id}).encode(),
headers={
'Content-Type': 'applicati... | The leading zeroes do not appear to be necessary, and if we change `171` to `0` then we get the full size image
Import `format_field` from utils and do this:
```suggestion
thumbnail = format_field(metadata, 'imageId', 'https://f4.bcbits.com/img/%s_0.jpg', default=None)
```
This can be inlined in the retu... | 'only_matching': True,
}]
def _real_extract(self, url):
show_id = self._match_id(url)
audio_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id, 'Downloading radio show JSON',
data=json.dumps({'id': show_id}).encode(... | @@ -436,45 +435,47 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.857 | suggestion | 328 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'only_matching': True,
}]
def _real_extract(self, url):
show_id = self._match_id(url)
show_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id,
'Downloading Show Data.',
data=json.dumps({'id': show_id}).e... | Instead of transforming both to `int`, let's only transform the value whose type we are unsure of
and since we're using `.get()` below, let's default to `{}`
```suggestion
metadata = traverse_obj(raw_metadata, (
'appData', 'shows', lambda _, v: str(v['showId']) == show_id, any)) or {}
``` | 'format': 'mp3-128',
},
}, {
'url': 'https://bandcamp.com/radio/?foo=bar&show=224',
'only_matching': True,
}]
def _real_extract(self, url):
show_id = self._match_id(url)
audio_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1... | @@ -436,45 +435,47 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 1 | suggestion | 316 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
},
}, {
'url': 'https://bandcamp.com/?blah/blah@&show=228',
'only_matching': True,
}]
def _real_extract(self, url):
show_id = self._match_id(url)
show_data = self._download_json(
'https://bandcamp.com/api/bcradio_api/1/get_show',
show_id,
... | this should be non-fatal because the only values we can't also get from the API response data are the `description` and `thumbnail`
```suggestion
raw_metadata = self._extract_data_attr(
self._download_webpage(url, show_id, fatal=False), show_id, 'blob', fatal=False)
``` | 'duration': 5829.77,
},
'params': {
'format': 'mp3-128',
},
}, {
'url': 'https://bandcamp.com/radio/?foo=bar&show=224',
'only_matching': True,
}]
def _real_extract(self, url):
show_id = self._match_id(url)
audio_data = self._do... | @@ -436,45 +435,47 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
def _real_extract(self, url):
show_id = self._match_id(url)
- webpage = self._download_webpage(url, show_id)
-
- blob = self._extract_data_attr(webpage, show_id, 'blob')
-
- show = blo... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.857 | refactor | 294 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
}
class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
IE_NAME = 'Bandcamp:weekly'
_VALID_URL = r'https?://(?:www\.)?bandcamp\.com(?:/radio)?/?\?.*?(?<=[?&])show=(?P<id>\d+)'
_TESTS = [{
'url': 'https://bandcamp.com/radio?show=224',
'md5': '61acc9a002bed9398... | I meant that you should remove this
```suggestion
```
then reapply my `_VALID_URL` suggestion | 'description': current.get('about'),
'entries': entries,
}
class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
IE_NAME = 'Bandcamp:weekly'
_VALID_URL = r'https?://(?:www\.)?bandcamp\.com/radio/?\?(?:[^#]+&)?show=(?P<id>\d+)'
_TESTS = [{
'url... | @@ -432,49 +432,36 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
}, {
'url': 'https://bandcamp.com/?blah/blah@&show=228',
'only_matching': True, | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.643 | refactor | 96 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
track_info = tralbum.get('trackinfo')
if not track_info:
raise ExtractorError('The page doesn\'t contain any tracks')
# Only tracks with duration info have songs
entries = [
self.url_result(
urljoin(url, t['title_link']), BandcampIE.ie_key(),
... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?bandcamp\.com/radio/?\?(?:[^#]+&)?show=(?P<id>\d+)'
``` | webpage = self._download_webpage(url, playlist_id)
tralbum = self._extract_data_attr(webpage, playlist_id)
track_info = tralbum.get('trackinfo')
if not track_info:
raise ExtractorError('The page doesn\'t contain any tracks')
# Only tracks with duration info have songs... | @@ -411,9 +411,9 @@ def _real_extract(self, url):
class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE
IE_NAME = 'Bandcamp:weekly'
- _VALID_URL = r'https?://(?:www\.)?bandcamp\.com/?\?(?:.*?&)?show=(?P<id>\d+)'
+ _VALID_URL = r'https?://(?:www\.)?bandcamp\.com(?:/radio)?/?\?.*?(?<=... | yt_dlp/extractor/bandcamp.py | 26 | Python | 0.714 | suggestion | 109 | 51 | 51 | false | [ie/bandcamp:weekly] Fix extractor | 15,208 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'clientVersion': '2.20250925.01.00',
# mweb previously did not require PO Token with this UA
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 16_7_10 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1,gzip(gfe)',
},
... | Below, in `build_innertube_clients()`, you need to add this line:
```py
ytcfg.setdefault('SUPPORTS_AD_CONTEXT', False)
```
Not sure about `SUPPORTS_AD_CONTEXT` as the name, though. It's not very obvious what it means, and it's not 1:1 with `adPlaybackContext`.
`SUPPORTS_AD_BYPASS` or `SUPPORTS_AD_PLAYB... | 'clientVersion': '2.20250925.01.00',
# mweb previously did not require PO Token with this UA
'userAgent': 'Mozilla/5.0 (iPad; CPU OS 16_7_10 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1,gzip(gfe)',
},
... | @@ -313,6 +316,7 @@ class SubsPoTokenPolicy(BasePoTokenPolicy):
),
},
'SUPPORTS_COOKIES': True,
+ 'SUPPORTS_AD_CONTEXT': True, | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.857 | suggestion | 348 | 51 | 51 | false | [ie/youtube] Request ads to not be served, take two | 15,220 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WhatAmISupposedToPutHere |
raise self.CommentsDisabled
@staticmethod
def _generate_comment_continuation(video_id):
"""
Generates initial comment section continuation token from given video id
"""
token = f'\x12\r\x12\x0b{video_id}\x18\x062\'"\x11"\x0b{video_id}0\x00x\x020\x00B\x10comments-sect... | New idea: let's keep this method simple and do the checks in the calling function:
```suggestion
@classmethod
def _generate_player_context(cls, sts=None, use_ad_playback_context=False):
``` | raise self.CommentsDisabled
@staticmethod
def _generate_comment_continuation(video_id):
"""
Generates initial comment section continuation token from given video id
"""
token = f'\x12\r\x12\x0b{video_id}\x18\x062\'"\x11"\x0b{video_id}0\x00x\x020\x00B\x10comments-sect... | @@ -2628,18 +2628,25 @@ def _real_comment_extract(contents):
def _get_checkok_params():
return {'contentCheckOk': True, 'racyCheckOk': True}
- @classmethod
- def _generate_player_context(cls, sts=None):
+ def _generate_player_context(self, client, sts=None): | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.857 | suggestion | 201 | 51 | 51 | false | [ie/youtube] Request ads to not be served, take two | 15,220 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WhatAmISupposedToPutHere |
item for item in traverse_obj(contents, (..., 'itemSectionRenderer'), default={})
if item.get('sectionIdentifier') == 'comment-item-section'), None)
yield from self._comment_entries(renderer, ytcfg, video_id)
max_comments = int_or_none(self._configuration_arg('max_co... | ```suggestion
playback_context = {
'contentPlaybackContext': context,
}
if use_ad_playback_context:
playback_context['adPlaybackContext'] = {
'pyv': True,
}
```
BTW, have you tested if also adding `'adType': 'AD_TYPE_INSTREAM'` to `a... | item for item in traverse_obj(contents, (..., 'itemSectionRenderer'), default={})
if item.get('sectionIdentifier') == 'comment-item-section'), None)
yield from self._comment_entries(renderer, ytcfg, video_id)
max_comments = int_or_none(self._configuration_arg('max_co... | @@ -2628,18 +2628,25 @@ def _real_comment_extract(contents):
def _get_checkok_params():
return {'contentCheckOk': True, 'racyCheckOk': True}
- @classmethod
- def _generate_player_context(cls, sts=None):
+ def _generate_player_context(self, client, sts=None):
context = {
'h... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 1 | suggestion | 541 | 51 | 51 | false | [ie/youtube] Request ads to not be served, take two | 15,220 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WhatAmISupposedToPutHere |
max_comments = int_or_none(self._configuration_arg('max_comments', [''])[0])
return itertools.islice(_real_comment_extract(contents), 0, max_comments)
@staticmethod
def _get_checkok_params():
return {'contentCheckOk': True, 'racyCheckOk': True}
def _generate_player_context(self, cl... | ```suggestion
**cls._get_checkok_params(),
``` | max_comments = int_or_none(self._configuration_arg('max_comments', [''])[0])
return itertools.islice(_real_comment_extract(contents), 0, max_comments)
@staticmethod
def _get_checkok_params():
return {'contentCheckOk': True, 'racyCheckOk': True}
@classmethod
def _generate_player... | @@ -2628,18 +2628,25 @@ def _real_comment_extract(contents):
def _get_checkok_params():
return {'contentCheckOk': True, 'racyCheckOk': True}
- @classmethod
- def _generate_player_context(cls, sts=None):
+ def _generate_player_context(self, client, sts=None):
context = {
'h... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.571 | suggestion | 60 | 51 | 51 | false | [ie/youtube] Request ads to not be served, take two | 15,220 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WhatAmISupposedToPutHere |
visitor_data=visitor_data,
session_index=self._extract_session_index(webpage_ytcfg, player_ytcfg),
delegated_session_id=(
self._parse_data_sync_id(data_sync_id)[0]
or self._extract_delegated_session_id(webpage_ytcfg, initial_pr, player_ytcfg)
... | the aforementioned checks can move here
```suggestion
use_ad_playback_context = (
self._configuration_arg('use_ad_playback_context', ['false'])[0] != 'false'
and traverse_obj(INNERTUBE_CLIENTS, (client, 'SUPPORTS_AD_CONTEXT', {bool})))
yt_query.update(self._generate_play... | visitor_data=visitor_data,
session_index=self._extract_session_index(webpage_ytcfg, player_ytcfg),
delegated_session_id=(
self._parse_data_sync_id(data_sync_id)[0]
or self._extract_delegated_session_id(webpage_ytcfg, initial_pr, player_ytcfg)
... | @@ -2866,7 +2873,7 @@ def _extract_player_response(self, client, video_id, webpage_ytcfg, player_ytcfg
yt_query['serviceIntegrityDimensions'] = {'poToken': po_token}
sts = self._extract_signature_timestamp(video_id, player_url, webpage_ytcfg, fatal=False) if player_url else None
- yt_quer... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.857 | suggestion | 368 | 51 | 51 | false | [ie/youtube] Request ads to not be served, take two | 15,220 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WhatAmISupposedToPutHere |
'client': {
'clientName': 'WEB_REMIX',
'clientVersion': '1.20250922.03.00',
},
},
'INNERTUBE_CONTEXT_CLIENT_NAME': 67,
'GVS_PO_TOKEN_POLICY': {
StreamingProtocol.HTTPS: GvsPoTokenPolicy(
required=True,
... | ```suggestion
'SUPPORTS_COOKIES': True,
'SUPPORTS_AD_PLAYBACK_CONTEXT': True,
``` | 'client': {
'clientName': 'WEB_REMIX',
'clientVersion': '1.20250922.03.00',
},
},
'INNERTUBE_CONTEXT_CLIENT_NAME': 67,
'GVS_PO_TOKEN_POLICY': {
StreamingProtocol.HTTPS: GvsPoTokenPolicy(
required=True,
... | @@ -156,6 +158,7 @@ class SubsPoTokenPolicy(BasePoTokenPolicy):
recommended=True,
),
},
+ 'SUPPORTS_AD_PLAYBACK_CONTEXT': True,
'SUPPORTS_COOKIES': True, | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.714 | suggestion | 100 | 51 | 51 | false | [ie/youtube] Request ads to not be served, take two | 15,220 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WhatAmISupposedToPutHere |
def _fix_embedded_ytcfg(ytcfg):
ytcfg['INNERTUBE_CONTEXT'].setdefault('thirdParty', {}).update({
'embedUrl': 'https://www.youtube.com/', # Can be any valid URL
})
def build_innertube_clients():
# From highest to lowest priority
BASE_CLIENTS = ('tv', 'web', 'mweb', 'android', 'ios')
prio... | ```suggestion
ytcfg.setdefault('SUPPORTS_COOKIES', False)
ytcfg.setdefault('SUPPORTS_AD_PLAYBACK_CONTEXT', False)
ytcfg.setdefault('PLAYER_PARAMS', None)
ytcfg.setdefault('AUTHENTICATED_USER_AGENT', None)
``` |
def _fix_embedded_ytcfg(ytcfg):
ytcfg['INNERTUBE_CONTEXT'].setdefault('thirdParty', {}).update({
'embedUrl': 'https://www.youtube.com/', # Can be any valid URL
})
def build_innertube_clients():
# From highest to lowest priority
BASE_CLIENTS = ('tv', 'web', 'mweb', 'android', 'ios')
prio... | @@ -414,6 +418,7 @@ def build_innertube_clients():
ytcfg.setdefault('SUPPORTS_COOKIES', False)
ytcfg.setdefault('PLAYER_PARAMS', None)
ytcfg.setdefault('AUTHENTICATED_USER_AGENT', None)
+ ytcfg.setdefault('SUPPORTS_AD_PLAYBACK_CONTEXT', False) | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.857 | security | 245 | 51 | 51 | false | [ie/youtube] Request ads to not be served, take two | 15,220 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WhatAmISupposedToPutHere |
self._parse_data_sync_id(data_sync_id)[1]
or self._extract_user_session_id(webpage_ytcfg, initial_pr, player_ytcfg)
),
)
yt_query = {
'videoId': video_id,
}
default_pp = traverse_obj(
INNERTUBE_CLIENTS, (_split_innertu... | ```suggestion
yt_query.update(self._generate_player_context(sts, use_ad_playback_context))
return self._extract_response(
``` | self._parse_data_sync_id(data_sync_id)[1]
or self._extract_user_session_id(webpage_ytcfg, initial_pr, player_ytcfg)
),
)
yt_query = {
'videoId': video_id,
}
default_pp = traverse_obj(
INNERTUBE_CLIENTS, (_split_innertu... | @@ -2866,7 +2873,12 @@ def _extract_player_response(self, client, video_id, webpage_ytcfg, player_ytcfg
yt_query['serviceIntegrityDimensions'] = {'poToken': po_token}
sts = self._extract_signature_timestamp(video_id, player_url, webpage_ytcfg, fatal=False) if player_url else None
- yt_que... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.786 | refactor | 146 | 51 | 51 | false | [ie/youtube] Request ads to not be served, take two | 15,220 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | WhatAmISupposedToPutHere |
'https://web.archive.org/__wb/videoinfo', video_id,
query={'vtype': 'youtube', 'vid': video_id})
if not traverse_obj(video_info, 'formats'):
self.raise_no_formats(
'The requested video is not archived or indexed', expected=True)
capture_dates = self.... | Maybe filter explicitly for dict?
```suggestion
for fmt in traverse_obj(video_info, ('formats', ({dict}, ...), lambda _, v: url_or_none(v['url']))):
``` | **self._FORMATS.get(format_id, {}),
**traverse_obj(fmt, {
'url': ('url', {lambda x: f'https://web.archive.org/web/2id_/{x}'}),
'ext': ('ext', {str}),
'filesize': ('url', {parse_qs}, 'clen', 0, {int_or_none}),
}),
**(extra_in... | @@ -1090,7 +1107,7 @@ def _real_extract(self, url):
info['thumbnails'] = self._extract_thumbnails(video_id)
formats = []
- for fmt in traverse_obj(video_info, ('formats', lambda _, v: url_or_none(v['url']))):
+ for fmt in traverse_obj(video_info, ('formats', (None, ...), lambda _, v: u... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.714 | suggestion | 160 | 40 | 51 | false | [ie/web.archive:youtube] Fix extractor | 15,234 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | seproDev |
'uploader': 'Top Hats and Champagne',
'uploader_id': 'sparrowtm',
'uploader_url': 'https://www.youtube.com/user/sparrowtm',
'channel_id': 'UCW3T5nG4iEkI7HjG-Du3HQA',
'channel_url': 'https://www.youtube.com/channel/UCW3T5nG4iEkI7HjG-Du3HQA',... | could do this, not necessary though
```suggestion
},
'params': {'format': 'bv'},
``` | 'uploader': 'Top Hats and Champagne',
'uploader_id': 'sparrowtm',
'uploader_url': 'https://www.youtube.com/user/sparrowtm',
'channel_id': 'UCW3T5nG4iEkI7HjG-Du3HQA',
'channel_url': 'https://www.youtube.com/channel/UCW3T5nG4iEkI7HjG-Du3HQA',... | @@ -704,6 +704,23 @@ class YoutubeWebArchiveIE(InfoExtractor):
'thumbnail': 'https://web.archive.org/web/20160108040020if_/https://i.ytimg.com/vi/SQCom7wjGDs/maxresdefault.jpg',
'upload_date': '20160107',
},
+ }, {
+ # dmuxed formats
+ 'url': '... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.786 | suggestion | 112 | 51 | 51 | false | [ie/web.archive:youtube] Fix extractor | 15,234 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
else:
yield {
'url': format_url,
'ext': ext,
'format_id': f'http-{format_id}',
'quality': quality,
**video_properties,
}
raw_url = self._call_url_api('raw-url', video_... | ```suggestion
def _get_subtitles(self, video_id):
subs_data = self._call_graphql_api(
'FetchVideoTranscript', video_id, 'Downloading GraphQL subtitles JSON', fatal=False)
``` | 'quality': quality,
**video_properties,
}
raw_url = self._call_url_api('raw-url', video_id)
formats.extend(get_formats(raw_url, 'raw', quality=1)) # original quality
transcoded_url = self._call_url_api('transcoded-url', video_id)
... | @@ -330,18 +344,29 @@ def get_formats(format_url, format_id, quality):
transcoded_url = self._call_url_api('transcoded-url', video_id)
formats.extend(get_formats(transcoded_url, 'transcoded', quality=-1)) # transcoded quality
- cdn_url = get_first(gql_data, ('data', 'getVideo', 'nullableRawC... | yt_dlp/extractor/loom.py | 26 | Python | 0.786 | suggestion | 202 | 51 | 51 | false | [ie/loom] Fix extractor | 15,236 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
continue
for standard_format in formats_list:
if not isinstance(standard_format, dict):
continue
for standard_format_key in ('url', 'fallback'):
sta... | `xplayerSettings2` seems to work | continue
quality = (str_or_none(standard_format.get('quality'))
or str_or_none(standard_format.get('label'))
or '')
format_id = join_n... | @@ -364,8 +357,11 @@ def get_height(s):
'height': get_height(quality),
'filesize': format_sizes.get(quality),
'http_headers': {
- 'Referer': standard_url,
+ ... | yt_dlp/extractor/xhamster.py | 26 | Python | 0.214 | suggestion | 32 | 51 | 51 | false | [ie/xhamster] Fix Decipher Error. | 15,252 | yt-dlp/yt-dlp | 132,642 | Python | dozyx | 0xvd |
class AlibabaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?alibaba\.com/product-detail/[\w-]+_(?P<id>\d+)\.html'
_TESTS = [{
'url': 'https://www.alibaba.com/product-detail/Kids-Entertainment-Bouncer-Bouncy-Castle-Waterslide_1601271126969.html',
'info_dict': {
'id': '60002804... | inline traversal in the `for` loop? |
class AlibabaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?alibaba\.com/product-detail/[\w-]+_(?P<id>\d+)\.html'
_TESTS = [{
'url': 'https://www.alibaba.com/product-detail/Kids-Entertainment-Bouncer-Bouncy-Castle-Waterslide_1601271126969.html',
'info_dict': {
'id': '60002804... | @@ -0,0 +1,46 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, url_or_none
+from ..utils.traversal import traverse_obj
+
+
+class AlibabaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?alibaba\.com/product-detail/[\w-]+_(?P<id>\d+)\.html'
+ _TESTS = [{
+ 'url': 'h... | yt_dlp/extractor/alibaba.py | 26 | Python | 0.214 | question | 35 | 44 | 40 | false | [ie/Alibaba] Add extractor | 15,253 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
product_data = self._search_json(
r'window\.detailData\s*=', webpage, 'detail data', video_id)['globalData']['product']
product_title = traverse_obj(product_data,... | do we want to enumerate the entries and append the index to the title? `-o "%(title)s.%(ext)s"` is common and as such other extractors avoid duplicate titles in playlist entries | from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, url_or_none
from ..utils.traversal import traverse_obj
class AlibabaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?alibaba\.com/product-detail/[\w-]+_(?P<id>\d+)\.html'
_TESTS = [{
'url': 'https://www.alibaba.com/pro... | @@ -0,0 +1,46 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, url_or_none
+from ..utils.traversal import traverse_obj
+
+
+class AlibabaIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?alibaba\.com/product-detail/[\w-]+_(?P<id>\d+)\.html'
+ _TESTS = [{
+ 'url': 'h... | yt_dlp/extractor/alibaba.py | 26 | Python | 0.571 | refactor | 177 | 29 | 43 | false | [ie/Alibaba] Add extractor | 15,253 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'title': 'Kyndal Inskeep "Performs the Hell Out of" Sia\'s "Elastic Heart" - The Voice Knockouts 2019',
'description': 'md5:7fe8e3d5806f96002e55f190d1d94479',
'uploader': 'The Voice',
'uploader_id': 'NBCTheVoice',
'upload_date': '20191029',... | why `fatal=False` ? this should be fatal
```suggestion
video_id, 'Downloading video JSON metadata')
``` | 'format': fmt,
'region': country.upper(),
})['query']['results']['mediaObj'][0]
msg = media_obj.get('status', {}).get('msg')
for s in media_obj.get('streams', []):
host = s.get('host')
path = s.get('path')
... | @@ -177,15 +177,16 @@ class YahooIE(InfoExtractor):
}]
def _extract_yahoo_video(self, video_id, country):
- video = self._download_json(
- f'https://{country}.yahoo.com/_td/api/resource/VideoService.videos;view=full;video_ids=["{video_id}"]',
- video_id, 'Downloading video JSON ... | yt_dlp/extractor/yahoo.py | 26 | Python | 0.786 | question | 118 | 51 | 51 | false | [ie/Yahoo] Fix extractor | 15,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'description': 'md5:7fe8e3d5806f96002e55f190d1d94479',
'uploader': 'The Voice',
'uploader_id': 'NBCTheVoice',
'upload_date': '20191029',
},
}],
'params': {
'playlistend': 2,
},
'expected_warnings': ['... | rename `meta` to `video`: this will minimize the diff | 'region': country.upper(),
})['query']['results']['mediaObj'][0]
msg = media_obj.get('status', {}).get('msg')
for s in media_obj.get('streams', []):
host = s.get('host')
path = s.get('path')
if not host or not p... | @@ -177,15 +177,16 @@ class YahooIE(InfoExtractor):
}]
def _extract_yahoo_video(self, video_id, country):
- video = self._download_json(
- f'https://{country}.yahoo.com/_td/api/resource/VideoService.videos;view=full;video_ids=["{video_id}"]',
- video_id, 'Downloading video JSON ... | yt_dlp/extractor/yahoo.py | 26 | Python | 0.429 | suggestion | 53 | 51 | 51 | false | [ie/Yahoo] Fix extractor | 15,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'uploader': 'The Voice',
'uploader_id': 'NBCTheVoice',
'upload_date': '20191029',
},
}],
'params': {
'playlistend': 2,
},
'expected_warnings': ['HTTP Error 404', 'Ignoring subtitle tracks'],
}, {
'url': '... | `title` extraction should be non-fatal and inlined in the return | })['query']['results']['mediaObj'][0]
msg = media_obj.get('status', {}).get('msg')
for s in media_obj.get('streams', []):
host = s.get('host')
path = s.get('path')
if not host or not path:
continue
... | @@ -177,15 +177,16 @@ class YahooIE(InfoExtractor):
}]
def _extract_yahoo_video(self, video_id, country):
- video = self._download_json(
- f'https://{country}.yahoo.com/_td/api/resource/VideoService.videos;view=full;video_ids=["{video_id}"]',
- video_id, 'Downloading video JSON ... | yt_dlp/extractor/yahoo.py | 26 | Python | 0.429 | refactor | 64 | 51 | 51 | false | [ie/Yahoo] Fix extractor | 15,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'subtitles': subtitles,
'duration': int_or_none(meta.get('duration')),
'view_count': int_or_none(meta.get('view_count')),
'is_live': is_live,
'series': meta.get('show_name'),
}
def _real_extract(self, url):
url, country, display_id = self.... | are you sure we can't extract these anymore? you didn't run/update the tests | else:
self.report_warning("Yahoo didn't provide an iframe url for this storywithleadvideo")
if items.get('markup'):
entries.extend(
self.url_result(yt_url) for yt_url in YoutubeIE._extract_embed_urls(url, items['markup']))
... | @@ -231,43 +232,21 @@ def _extract_yahoo_video(self, video_id, country):
'ext': mimetype2ext(cc.get('content_type')),
})
- streaming_url = video.get('streaming_url')
- if streaming_url and not is_live:
- formats.extend(self._extract_m3u8_formats(
- ... | yt_dlp/extractor/yahoo.py | 26 | Python | 0.286 | refactor | 76 | 51 | 51 | false | [ie/Yahoo] Fix extractor | 15,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
headers=self.geo_verification_headers(), query={
'format': fmt,
'region': country.upper(),
})['query']['results']['mediaObj'][0]
msg = media_obj.get('status', {}).get('msg')
for s in media_obj.get('streams', []):
... | avoid unnecessary whitespace changes like this | 'is_live': is_live,
**traverse_obj(video, {
'title': ('title', {clean_html}),
'description': ('description', {clean_html}),
'thumbnail': ('thumbnail', {url_or_none}, {update_url(scheme='https')}),
'timestamp': ('publish_time', {pars... | @@ -282,7 +261,6 @@ def _real_extract(self, url):
'Downloading content JSON metadata', query={
'url': url,
})['items'][0]
-
item = items['data']['partnerData'] | yt_dlp/extractor/yahoo.py | 26 | Python | 0.143 | nitpick | 46 | 51 | 51 | false | [ie/Yahoo] Fix extractor | 15,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'description': 'md5:7fe8e3d5806f96002e55f190d1d94479',
'uploader': 'The Voice',
'uploader_id': 'NBCTheVoice',
'upload_date': '20191029',
},
}],
'params': {
'playlistend': 2,
},
'expected_warnings': ['... | Let's get rid of the intermediate `data` var that we don't use anywhere else, and this can be fatal since we don't have anything without it
```suggestion
video = self._download_json(
f'https://video-api.yql.yahoo.com/v1/video/sapi/streams/{video_id}',
video_id, 'Downloading video JSO... | headers=self.geo_verification_headers(), query={
'format': fmt,
'region': country.upper(),
})['query']['results']['mediaObj'][0]
msg = media_obj.get('status', {}).get('msg')
for s in media_obj.get('streams', []):
... | @@ -177,15 +175,14 @@ class YahooIE(InfoExtractor):
}]
def _extract_yahoo_video(self, video_id, country):
- video = self._download_json(
- f'https://{country}.yahoo.com/_td/api/resource/VideoService.videos;view=full;video_ids=["{video_id}"]',
- video_id, 'Downloading video JSON ... | yt_dlp/extractor/yahoo.py | 26 | Python | 0.857 | suggestion | 380 | 51 | 51 | false | [ie/Yahoo] Fix extractor | 15,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
},
}],
'params': {
'playlistend': 2,
},
'expected_warnings': ['HTTP Error 404', 'Ignoring subtitle tracks'],
}, {
'url': 'https://malaysia.news.yahoo.com/video/bystanders-help-ontario-policeman-bust-190932818.html',
'only_matching': True,
}... | ```suggestion
is_live = traverse_obj(video, ('uplynk_live', {bool})) is True
``` | msg = media_obj.get('status', {}).get('msg')
for s in media_obj.get('streams', []):
host = s.get('host')
path = s.get('path')
if not host or not path:
continue
s_url = host + path
if s.get('forma... | @@ -177,15 +175,14 @@ class YahooIE(InfoExtractor):
}]
def _extract_yahoo_video(self, video_id, country):
- video = self._download_json(
- f'https://{country}.yahoo.com/_td/api/resource/VideoService.videos;view=full;video_ids=["{video_id}"]',
- video_id, 'Downloading video JSON ... | yt_dlp/extractor/yahoo.py | 26 | Python | 0.571 | suggestion | 90 | 51 | 51 | false | [ie/Yahoo] Fix extractor | 15,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
tbr = int_or_none(s.get('bitrate'))
formats.append({
'url': s_url,
'format_id': join_nonempty(fmt, tbr),
'width': int_or_none(s.get('width')),
'height': int_or_none(s.get('height')),
'tbr'... | ```suggestion
'title': traverse_obj(video, ('title', {clean_html})),
``` | def _real_extract(self, url):
url, country, display_id = self._match_valid_url(url).groups()
if not country:
country = 'us'
else:
country = country.split('-')[0]
items = self._download_json(
f'https://{country}.yahoo.com/caas/content/article', dis... | @@ -231,43 +228,21 @@ def _extract_yahoo_video(self, video_id, country):
'ext': mimetype2ext(cc.get('content_type')),
})
- streaming_url = video.get('streaming_url')
- if streaming_url and not is_live:
- formats.extend(self._extract_m3u8_formats(
- ... | yt_dlp/extractor/yahoo.py | 26 | Python | 0.571 | suggestion | 86 | 51 | 51 | false | [ie/Yahoo] Fix extractor | 15,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'format_id': join_nonempty(fmt, tbr),
'width': int_or_none(s.get('width')),
'height': int_or_none(s.get('height')),
'tbr': tbr,
'fps': int_or_none(s.get('framerate')),
})
for cc in media_obj.... | ```suggestion
'thumbnail': url_or_none(video.get('thumbnail')),
``` | country = 'us'
else:
country = country.split('-')[0]
items = self._download_json(
f'https://{country}.yahoo.com/caas/content/article', display_id,
'Downloading content JSON metadata', query={
'url': url,
})['items'][0]
... | @@ -231,43 +228,21 @@ def _extract_yahoo_video(self, video_id, country):
'ext': mimetype2ext(cc.get('content_type')),
})
- streaming_url = video.get('streaming_url')
- if streaming_url and not is_live:
- formats.extend(self._extract_m3u8_formats(
- ... | yt_dlp/extractor/yahoo.py | 26 | Python | 0.571 | suggestion | 81 | 51 | 51 | false | [ie/Yahoo] Fix extractor | 15,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
for cc in media_obj.get('closedcaptions', []):
cc_url = cc.get('url')
if not cc_url or cc_url in urls:
continue
urls.append(cc_url)
subtitles.setdefault(cc.get('lang') or 'en-US', []).append({
'url': cc_... | ```suggestion
'series': traverse_obj(video, ('show_name', {str}, filter)),
``` | 'Downloading content JSON metadata', query={
'url': url,
})['items'][0]
item = items['data']['partnerData']
if item.get('type') != 'video':
entries = []
cover = item.get('cover') or {}
if cover.get('type') == 'yvideo':
... | @@ -231,43 +228,21 @@ def _extract_yahoo_video(self, video_id, country):
'ext': mimetype2ext(cc.get('content_type')),
})
- streaming_url = video.get('streaming_url')
- if streaming_url and not is_live:
- formats.extend(self._extract_m3u8_formats(
- ... | yt_dlp/extractor/yahoo.py | 26 | Python | 0.571 | suggestion | 92 | 51 | 51 | false | [ie/Yahoo] Fix extractor | 15,314 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
next_url = episodes.get('next')
if not next_url:
break
def _real_extract(self, url):
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collecti... | ```suggestion
IE_NAME = 'nebula:season'
``` | next_url = episodes.get('next')
if not next_url:
break
def _real_extract(self, url):
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collecti... | @@ -478,3 +478,36 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:seasons' | yt_dlp/extractor/nebula.py | 26 | Python | 0.429 | suggestion | 49 | 51 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
if not next_url:
break
def _real_extract(self, url):
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collection_slug, note='Retrieving channel')
... | - the slash should not be optional
- use more obvious group names
- `[\w-]+` instead of `\w+`, per the channel name pattern above
```suggestion
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>\d+)'
``` | if not next_url:
break
def _real_extract(self, url):
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collection_slug, note='Retrieving channel')
... | @@ -478,3 +478,36 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:seasons'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<sn... | yt_dlp/extractor/nebula.py | 26 | Python | 0.857 | suggestion | 239 | 51 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:seasons'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<sn>\w+)/?season/(?P<sid>\d+)'
_TESTS = [{
'url': 'https://nebula.tv/jetlag/season/15',
... | ```suggestion
series, season_number = self._match_valid_url(url).group('series', 'season_number')
``` | playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>\d+)'
_TESTS = [{
'url': 'https://nebula.tv/jetlag/... | @@ -478,3 +478,36 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:seasons'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<sn... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | suggestion | 111 | 36 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
playlist_description=channel.get('description'))
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:seasons'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<sn>\w+)/?season/(?P<sid>\d+)'
_TESTS = [{
'url': 'https://nebula.tv/jetlag/season/15',
'info_dict': {
'id': 'jetlag_15'... | Don't use `video_id` as the name: this is a playlist, not a video
```suggestion
playlist_id = f'{series}_{season_number}'
``` | playlist_description=channel.get('description'))
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>\d+)'
_TESTS = [{
'url': 'https://nebula.tv/jetlag/season/15',
'info_dict': {
'i... | @@ -478,3 +478,36 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:seasons'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<sn... | yt_dlp/extractor/nebula.py | 26 | Python | 0.786 | suggestion | 136 | 35 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:seasons'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<sn>\w+)/?season/(?P<sid>\d+)'
_TESTS = [{
'url': 'https://nebula.tv/jetlag/season/15',
'info_dict': {
'id': 'jetlag_15',
},
'playlist_count': 6,
}, {
'url... |
```suggestion
data = self._call_api(
f'https://content.api.nebula.app/content/{series}/season/{season_number}', playlist_id)
``` | class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>\d+)'
_TESTS = [{
'url': 'https://nebula.tv/jetlag/season/15',
'info_dict': {
'id': 'jetlag_15',
'title': 'Tag: All Stars',
... | @@ -478,3 +478,36 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:seasons'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<sn... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | suggestion | 155 | 32 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'info_dict': {
'id': 'jetlag_15',
},
'playlist_count': 6,
}, {
'url': 'https://nebula.tv/jetlag/season/14',
'info_dict': {
'id': 'jetlag_14',
},
'playlist_mincount': 6,
}, {
'url': 'https://nebula.tv/jetlag/season/10',
... | For the playlist entries:
- we should use the base `_extract_video_metadata` method and return `url_transparent` results
- we should mimic the other playlist extractors' strategy of using `smuggle_data` to smuggle the `id` in the URL. If we do this along with returning the metadata in a `url_transparent` result, then... | 'info_dict': {
'id': 'jetlag_15',
'title': 'Tag: All Stars',
'description': 'md5:5aa5b8abf3de71756448dc44ffebb674',
},
'playlist_count': 8,
}, {
'url': 'https://nebula.tv/jetlag/season/14',
'info_dict': {
'id': 'jetlag_14',
... | @@ -478,3 +478,36 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:seasons'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<sn... | yt_dlp/extractor/nebula.py | 26 | Python | 0.643 | refactor | 523 | 27 | 47 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'uploader_id': 'channel_slug',
'channel': 'channel_title',
'uploader': 'channel_title',
'series': 'channel_title',
'creator': 'channel_title',
'thumbnail': ('images', 'thumbnail', 'src', {url_or_none}),
'epis... | add an `only_matching` test for this new URL format | 'uploader_id': 'channel_slug',
'channel': 'channel_title',
'uploader': 'channel_title',
'series': 'channel_title',
'creator': 'channel_title',
'thumbnail': ('images', 'thumbnail', 'src', {url_or_none}),
'epis... | @@ -125,7 +125,7 @@ def _mark_watched(self, content_id, slug):
class NebulaIE(NebulaBaseIE):
IE_NAME = 'nebula:video'
- _VALID_URL = rf'{_BASE_URL_RE}/videos/(?P<id>[\w-]+)'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?:embed/)?videos/(?P<id>[\w-]+)' | yt_dlp/extractor/nebula.py | 26 | Python | 0.357 | style | 51 | 51 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
return self.playlist_result(
entries=entries,
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:seasons'
_VALID_URL = rf'{_BASE_URL_RE}... | there's no point to an `only_matching` test if it's the same URL format as the other tests
```suggestion
}]
``` | return self.playlist_result(
entries=entries,
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/... | @@ -478,3 +478,36 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:seasons'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<sn... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | suggestion | 118 | 39 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
if not next_url:
break
def _real_extract(self, url):
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collection_slug, note='Retrieving channel')
... | why did this get reverted after applying my suggestions?
```suggestion
IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/?season/(?P<season_number>\d+)'
``` | def _real_extract(self, url):
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collection_slug, note='Retrieving channel')
if channel.get('type') == 'class':
entr... | @@ -478,3 +481,45 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:seasons'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<se... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | question | 194 | 51 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
if not next_url:
break
def _real_extract(self, url):
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collection_slug, note='Retrieving channel')
... | ```suggestion
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>\d+)'
``` | def _real_extract(self, url):
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collection_slug, note='Retrieving channel')
if channel.get('type') == 'class':
entr... | @@ -478,3 +481,48 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | suggestion | 104 | 51 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'info_dict': {
'id': 'jetlag_14',
},
'playlist_mincount': 8,
}]
def _entries(self, data):
base_url = 'https://nebula.tv'
for episode in traverse_obj(data, ('episodes')):
episode_id = traverse_obj(episode, ('video', 'id'))
metadata = se... | ```suggestion
series, season_id = self._match_valid_url(url).group('series', 'season_number')
``` | 'id': 'jetlag_14',
'title': 'Snake',
'description': 'md5:6da9040f1c2ac559579738bfb6919d1e',
},
'playlist_count': 8,
}]
def _build_url_result(self, item):
url = (
traverse_obj(item, ('share_url', {url_or_none}))
or urljoin('http... | @@ -478,3 +481,48 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | suggestion | 107 | 33 | 38 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'id': 'jetlag_14',
},
'playlist_mincount': 8,
}]
def _entries(self, data):
base_url = 'https://nebula.tv'
for episode in traverse_obj(data, ('episodes')):
episode_id = traverse_obj(episode, ('video', 'id'))
metadata = self._extract_video_metad... | ```suggestion
playlist_id = f'{series}_{season_id}'
``` | 'title': 'Snake',
'description': 'md5:6da9040f1c2ac559579738bfb6919d1e',
},
'playlist_count': 8,
}]
def _build_url_result(self, item):
url = (
traverse_obj(item, ('share_url', {url_or_none}))
or urljoin('https://nebula.tv/', item.get('app_... | @@ -478,3 +481,48 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.571 | suggestion | 65 | 32 | 37 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
def _entries(self, data):
base_url = 'https://nebula.tv'
for episode in traverse_obj(data, ('episodes')):
episode_id = traverse_obj(episode, ('video', 'id'))
metadata = self._extract_video_metadata(episode)
yield self.url_result(smuggle_url(f'{base_url}/videos/{e... | - line too long
- `series`
- don't raise here
```suggestion
data = self._call_api(
f'https://content.api.nebula.app/content/{series}/season/{season_id}', playlist_id)
``` | }]
def _build_url_result(self, item):
url = (
traverse_obj(item, ('share_url', {url_or_none}))
or urljoin('https://nebula.tv/', item.get('app_path'))
or f'https://nebula.tv/videos/{item["slug"]}')
return self.url_result(
smuggle_url(url, {'id': it... | @@ -478,3 +481,48 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | refactor | 198 | 28 | 33 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
def _entries(self, data):
base_url = 'https://nebula.tv'
for episode in traverse_obj(data, ('episodes')):
episode_id = traverse_obj(episode, ('video', 'id'))
metadata = self._extract_video_metadata(episode)
yield self.url_result(smuggle_url(f'{base_url}/videos/{ep... | - line too long
- `series`
- use `traverse_obj`
- there are `title` and `description` fields in the API response, why not just use those?
```suggestion
return self.playlist_result(
self._entries(data), playlist_id,
**traverse_obj(data, {
'title': ('title', {str}),... |
def _build_url_result(self, item):
url = (
traverse_obj(item, ('share_url', {url_or_none}))
or urljoin('https://nebula.tv/', item.get('app_path'))
or f'https://nebula.tv/videos/{item["slug"]}')
return self.url_result(
smuggle_url(url, {'id': item['id'... | @@ -478,3 +481,48 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.857 | refactor | 398 | 27 | 32 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
return self.playlist_result(
entries=entries,
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/... | IMO we could also use a `_build_url_result` method to deduplicate code
```suggestion
def _build_url_result(self, item):
url = (
traverse_obj(item, ('share_url', {url_or_none}))
or urljoin('https://nebula.tv/', item.get('app_path'))
or f'https://nebula.tv/videos/{ite... | playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>\d+)'
_TESTS = [{
'url': 'https://nebula.tv/jetlag/... | @@ -478,3 +481,48 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.857 | refactor | 551 | 51 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
entries=entries,
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/?season/(?P<season... | One of the main reasons to use `traverse_obj` when iterating over data from the web is that you can *branch* to guarantee that `traverse_obj` will return a list result (so that you don't throw a `TypeError`)
You can branch in a traversal path by using `...` (to traverse all branches), or by using a tuple of multiple... | playlist_description=channel.get('description'))
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>\d+)'
_TESTS = [{
'url': 'https://nebula.tv/jetlag/season/15',
'info_dict': {
'i... | @@ -478,3 +481,48 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 1 | refactor | 920 | 50 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/?season/(?P<season_number>\d+)'
_TESTS = [{
'url': 'https://nebula.tv/jetlag/season/15',
'info_dict': {
'id': 'jetlag_15',
},
'playlist_count': 8,
... | Now we can use the `_build_url_result` method I suggested above:
```suggestion
yield self._build_url_result(episode)
``` | IE_NAME = 'nebula:season'
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>\d+)'
_TESTS = [{
'url': 'https://nebula.tv/jetlag/season/15',
'info_dict': {
'id': 'jetlag_15',
'title': 'Tag: All Stars',
'description': 'md5:5aa5b8abf3d... | @@ -478,3 +481,48 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.786 | suggestion | 135 | 46 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
_TESTS = [{
'url': 'https://nebula.tv/jetlag/season/15',
'info_dict': {
'id': 'jetlag_15',
},
'playlist_count': 8,
}, {
'url': 'https://nebula.tv/jetlag/season/14',
'info_dict': {
'id': 'jetlag_14',
},
'playlist_mincount': 8... | Same idea here, except let's also iterate over all possible `items` instead of just grabbing the first one:
```suggestion
for extra in traverse_obj(data, ('extras', ..., 'items', lambda _, v: v['id'])):
yield self._build_url_result(extra)
``` | 'id': 'jetlag_15',
'title': 'Tag: All Stars',
'description': 'md5:5aa5b8abf3de71756448dc44ffebb674',
},
'playlist_count': 8,
}, {
'url': 'https://nebula.tv/jetlag/season/14',
'info_dict': {
'id': 'jetlag_14',
'title': 'Snake... | @@ -478,3 +481,48 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.857 | suggestion | 266 | 41 | 46 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'playlist_count': 8,
}, {
'url': 'https://nebula.tv/jetlag/season/14',
'info_dict': {
'id': 'jetlag_14',
},
'playlist_mincount': 8,
}]
def _entries(self, data):
base_url = 'https://nebula.tv/videos'
for episode in traverse_obj(data, ('epis... | ```suggestion
for trailer in traverse_obj(data, ('trailers', lambda _, v: v['id])):
yield self._build_url_result(trailer)
``` | }, {
'url': 'https://nebula.tv/jetlag/season/14',
'info_dict': {
'id': 'jetlag_14',
'title': 'Snake',
'description': 'md5:6da9040f1c2ac559579738bfb6919d1e',
},
'playlist_count': 8,
}]
def _build_url_result(self, item):
url = (
... | @@ -478,3 +481,48 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | suggestion | 148 | 36 | 41 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
def _build_url_result(self, item):
url = (
traverse_obj(item, ('share_url', {url_or_none}))
or urljoin('https://nebula.tv/', item.get('app_path'))
or f'https://nebula.tv/videos/{item["slug"]}')
return self.url_result(
smuggle_url(url, {'id': item['id'... | ```suggestion
data = self._call_api(
f'https://content.api.nebula.app/content/{series}/season/{season_id}', playlist_id)
``` | }]
def _build_url_result(self, item):
url = (
traverse_obj(item, ('share_url', {url_or_none}))
or urljoin('https://nebula.tv/', item.get('app_path'))
or f'https://nebula.tv/videos/{item["slug"]}')
return self.url_result(
smuggle_url(url, {'id': it... | @@ -478,3 +481,53 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | suggestion | 149 | 33 | 33 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
_TESTS = [{
'url': 'https://nebula.tv/jetlag/season/15',
'info_dict': {
'id': 'jetlag_15',
},
'playlist_count': 8,
}, {
'url': 'https://nebula.tv/jetlag/season/14',
'info_dict': {
'id': 'jetlag_14',
},
'playlist_mincount': 8... | this was my typo, my bad
but please make sure to test my suggestions, since I mostly am just writing them in Github's web UI and so I can't test them myself
```suggestion
for episode in traverse_obj(data, ('episodes', lambda _, v: v['video']['id'], 'video')):
``` | 'id': 'jetlag_15',
'title': 'Tag: All Stars',
'description': 'md5:5aa5b8abf3de71756448dc44ffebb674',
},
'playlist_count': 8,
}, {
'url': 'https://nebula.tv/jetlag/season/14',
'info_dict': {
'id': 'jetlag_14',
'title': 'Snake... | @@ -478,3 +481,53 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.786 | suggestion | 277 | 46 | 46 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
'id': 'e389af9d-1dab-44f2-8788-ee24deb7ff0d',
'ext': 'mp4',
'display_id': 'tldrnewseu-did-the-us-really-blow-up-the-nordstream-pipelines',
'title': 'Did the US Really Blow Up the NordStream Pipelines?',
'description': 'md5:b4e2a14e3ff08f546a3209c75261e789',
... | ```suggestion
```
save it for the proper embed extraction PR | 'id': 'e389af9d-1dab-44f2-8788-ee24deb7ff0d',
'ext': 'mp4',
'display_id': 'tldrnewseu-did-the-us-really-blow-up-the-nordstream-pipelines',
'title': 'Did the US Really Blow Up the NordStream Pipelines?',
'description': 'md5:b4e2a14e3ff08f546a3209c75261e789',
... | @@ -226,6 +226,9 @@ class NebulaIE(NebulaBaseIE):
}, {
'url': 'https://beta.nebula.tv/videos/money-episode-1-the-draw',
'only_matching': True,
+ }, {
+ 'url': 'https://nebula.tv/embed/videos/jetlag-season-16-trailer',
+ 'only_matching': True, | yt_dlp/extractor/nebula.py | 26 | Python | 0.643 | refactor | 62 | 51 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | 0xvd |
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collection_slug, note='Retrieving channel')
if channel.get('type') == 'class':
entries = self._generate_class_entries... | ```suggestion
'id': 'jetlag_15',
'title': 'Tag: All Stars',
'description': 'md5:5aa5b8abf3de71756448dc44ffebb674',
``` | collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collection_slug, note='Retrieving channel')
if channel.get('type') == 'class':
entries = self._generate_class_entries... | @@ -478,3 +478,52 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | suggestion | 158 | 51 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | 0xvd |
entries = self._generate_podcast_entries(channel['id'], collection_slug)
else:
entries = self._generate_playlist_entries(channel['id'], collection_slug)
return self.playlist_result(
entries=entries,
playlist_id=collection_slug,
playlist_title=... | the season is over
```suggestion
'id': 'jetlag_14',
'title': 'Snake',
'description': 'md5:6da9040f1c2ac559579738bfb6919d1e',
},
'playlist_count': 8,
``` | entries = self._generate_podcast_entries(channel['id'], collection_slug)
else:
entries = self._generate_playlist_entries(channel['id'], collection_slug)
return self.playlist_result(
entries=entries,
playlist_id=collection_slug,
playlist_title=... | @@ -478,3 +478,52 @@ def _real_extract(self, url):
playlist_id=collection_slug,
playlist_title=channel.get('title'),
playlist_description=channel.get('description'))
+
+
+class NebulaSeasonIE(NebulaBaseIE):
+ IE_NAME = 'nebula:season'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<ser... | yt_dlp/extractor/nebula.py | 26 | Python | 0.786 | suggestion | 211 | 51 | 51 | false | [ie/nebula:season] Add extractor | 15,347 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | 0xvd |
class NetzkinoIE(InfoExtractor):
_GEO_COUNTRIES = ['DE']
_VALID_URL = r'https?://(?:www\.)?netzkino\.de/details/(?P<id>[^/]+)'
_TESTS = [{
'url': 'https://www.netzkino.de/details/snow-beast',
'md5': '1a4c90fe40d3ccabce163287e45e56dd',
'info_dict': {
'id': 'snow-beast',
... | We can just omit this. It's the same URL format as the other test so it serves no purpose as an `only_matching` test, and I generally want to avoid checking in links to DRM-protected content. |
class NetzkinoIE(InfoExtractor):
_GEO_COUNTRIES = ['DE']
_VALID_URL = r'https?://(?:www\.)?netzkino\.de/details/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.netzkino.de/details/snow-beast',
'md5': '1a4c90fe40d3ccabce163287e45e56dd',
'info_dict': {
'id': 'snow-beast'... | @@ -2,84 +2,63 @@
from ..utils import (
clean_html,
int_or_none,
- js_to_json,
- parse_iso8601,
+ url_or_none,
+ urljoin,
)
+from ..utils.traversal import traverse_obj
class NetzkinoIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/[^/]+/(?P<id... | yt_dlp/extractor/netzkino.py | 26 | Python | 0.571 | style | 191 | 51 | 51 | false | [ie/netzkino] Rework Extractor | 15,351 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'age_limit': 12,
'alt_title': 'Snow Beast',
'cast': 'count:3',
'categories': 'count:7',
'creators': 'count:2',
'description': 'md5:e604a954a7f827a80e96a3a97d48b269',
'location': 'US',
'release_year': 2011,
'thumb... | Wouldn't it be better to have the traversal return a list?
e.g. `properties` appears to be a list like `["DRM","AVOD"]`, but if `DRM` is not the first element then the current code will result in a false negative
```suggestion
if 'DRM' in traverse_obj(query, ('licenses', 'nodes', ..., 'properties', {str}... | 'age_limit': 12,
'alt_title': 'Snow Beast',
'cast': 'count:3',
'categories': 'count:7',
'creators': 'count:2',
'description': 'md5:e604a954a7f827a80e96a3a97d48b269',
'location': 'US',
'release_year': 2011,
'thumb... | @@ -2,84 +2,63 @@
from ..utils import (
clean_html,
int_or_none,
- js_to_json,
- parse_iso8601,
+ url_or_none,
+ urljoin,
)
+from ..utils.traversal import traverse_obj
class NetzkinoIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/[^/]+/(?P<id... | yt_dlp/extractor/netzkino.py | 26 | Python | 0.857 | suggestion | 367 | 45 | 41 | false | [ie/netzkino] Rework Extractor | 15,351 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'location': 'US',
'release_year': 2011,
'thumbnail': r're:https?://.+\.jpg',
},
}, {
# DRM protected
'url': 'https://www.netzkino.de/details/second-best',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._mat... | `int_or_none` and `traverse_obj` are already doing enough filtering here
```suggestion
'age_limit': ('fskRating', {int_or_none}),
``` | 'location': 'US',
'release_year': 2011,
'thumbnail': r're:https?://.+\.jpg',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
next_js_data = self._search_nextjs_data(webpage, vi... | @@ -2,84 +2,63 @@
from ..utils import (
clean_html,
int_or_none,
- js_to_json,
- parse_iso8601,
+ url_or_none,
+ urljoin,
)
+from ..utils.traversal import traverse_obj
class NetzkinoIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/[^/]+/(?P<id... | yt_dlp/extractor/netzkino.py | 26 | Python | 0.714 | suggestion | 152 | 39 | 35 | false | [ie/netzkino] Rework Extractor | 15,351 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
}, {
# DRM protected
'url': 'https://www.netzkino.de/details/second-best',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
next_js_data = self._search_nextjs_data(webpage, ... | If you're branching in the traversal path, then you only need `filter`
```suggestion
'cast': ('cast', 'nodes', ..., 'person', 'name', {clean_html}, filter),
'creators': (('directors', 'writers'), 'nodes', ..., 'person', 'name', {clean_html}, filter),
'categories': ('c... | }]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
next_js_data = self._search_nextjs_data(webpage, video_id)
query = traverse_obj(next_js_data, (
'props', '__dehydratedState', 'queries', ..., 'state',
... | @@ -2,84 +2,63 @@
from ..utils import (
clean_html,
int_or_none,
- js_to_json,
- parse_iso8601,
+ url_or_none,
+ urljoin,
)
+from ..utils.traversal import traverse_obj
class NetzkinoIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/[^/]+/(?P<id... | yt_dlp/extractor/netzkino.py | 26 | Python | 0.929 | suggestion | 394 | 35 | 31 | false | [ie/netzkino] Rework Extractor | 15,351 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
next_js_data = self._search_nextjs_data(webpage, video_id)
query = traverse_obj(next_js_data, (
'props', '__dehydratedState', 'queries', ..., 'state',
... | ```suggestion
'url': ('videoSource', 'pmdUrl', {urljoin('https://pmd.netzkino-seite.netzkino.de/')}),
``` | from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class NetzkinoIE(InfoExtractor):
_GEO_COUNTRIES = ['DE']
_VALID_URL = r'https?://(?:www\.)?netzkino\.de/details/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -2,84 +2,63 @@
from ..utils import (
clean_html,
int_or_none,
- js_to_json,
- parse_iso8601,
+ url_or_none,
+ urljoin,
)
+from ..utils.traversal import traverse_obj
class NetzkinoIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/[^/]+/(?P<id... | yt_dlp/extractor/netzkino.py | 26 | Python | 0.714 | suggestion | 123 | 29 | 61 | false | [ie/netzkino] Rework Extractor | 15,351 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'cast': 'count:3',
'categories': 'count:7',
'creators': 'count:2',
'description': 'md5:e604a954a7f827a80e96a3a97d48b269',
'location': 'US',
'release_year': 2011,
'thumbnail': r're:https?://.+\.jpg',
},
}]
def _real_extr... | Are you trying to filter `0`? That is a valid value | 'cast': 'count:3',
'categories': 'count:7',
'creators': 'count:2',
'description': 'md5:e604a954a7f827a80e96a3a97d48b269',
'location': 'US',
'release_year': 2011,
'thumbnail': r're:https?://.+\.jpg',
},
}]
def _real_extr... | @@ -2,84 +2,59 @@
from ..utils import (
clean_html,
int_or_none,
- js_to_json,
- parse_iso8601,
+ url_or_none,
+ urljoin,
)
+from ..utils.traversal import traverse_obj
class NetzkinoIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/[^/]+/(?P<id... | yt_dlp/extractor/netzkino.py | 26 | Python | 0.357 | suggestion | 51 | 39 | 39 | false | [ie/netzkino] Rework Extractor | 15,351 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class NetzkinoIE(InfoExtractor):
_GEO_COUNTRIES = ['DE']
_VALID_URL = r'https?://(?:www\.)?netzkino\.de/details/(?P<id>[^/]+)'
_TESTS = [{
... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?netzkino\.de/details/(?P<id>[^/?#]+)'
``` | from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class NetzkinoIE(InfoExtractor):
_GEO_COUNTRIES = ['DE']
_VALID_URL = r'https?://(?:www\.)?netzkino\.de/details/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -2,84 +2,59 @@
from ..utils import (
clean_html,
int_or_none,
- js_to_json,
- parse_iso8601,
+ url_or_none,
+ urljoin,
)
+from ..utils.traversal import traverse_obj
class NetzkinoIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/[^/]+/(?P<id... | yt_dlp/extractor/netzkino.py | 13 | Python | 0.571 | suggestion | 95 | 38 | 38 | false | [ie/netzkino] Rework Extractor | 15,351 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
date_str = re.sub(r'(?i)\s*(?:AM|PM)(?:\s+[A-Z]+)?', '', date_str)
_, date_str = extract_timezone(date_str)
for expression in date_formats(day_first):
with contextlib.suppress(ValueError):
upload_date = dt.datetime.strptime(date_str, expression).strftime('%Y%m%d')
if upload_date is ... | We can eliminate the intermediate var and shorten the `default` expression to a truthiness check since `extract_timezone` ignores falsy `default` values anyways
```suggestion
timezone, date_str = extract_timezone(
date_str, default=dt.timedelta(hours=tz_offset) if tz_offset else None)
``` | date_str = re.sub(r'(?i)\s*(?:AM|PM)(?:\s+[A-Z]+)?', '', date_str)
_, date_str = extract_timezone(date_str)
for expression in date_formats(day_first):
with contextlib.suppress(ValueError):
upload_date = dt.datetime.strptime(date_str, expression).strftime('%Y%m%d')
if upload_date is ... | @@ -1262,15 +1262,17 @@ def unified_strdate(date_str, day_first=True):
return str(upload_date)
-def unified_timestamp(date_str, day_first=True):
+@partial_application
+def unified_timestamp(date_str, day_first=True, tz_offset=None):
if not isinstance(date_str, str):
return None
date_st... | yt_dlp/utils/_utils.py | 26 | Python | 0.857 | refactor | 305 | 51 | 51 | false | [utils] `unified_timestamp`: Support an offset for timezone-less datetimes | 15,357 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
def unified_strdate(date_str, day_first=True):
"""Return a string with the date in the format YYYYMMDD"""
if date_str is None:
return None
upload_date = None
# Replace commas
date_str = date_str.replace(',', ' ')
# Remove AM/PM + timezone
date_str = re.sub(r'(?i)\s*(?:AM|PM)(?:\s+[A... | Might actually be nice to implicitly hint the `tz_offset` type here
```suggestion
@partial_application
def unified_timestamp(date_str, day_first=True, tz_offset=0):
``` | def unified_strdate(date_str, day_first=True):
"""Return a string with the date in the format YYYYMMDD"""
if date_str is None:
return None
upload_date = None
# Replace commas
date_str = date_str.replace(',', ' ')
# Remove AM/PM + timezone
date_str = re.sub(r'(?i)\s*(?:AM|PM)(?:\s+[A... | @@ -1262,15 +1262,17 @@ def unified_strdate(date_str, day_first=True):
return str(upload_date)
-def unified_timestamp(date_str, day_first=True):
+@partial_application
+def unified_timestamp(date_str, day_first=True, tz_offset=None): | yt_dlp/utils/_utils.py | 26 | Python | 0.857 | suggestion | 172 | 51 | 51 | false | [utils] `unified_timestamp`: Support an offset for timezone-less datetimes | 15,357 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
},
'skip': 'This content is no longer available.',
},
{
'url': 'https://twitter.com/i/cards/tfw/v1/623160978427936768',
'md5': '7137eca597f72b9abbe61e5ae0161399',
'info_dict': {
'id': '623160978427936768',
'ext':... | intentional+permanent or incompetence+temporary? almost no way of knowing | },
'skip': 'This content is no longer available.',
},
{
'url': 'https://twitter.com/i/cards/tfw/v1/623160978427936768',
'md5': '7137eca597f72b9abbe61e5ae0161399',
'info_dict': {
'id': '623160978427936768',
'ext':... | @@ -383,6 +383,7 @@ class TwitterCardIE(InfoExtractor):
'_old_archive_ids': ['twitter 623160978427936768'],
},
'params': {'format': '[protocol=https]'},
+ 'skip': 'HTTP Error 500: Domain Not Found (X killed twitter:amplify)', | yt_dlp/extractor/twitter.py | 26 | Python | 0.214 | suggestion | 73 | 51 | 51 | false | [ie/twitter] Only extract videos from `unified_card`s | 15,431 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
'uploader_id': 'giphz',
},
'expected_warnings': ['height', 'width'],
'skip': 'Account suspended',
}, {
'url': 'https://twitter.com/starwars/status/665052190608723968',
'info_dict': {
'id': '665052190608723968',
'display_id': '66505219060872... | intentional+permanent or incompetence+temporary? | },
'expected_warnings': ['height', 'width'],
'skip': 'Account suspended',
}, {
'url': 'https://twitter.com/starwars/status/665052190608723968',
'info_dict': {
'id': '665052190608723968',
'display_id': '665052190608723968',
'ext': 'mp4',
... | @@ -508,6 +510,7 @@ class TwitterIE(TwitterBaseIE):
'age_limit': 0,
'_old_archive_ids': ['twitter 665052190608723968'],
},
+ 'skip': 'HTTP Error 500: Domain Not Found (X killed twitter:amplify)', | yt_dlp/extractor/twitter.py | 26 | Python | 0.071 | question | 48 | 51 | 51 | false | [ie/twitter] Only extract videos from `unified_card`s | 15,431 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
if not next_url:
break
def _real_extract(self, url):
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collection_slug, note='Retrieving channel')
... | Expand regex in case they ever decide to add letters
```suggestion
_VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>[\w-]+)'
``` | if not next_url:
break
def _real_extract(self, url):
collection_slug = self._match_id(url)
channel = self._call_api(
f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons',
collection_slug, note='Retrieving channel')
... | @@ -482,7 +482,7 @@ def _real_extract(self, url):
class NebulaSeasonIE(NebulaBaseIE):
IE_NAME = 'nebula:season'
- _VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>\d+)'
+ _VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\w-]+)/season/(?P<season_number>[-\d]+)' | yt_dlp/extractor/nebula.py | 26 | Python | 0.714 | suggestion | 161 | 51 | 51 | false | [ie/nebula] Fix for seasons numbers with decimals | 15,436 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | prettysunflower |
# It's possible that timestamp is ultimately None if:
# - An API key is not set
# - The post is does not require login (otherwise the extraction would fail altogether)
# - The desired video is earlier in the reblog chain
#
# As possible future work, another HTTP request c... | This fallback doesn't even work, though?
The `_search_json_ld` method's `expected_type` kwarg is used to expect JSON-LD object `@type`s, not Python types.
I'm assuming none of the extractor tests use this fallback? It would be nice to add a test case that actually covers this code path. Or else add comments if so... | r'(?s)<title>(?P<title>.*?)(?: \| Tumblr)?</title>', webpage, 'title', default=blog)),
'description': description,
'uploader_id': uploader_id,
'uploader_url': f'https://{uploader_id}.tumblr.com/' if uploader_id else None,
**traverse_obj(post_json, {
... | @@ -437,11 +452,39 @@ def _real_extract(self, url):
description = self._og_search_description(webpage, default=None)
uploader_id = traverse_obj(post_json, 'reblogged_root_name', 'blog_name')
+ # It's possible that timestamp is ultimately None if:
+ # - An API key is not set
+ ... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.786 | refactor | 349 | 51 | 51 | false | [ie/tumblr] Extract `timestamp` | 15,462 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | alch-emi |
'description': 'md5:082a3a621530cb786ad2b7592a6d9e2c',
'timestamp': 1597865276,
'upload_date': '20200819',
'uploader_id': 'maskofthedragon',
'uploader_url': 'https://maskofthedragon.tumblr.com/',
'thumbnail': r're:^https?://.*\.jpg',
'd... | Don't add fake test data
If the link is dead, then add `'skip': '<REASON>'` to the test dict | 'description': 'md5:082a3a621530cb786ad2b7592a6d9e2c',
'timestamp': 1597865276,
'upload_date': '20200819',
'uploader_id': 'maskofthedragon',
'uploader_url': 'https://maskofthedragon.tumblr.com/',
'thumbnail': r're:^https?://.*\.jpg',
'd... | @@ -53,12 +57,15 @@ class TumblrIE(InfoExtractor):
},
}, {
'note': 'non-iframe video (with related posts)',
+ # Note: The post referenced in this test case has since been deleted
'url': 'https://shieldfoss.tumblr.com/post/675519763813908480',
'md5': '12bdb75661ef443bffe5a... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.357 | suggestion | 95 | 51 | 51 | false | [ie/tumblr] Extract `timestamp` | 15,462 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | alch-emi |
self._download_json(
f'https://www.tumblr.com/api/v2/blog/{blog}/posts/{video_id}/permalink',
video_id, headers={'Authorization': f'Bearer {self._ACCESS_TOKEN}'}, fatal=False),
('response', 'timeline', 'elements', 0, {dict})) or {}
content_... | ```suggestion
'timestamp': traverse_obj(
post_json,
('trail', 0, 'post', 'timestamp'), # Oldest post in reblog chain
'timestamp', # Timestamp of the post itself
expected_type=int_or_none),
``` | self._download_json(
f'https://www.tumblr.com/api/v2/blog/{blog}/posts/{video_id}/permalink',
video_id, headers={'Authorization': f'Bearer {self._ACCESS_TOKEN}'}, fatal=False),
('response', 'timeline', 'elements', 0, {dict})) or {}
content_... | @@ -442,6 +454,11 @@ def _real_extract(self, url):
'title': post_json.get('summary') or (blog if api_only else self._html_search_regex(
r'(?s)<title>(?P<title>.*?)(?: \| Tumblr)?</title>', webpage, 'title', default=blog)),
'description': description,
+ 'timestamp':
... | yt_dlp/extractor/tumblr.py | 26 | Python | 0.929 | suggestion | 298 | 51 | 51 | false | [ie/tumblr] Extract `timestamp` | 15,462 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | alch-emi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.