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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
('SAPISID3PHASH', yt_3psapisid)):
if sid:
authorizations.append(self._make_sid_authorization(scheme, sid, origin, additional_parts))
if not authorizations:
return None
return ' '.join(authorizations)
@functools.cached_property
... | since `is_authenticated` is cached, can't we just use that instead of adding `_had_cookie_auth`?
```suggestion
if self.is_authenticated and not self._has_auth_cookies():
``` | if sid:
authorizations.append(self._make_sid_authorization(scheme, sid, origin, additional_parts))
if not authorizations:
return None
return ' '.join(authorizations)
@property
def is_authenticated(self):
return self._has_auth_cookies
@prope... | @@ -595,6 +600,31 @@ def _get_sid_authorization_header(self, origin='https://www.youtube.com', user_s
return ' '.join(authorizations)
+ @functools.cached_property
+ def is_authenticated(self):
+ return bool(self._has_auth_cookies())
+
+ def _has_auth_cookies(self):
+ yt_sapisid, yt_1... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.786 | security | 186 | 51 | 51 | false | [ie/youtube] Detect when account cookies are rotated | 13,014 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
def _initialize_consent(self):
if self._has_auth_cookies():
return
cookies = self._youtube_cookies()
socs = cookies.get('SOCS')
if socs and not socs.value.startswith('CAA'): # not consented
return
self._set_cookie('.youtube.com', 'SOCS', 'CAI', secur... | ```suggestion
if self.is_authenticated:
``` |
def _initialize_consent(self):
if self._has_auth_cookies:
return
socs = self._youtube_cookies.get('SOCS')
if socs and not socs.value.startswith('CAA'): # not consented
return
self._set_cookie('.youtube.com', 'SOCS', 'CAI', secure=True) # accept all (require... | @@ -472,8 +474,9 @@ def _initialize_pref(self):
self._set_cookie('.youtube.com', name='PREF', value=urllib.parse.urlencode(pref))
def _initialize_cookie_auth(self):
- yt_sapisid, yt_1psapisid, yt_3psapisid = self._get_sid_cookies()
- if yt_sapisid or yt_1psapisid or yt_3psapisid:
+ ... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.571 | security | 53 | 51 | 51 | false | [ie/youtube] Detect when account cookies are rotated | 13,014 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
additional_parts['u'] = user_session_id
yt_sapisid, yt_1psapisid, yt_3psapisid = self._get_sid_cookies()
for scheme, sid in (('SAPISIDHASH', yt_sapisid),
('SAPISID1PHASH', yt_1psapisid),
('SAPISID3PHASH', yt_3psapisid)):
i... | this? since otherwise we could return the value of `yt_sapisid` etc
```suggestion
return bool(has_login_info and (yt_sapisid or yt_1psapisid or yt_3psapisid))
``` | yt_sapisid, yt_1psapisid, yt_3psapisid = self._get_sid_cookies()
for scheme, sid in (('SAPISIDHASH', yt_sapisid),
('SAPISID1PHASH', yt_1psapisid),
('SAPISID3PHASH', yt_3psapisid)):
if sid:
authorizations.append(self._ma... | @@ -595,6 +601,31 @@ def _get_sid_authorization_header(self, origin='https://www.youtube.com', user_s
return ' '.join(authorizations)
+ @property
+ def is_authenticated(self):
+ return self._has_auth_cookies
+
+ @property
+ def _has_auth_cookies(self):
+ yt_sapisid, yt_1psapisid, ... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.786 | suggestion | 173 | 51 | 51 | false | [ie/youtube] Detect when account cookies are rotated | 13,014 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
return None
return ' '.join(authorizations)
@property
def is_authenticated(self):
return self._has_auth_cookies
@property
def _has_auth_cookies(self):
yt_sapisid, yt_1psapisid, yt_3psapisid = self._get_sid_cookies()
# YouTube doesn't appear to clear 3PSAPIS... | did you want to be deliberate with `only_once=False`? or could we do this?
```suggestion
f'For tips on how to effectively export YouTube cookies, refer to {self._COOKIE_HOWTO_WIKI_URL}')
``` | return ' '.join(authorizations)
@property
def is_authenticated(self):
return self._has_auth_cookies
@property
def _has_auth_cookies(self):
yt_sapisid, yt_1psapisid, yt_3psapisid = self._get_sid_cookies()
# YouTube doesn't appear to clear 3PSAPISID when rotating cookies ... | @@ -595,6 +601,31 @@ def _get_sid_authorization_header(self, origin='https://www.youtube.com', user_s
return ' '.join(authorizations)
+ @property
+ def is_authenticated(self):
+ return self._has_auth_cookies
+
+ @property
+ def _has_auth_cookies(self):
+ yt_sapisid, yt_1psapisid, ... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.857 | question | 210 | 51 | 51 | false | [ie/youtube] Detect when account cookies are rotated | 13,014 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
if not authorizations:
return None
return ' '.join(authorizations)
@property
def is_authenticated(self):
return self._has_auth_cookies
@property
def _has_auth_cookies(self):
yt_sapisid, yt_1psapisid, yt_3psapisid = self._get_sid_cookies()
# YouTube ... | ```suggestion
f'For tips on how to effectively export YouTube cookies, refer to {self._COOKIE_HOWTO_WIKI_URL} .',
``` |
return ' '.join(authorizations)
@property
def is_authenticated(self):
return self._has_auth_cookies
@property
def _has_auth_cookies(self):
yt_sapisid, yt_1psapisid, yt_3psapisid = self._get_sid_cookies()
# YouTube doesn't appear to clear 3PSAPISID when rotating cookies... | @@ -595,6 +601,31 @@ def _get_sid_authorization_header(self, origin='https://www.youtube.com', user_s
return ' '.join(authorizations)
+ @property
+ def is_authenticated(self):
+ return self._has_auth_cookies
+
+ @property
+ def _has_auth_cookies(self):
+ yt_sapisid, yt_1psapisid, ... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.714 | suggestion | 136 | 51 | 51 | false | [ie/youtube] Detect when account cookies are rotated | 13,014 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | coletdjnz |
if sid:
authorizations.append(self._make_sid_authorization(scheme, sid, origin, additional_parts))
if not authorizations:
return None
return ' '.join(authorizations)
@property
def is_authenticated(self):
return self._has_auth_cookies
@prope... | Just thinking we could keep `is_authenticated` as a `cached_property` if we do this:
```suggestion
if self._had_cookie_auth and not self._has_auth_cookies:
if self.is_authenticated:
del self.is_authenticated
self.report_warning(
``` |
if not authorizations:
return None
return ' '.join(authorizations)
@property
def is_authenticated(self):
return self._has_auth_cookies
@property
def _has_auth_cookies(self):
yt_sapisid, yt_1psapisid, yt_3psapisid = self._get_sid_cookies()
# YouTube... | @@ -595,6 +601,31 @@ def _get_sid_authorization_header(self, origin='https://www.youtube.com', user_s
return ' '.join(authorizations)
+ @property
+ def is_authenticated(self):
+ return self._has_auth_cookies
+
+ @property
+ def _has_auth_cookies(self):
+ yt_sapisid, yt_1psapisid, ... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.857 | security | 286 | 51 | 51 | false | [ie/youtube] Detect when account cookies are rotated | 13,014 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
def _initialize_consent(self):
if self._has_auth_cookies:
return
cookies = self._youtube_cookies
socs = cookies.get('SOCS')
if socs and not socs.value.startswith('CAA'): # not consented
return
self._set_cookie('.youtube.com', 'SOCS', 'CAI', secure=Tr... | I'm fine keeping it as-is but what do you think about `_passed_auth_cookies` as a name instead of `_had_cookie_auth`? |
def _initialize_consent(self):
if self._has_auth_cookies:
return
socs = self._youtube_cookies.get('SOCS')
if socs and not socs.value.startswith('CAA'): # not consented
return
self._set_cookie('.youtube.com', 'SOCS', 'CAI', secure=True) # accept all (require... | @@ -472,8 +474,9 @@ def _initialize_pref(self):
self._set_cookie('.youtube.com', name='PREF', value=urllib.parse.urlencode(pref))
def _initialize_cookie_auth(self):
- yt_sapisid, yt_1psapisid, yt_3psapisid = self._get_sid_cookies()
- if yt_sapisid or yt_1psapisid or yt_3psapisid:
+ ... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.571 | security | 117 | 51 | 51 | false | [ie/youtube] Detect when account cookies are rotated | 13,014 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
Returns None if no preferred language set.
"""
preferred_lang = self._configuration_arg('lang', ie_key='Youtube', casesense=True, default=[''])[0]
if not preferred_lang:
return
if preferred_lang not in self._SUPPORTED_LANG_CODES:
raise ExtractorError(
... | ```suggestion
pref_cookie = self._youtube_cookies.get('PREF')
``` | Returns None if no preferred language set.
"""
preferred_lang = self._configuration_arg('lang', ie_key='Youtube', casesense=True, default=[''])[0]
if not preferred_lang:
return
if preferred_lang not in self._SUPPORTED_LANG_CODES:
raise ExtractorError(
... | @@ -451,16 +453,16 @@ def _preferred_lang(self):
return preferred_lang
def _initialize_consent(self):
- cookies = self._get_cookies('https://www.youtube.com/')
- if cookies.get('__Secure-3PSID'):
+ if self._has_auth_cookies:
return
+ cookies = self._youtube_cooki... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.571 | suggestion | 75 | 51 | 51 | false | [ie/youtube] Detect when account cookies are rotated | 13,014 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
return self._search_regex(rf'^(?:https?://(?:www\.)?youtube\.com)?/({self._YT_CHANNEL_UCID_RE})',
url, 'channel id', default=None)
@functools.cached_property
def _preferred_lang(self):
"""
Returns a language code supported by YouTube for the user prefer... | ```suggestion
socs = self._youtube_cookies.get('SOCS')
``` | return self._search_regex(rf'^(?:https?://(?:www\.)?youtube\.com)?/({self._YT_CHANNEL_UCID_RE})',
url, 'channel id', default=None)
@functools.cached_property
def _preferred_lang(self):
"""
Returns a language code supported by YouTube for the user prefer... | @@ -451,16 +453,16 @@ def _preferred_lang(self):
return preferred_lang
def _initialize_consent(self):
- cookies = self._get_cookies('https://www.youtube.com/')
- if cookies.get('__Secure-3PSID'):
+ if self._has_auth_cookies:
return
+ cookies = self._youtube_cooki... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.571 | suggestion | 68 | 51 | 51 | false | [ie/youtube] Detect when account cookies are rotated | 13,014 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
def _parse_vue_attributes(self, name, string, video_id):
attributes = extract_attributes(self._search_regex(rf'(<{name}(?:"[^"]*?"|[^>])*>)', string, name))
for key, value in attributes.items():
if key.startswith(':'):
attributes[key] = self._parse_json(value, video_id, ... | I would also extract the resolution
```suggestion
'format_id': join_nonempty(extension, note),
**parse_resolution(source.get('label')),
``` |
def _parse_vue_attributes(self, name, string, video_id):
attributes = extract_attributes(self._search_regex(rf'(<{name}(?:"[^"]*?"|[^>])*>)', string, name))
for key, value in attributes.items():
if key.startswith(':'):
attributes[key] = self._parse_json(value, video_id,... | @@ -110,21 +110,19 @@ def _parse_vue_attributes(self, name, string, video_id):
return attributes
- @staticmethod
- def _process_source(source):
+ def _process_source(self, source):
url = url_or_none(source['src'])
if not url:
return None
source_type = sour... | yt_dlp/extractor/bpb.py | 26 | Python | 0.786 | refactor | 167 | 51 | 51 | false | [ie/bpb] Fix formats extraction | 13,015 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | bashonly |
from .common import ExtractorError, InfoExtractor
from ..utils import determine_ext, join_nonempty
from ..utils.traversal import traverse_obj
class PlayerFmIE(InfoExtractor):
_VALID_URL = r'https?://(?:www.)?player.fm/(?:series)?/[a-z\d-]+/(?P<id>[a-z\d-]+)'
_TESTS = [{
'url': 'https://player.fm/seri... | line too long. use regex
```suggestion
'description': r're:The first episode of this season of Movie Mindset is free .+ we feel about it\.',
``` | from .common import InfoExtractor
from ..utils import clean_html, clean_podcast_url, int_or_none, str_or_none, url_or_none
from ..utils.traversal import traverse_obj
class PlayerFmIE(InfoExtractor):
_VALID_URL = r'(?P<url>https?://(?:www\.)?player\.fm/(?:series/)?[\w-]+/(?P<id>[\w-]+))'
_TESTS = [{
'u... | @@ -0,0 +1,70 @@
+
+from .common import ExtractorError, InfoExtractor
+from ..utils import determine_ext, join_nonempty
+from ..utils.traversal import traverse_obj
+
+
+class PlayerFmIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www.)?player.fm/(?:series)?/[a-z\d-]+/(?P<id>[a-z\d-]+)'
+ _TESTS = [{
+ 'ur... | yt_dlp/extractor/playerfm.py | 16 | Python | 0.786 | refactor | 161 | 41 | 41 | false | [ie/PlayerFm] Add extractor | 13,016 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | R0hanW |
from .common import ExtractorError, InfoExtractor
from ..utils import determine_ext, join_nonempty
from ..utils.traversal import traverse_obj
class PlayerFmIE(InfoExtractor):
_VALID_URL = r'https?://(?:www.)?player.fm/(?:series)?/[a-z\d-]+/(?P<id>[a-z\d-]+)'
_TESTS = [{
'url': 'https://player.fm/seri... | - `(?:series/)?` instead of `(?:series)?/`
- if `/series` is optional then add a test where the URL doesn't have it
- escape dots
- I'd simplify the character classes to just `[\w-]`
- we'll need the `url` capture group below
```suggestion
_VALID_URL = r'(?P<url>https?://(?:www\.)?player\.fm/(?:series/)?[\w-]... | from .common import InfoExtractor
from ..utils import clean_html, clean_podcast_url, int_or_none, str_or_none, url_or_none
from ..utils.traversal import traverse_obj
class PlayerFmIE(InfoExtractor):
_VALID_URL = r'(?P<url>https?://(?:www\.)?player\.fm/(?:series/)?[\w-]+/(?P<id>[\w-]+))'
_TESTS = [{
'u... | @@ -0,0 +1,70 @@
+
+from .common import ExtractorError, InfoExtractor
+from ..utils import determine_ext, join_nonempty
+from ..utils.traversal import traverse_obj
+
+
+class PlayerFmIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www.)?player.fm/(?:series)?/[a-z\d-]+/(?P<id>[a-z\d-]+)' | yt_dlp/extractor/playerfm.py | 8 | Python | 0.857 | security | 343 | 33 | 33 | false | [ie/PlayerFm] Add extractor | 13,016 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | R0hanW |
'info_dict': {
'id': 'thursday-april-24-2025',
'thumbnail': r're:^https://.*\.(jpg|png)',
'title': 'Thursday, April 24, 2025',
'creators': ['Lester Holt, NBC News'],
'description': '<p>Trump urges Putin to \'STOP\' after deadly Russian strike on Ukrain... | The input url may have a query or a fragment (or more path segments!), so we can't just add `.json` to it.
We'll want to use the `url` capture group added in my above suggestion:
```suggestion
# podcast url is always after last backlash
video_id, url = self._match_valid_url(url).group('id', 'url')... | }, {
'url': 'https://player.fm/series/nbc-nightly-news-with-tom-llamas/thursday-april-17-2025',
'info_dict': {
'ext': 'mp3',
'id': '477635490',
'display_id': 'thursday-april-17-2025',
'title': 'Thursday, April 17, 2025',
'thumbnail': r're:^... | @@ -0,0 +1,70 @@
+
+from .common import ExtractorError, InfoExtractor
+from ..utils import determine_ext, join_nonempty
+from ..utils.traversal import traverse_obj
+
+
+class PlayerFmIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www.)?player.fm/(?:series)?/[a-z\d-]+/(?P<id>[a-z\d-]+)'
+ _TESTS = [{
+ 'ur... | yt_dlp/extractor/playerfm.py | 26 | Python | 1 | suggestion | 386 | 50 | 50 | false | [ie/PlayerFm] Add extractor | 13,016 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | R0hanW |
'ext': 'mp3',
},
}, {
'url': 'https://player.fm/series/soccer-101/ep-109-its-kicking-off-how-have-the-rules-for-kickoff-changed-what-are-the-best-approaches-to-getting-the-game-underway-and-how-could-we-improve-on-the-present-system',
'info_dict': {
'id': 'ep-109-its-... | inline all of this in the return
```suggestion
``` | 'thumbnail': r're:^https://.*\.(jpg|png)',
'duration': 1143,
'description': 'md5:4890b8cf9a55a787561cd5d59dfcda82',
'creators': ['NBC News'],
'timestamp': 1744941374,
'upload_date': '20250418',
},
}, {
'url': 'https://player.fm/... | @@ -0,0 +1,70 @@
+
+from .common import ExtractorError, InfoExtractor
+from ..utils import determine_ext, join_nonempty
+from ..utils.traversal import traverse_obj
+
+
+class PlayerFmIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www.)?player.fm/(?:series)?/[a-z\d-]+/(?P<id>[a-z\d-]+)'
+ _TESTS = [{
+ 'ur... | yt_dlp/extractor/playerfm.py | 26 | Python | 0.571 | suggestion | 52 | 43 | 43 | false | [ie/PlayerFm] Add extractor | 13,016 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | R0hanW |
'description': '<p>Ryan is joined by Joe and Taylor to answer the age old question (in your best Jerry Seinfeld impression), "What\'s the deal with kickoff?!" How does a game get underway, how have the rules regarding kickoff evolved since the mid-1800s, what are the different approaches to getting your tac... | - We want to error if anything is empty, so `join_nonempty` isn't needed here
- Returning a single format can be done with the `url` field instead of a single-element `formats` list
- Core code already calls `determine_ext` on the format `url` if you don't return an `ext`, and we wouldn't want to return an empty stri... | 'info_dict': {
'ext': 'mp3',
'id': '481418710',
'thumbnail': r're:^https://.*\.(jpg|png)',
'title': r're:#109 It\'s kicking off! How have the rules for kickoff changed, .+ the present system\?',
'creators': ['TSS'],
'duration': 1510,
... | @@ -0,0 +1,70 @@
+
+from .common import ExtractorError, InfoExtractor
+from ..utils import determine_ext, join_nonempty
+from ..utils.traversal import traverse_obj
+
+
+class PlayerFmIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www.)?player.fm/(?:series)?/[a-z\d-]+/(?P<id>[a-z\d-]+)'
+ _TESTS = [{
+ 'ur... | yt_dlp/extractor/playerfm.py | 26 | Python | 1 | refactor | 684 | 34 | 34 | false | [ie/PlayerFm] Add extractor | 13,016 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | R0hanW |
def _real_extract(self, url):
# podcast url is always after last backlash
video_id = self._match_id(url)
data = self._download_json(url + '.json', None)
title = data.get('title')
description = data.get('description')
duration = data.get('duration')
thumbnail ... | We can unpack a single `traverse_obj` call in the return dict
- use `{str}` to check the type of the `title`
- import `clean_html` from utils; we need this to remove the html tags from the `description`
- when extracting `duration` it's best to transform it with `int_or_none` so that we end up with an `int` or...`... | 'duration': 1510,
'display_id': 'md5:b52ecacaefab891b59db69721bfd9b13',
'description': 'md5:52a39e36d08d8919527454f152ad3c25',
'timestamp': 1659102055,
'upload_date': '20220729',
},
}]
def _real_extract(self, url):
display_id, url = se... | @@ -0,0 +1,70 @@
+
+from .common import ExtractorError, InfoExtractor
+from ..utils import determine_ext, join_nonempty
+from ..utils.traversal import traverse_obj
+
+
+class PlayerFmIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www.)?player.fm/(?:series)?/[a-z\d-]+/(?P<id>[a-z\d-]+)'
+ _TESTS = [{
+ 'ur... | yt_dlp/extractor/playerfm.py | 26 | Python | 1 | security | 1,248 | 28 | 28 | false | [ie/PlayerFm] Add extractor | 13,016 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | R0hanW |
_TESTS = [{
'url': 'https://player.fm/series/chapo-trap-house/movie-mindset-33-casino-feat-felix',
'info_dict': {
'id': 'movie-mindset-33-casino-feat-felix',
'thumbnail': r're:^https://.*\.(jpg|png)',
'title': 'Movie Mindset 33 - Casino feat. Felix',
'... | This URL is dead? And can we use anything else for the `id`? This id is way too long | 'url': 'https://player.fm/series/chapo-trap-house/movie-mindset-33-casino-feat-felix',
'info_dict': {
'ext': 'mp3',
'id': '478606546',
'display_id': 'movie-mindset-33-casino-feat-felix',
'thumbnail': r're:^https://.*\.(jpg|png)',
'title': 'Movi... | @@ -0,0 +1,60 @@
+
+from .common import InfoExtractor
+from ..utils import clean_html, int_or_none, url_or_none
+from ..utils.traversal import traverse_obj
+
+
+class PlayerFmIE(InfoExtractor):
+ _VALID_URL = r'(?P<url>https?://(?:www\.)?player\.fm/(?:series/)?[\w-]+/(?P<id>[\w-]+))'
+ _TESTS = [{
+ 'url':... | yt_dlp/extractor/playerfm.py | 26 | Python | 0.429 | refactor | 84 | 51 | 51 | false | [ie/PlayerFm] Add extractor | 13,016 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | R0hanW |
'duration': 1143,
'description': 'md5:4890b8cf9a55a787561cd5d59dfcda82',
'creators': ['NBC News'],
'timestamp': 1744941374,
'upload_date': '20250418',
},
}, {
'url': 'https://player.fm/series/soccer-101/ep-109-its-kicking-off-how-have-the-r... | ```suggestion
data = self._download_json(f'{url}.json', display_id)
``` | 'duration': 1143,
'description': 'md5:4890b8cf9a55a787561cd5d59dfcda82',
'creators': ['NBC News'],
'timestamp': 1744941374,
'upload_date': '20250418',
},
}, {
'url': 'https://player.fm/series/soccer-101/ep-109-its-kicking-off-how-have-the-r... | @@ -0,0 +1,71 @@
+from .common import InfoExtractor
+from ..utils import clean_html, clean_podcast_url, int_or_none, str_or_none, url_or_none
+from ..utils.traversal import traverse_obj
+
+
+class PlayerFmIE(InfoExtractor):
+ _VALID_URL = r'(?P<url>https?://(?:www\.)?player\.fm/(?:series/)?[\w-]+/(?P<id>[\w-]+))'
+ ... | yt_dlp/extractor/playerfm.py | 26 | Python | 0.571 | suggestion | 81 | 43 | 42 | false | [ie/PlayerFm] Add extractor | 13,016 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | R0hanW |
join_nonempty,
js_to_json,
merge_dicts,
parse_filesize,
parse_iso8601,
parse_qs,
qualities,
smuggle_url,
str_or_none,
traverse_obj,
try_get,
unified_timestamp,
unsmuggle_url,
url_or_none,
urlencode_postdata,
urlhandle_detect_ext,
urljoin,
)
class Vim... | ```suggestion
_APP_USER_AGENT = 'Vimeo/11.10.0 (com.vimeo; build:250424.164813.0; iOS 18.4.1) Alamofire/5.9.0 VimeoNetworking/5.0.0'
``` | join_nonempty,
js_to_json,
merge_dicts,
parse_filesize,
parse_iso8601,
parse_qs,
qualities,
smuggle_url,
str_or_none,
traverse_obj,
try_get,
unified_timestamp,
unsmuggle_url,
url_or_none,
urlencode_postdata,
urlhandle_detect_ext,
urljoin,
)
class Vim... | @@ -39,6 +39,8 @@ class VimeoBaseInfoExtractor(InfoExtractor):
_NETRC_MACHINE = 'vimeo'
_LOGIN_REQUIRED = False
_LOGIN_URL = 'https://vimeo.com/log_in'
+ _APP_AUTH = 'MTMxNzViY2Y0NDE0YTQ5YzhjZTc0YmU0NjVjNDQxYzNkYWVjOWRlOTpHKzRvMmgzVUh4UkxjdU5FRW80cDNDbDhDWGR5dVJLNUJZZ055dHBHTTB4V1VzaG41bEx1a2hiN0NWYWN... | yt_dlp/extractor/vimeo.py | 26 | Python | 0.786 | suggestion | 142 | 51 | 51 | false | [ie/vimeo] Extract from mobile API | 13,034 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | bashonly |
return self._download_json(
join_nonempty(f'https://api.vimeo.com/videos/{video_id}', unlisted_hash, delim=':'),
video_id, 'Downloading API JSON', headers={
'Authorization': f'jwt {jwt_token}',
'Accept': 'application/vnd.vimeo.*+json;version=3.4.10',
... | Presumably this token never expires? | })), key=lambda c: c['start_time']) or None,
'formats': formats,
'subtitles': subtitles,
'live_status': live_status,
'release_timestamp': traverse_obj(live_event, ('ingest', 'scheduled_start_time', {parse_iso8601})),
# Note: Bitrates are comple... | @@ -239,24 +250,39 @@ def _parse_config(self, config, video_id):
'_format_sort_fields': ('quality', 'res', 'fps', 'hdr:12', 'source'),
}
- def _call_videos_api(self, video_id, jwt_token, unlisted_hash=None, **kwargs):
+ def _fetch_oauth_token(self):
+ if not self._ios_oauth_token:
+... | yt_dlp/extractor/vimeo.py | 26 | Python | 0.071 | question | 36 | 51 | 51 | false | [ie/vimeo] Extract from mobile API | 13,034 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | bashonly |
def _call_videos_api(self, video_id, jwt_token, unlisted_hash=None, **kwargs):
return self._download_json(
join_nonempty(f'https://api.vimeo.com/videos/{video_id}', unlisted_hash, delim=':'),
video_id, 'Downloading API JSON', headers={
'Authorization': f'jwt {jwt_toke... | Apparently, the default `urllib.parse.quote_plus` also works. | 'start_time': ('timecode', {int_or_none}),
})), key=lambda c: c['start_time']) or None,
'formats': formats,
'subtitles': subtitles,
'live_status': live_status,
'release_timestamp': traverse_obj(live_event, ('ingest', 'scheduled_start_ti... | @@ -239,24 +250,39 @@ def _parse_config(self, config, video_id):
'_format_sort_fields': ('quality', 'res', 'fps', 'hdr:12', 'source'),
}
- def _call_videos_api(self, video_id, jwt_token, unlisted_hash=None, **kwargs):
+ def _fetch_oauth_token(self):
+ if not self._ios_oauth_token:
+... | yt_dlp/extractor/vimeo.py | 26 | Python | 0.357 | suggestion | 61 | 51 | 51 | false | [ie/vimeo] Extract from mobile API | 13,034 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | bashonly |
**parse_resolution(value, lenient=True),
})
continue
for k, img_url in value.items():
res = parse_resolution(k, lenient=True) or parse_resolution(img_url, lenient=True)
width, height = res.get('width'), res.get('height')
... | I don't like how we are depending on the audio formats to be delivered in descending audio quality, and I also think this is a bit hard to understand
What about this?
```py
common_format_info = {
'protocol': 'niconico_live',
'ws': ws,
'video_id': video_id,
... | 'url': value,
**parse_resolution(value, lenient=True),
})
continue
for k, img_url in value.items():
res = parse_resolution(k, lenient=True) or parse_resolution(img_url, lenient=True)
width, height = res.... | @@ -881,16 +875,20 @@ def _real_extract(self, url):
for cookie in cookies:
self._set_cookie(
cookie['domain'], cookie['name'], cookie['value'],
- expire_time=unified_timestamp(cookie['expires']), path=cookie['path'], secure=cookie['secure'])
+ expire_... | yt_dlp/extractor/niconico.py | 26 | Python | 0.857 | performance | 1,227 | 51 | 51 | false | [ie/niconico:live] Fix extractor | 13,045 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
# FORMAT_STREAM_TYPE_OTF(otf=1) requires downloading the init fragment
# (adding `&sq=0` to the URL) and parsing emsg box to determine the
# number of fragment that would subsequently requested with (`&sq=N`)
if fmt.get('type') == 'FORMAT_STREAM_TYPE_OTF' and not has_drm... | active voice sounds better than passive voice :nerd_face:
```suggestion
msg += 'YouTube is forcing SABR streaming for this client. '
``` |
# FORMAT_STREAM_TYPE_OTF(otf=1) requires downloading the init fragment
# (adding `&sq=0` to the URL) and parsing emsg box to determine the
# number of fragment that would subsequently requested with (`&sq=N`)
if fmt.get('type') == 'FORMAT_STREAM_TYPE_OTF' and not has_drm... | @@ -3234,12 +3234,16 @@ def build_fragments(f):
fmt_url = url_or_none(try_get(sc, lambda x: x['url'][0]))
encrypted_sig = try_get(sc, lambda x: x['s'][0])
if not all((sc, fmt_url, player_url, encrypted_sig)):
- self.report_warning(
- ... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.786 | suggestion | 163 | 51 | 51 | false | [ie/youtube] Improve warning for SABR-only/SSAP player responses | 13,049 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
'url': 'https://tarangplus.in/shows/tarang-cine-utsav-2024/tarang-cine-utsav-2024-seg-1',
'only_matching': True,
}, {
'url': 'https://tarangplus.in/music-videos/chori-chori-bohu-chori-songs/nijara-laguchu-dhire-dhire',
'only_matching': True,
}, {
'url': 'https://tarangplu... | Let's do this non-fatally
```suggestion
json_ld_data = self._search_json_ld(webpage, display_id)
json_ld_data.pop('url', None)
``` | 'only_matching': True,
}, {
'url': 'https://tarangplus.in/shows/tarang-cine-utsav-2024/tarang-cine-utsav-2024-seg-1',
'only_matching': True,
}, {
'url': 'https://tarangplus.in/music-videos/chori-chori-bohu-chori-songs/nijara-laguchu-dhire-dhire',
'only_matching': True,
... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 26 | Python | 0.714 | suggestion | 152 | 51 | 51 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'url': 'https://tarangplus.in/kids-shows/chhota-jaga/chhota-jaga-ep-33-jamidar-ra-khajana-adaya',
'only_matching': True,
}, {
'url': 'https://tarangplus.in/movies/swayambara',
'only_matching': True,
}]
def decrypt(self, data, key):
if not Cryptodome.AES:
... | I would write it like this... it gives a nice clean error ("Unable to extract `content`") and we can easily access the other info in the parsed `contenturl`, e.g. by adding the `id` fallback
Of note, the parsed metadata also contains `title` and `is_premium` fields
```suggestion
content = traverse_obj(we... | 'only_matching': True,
}, {
'url': 'https://tarangplus.in/kids-shows/chhota-jaga/chhota-jaga-ep-33-jamidar-ra-khajana-adaya',
'only_matching': True,
}, {
'url': 'https://tarangplus.in/movies/swayambara',
'only_matching': True,
}]
def decrypt(self, data, key):
... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 26 | Python | 1 | refactor | 820 | 51 | 51 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
hidden_inputs_data = self._hidden_inputs(webpage)
json_ld_data = self._search_json_ld(webpage, display_id)
del json_ld_data['url']
iframe_div = get_element... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?tarangplus\.in/(?P<type>[^#?/]+)/(?P<id>[^#?/]+)/episodes/?(?:$|[?#])'
``` | return cipher.decrypt(base64.b64decode(data)).decode('utf-8')
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
hidden_inputs_data = self._hidden_inputs(webpage)
json_ld_data = self._search_json_ld(webpage, displ... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 26 | Python | 0.857 | suggestion | 128 | 51 | 51 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
import binascii
import functools
import re
from .common import InfoExtractor
from ..dependencies import Cryptodome
from ..utils import (
ExtractorError,
OnDemandPagedList,
extract_attributes,
get_element_by_id,
get_element_html_by_class,
get_element_text_and_html_by_tag,
get_elements_html_b... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?tarangplus\.in/(?:movies|[^#?/]+/[^#?/]+)/(?!episodes)(?P<id>[^#?/]+)'
``` | import binascii
import functools
import re
from .common import InfoExtractor
from ..dependencies import Cryptodome
from ..utils import (
ExtractorError,
OnDemandPagedList,
clean_html,
extract_attributes,
urljoin,
)
from ..utils.traversal import (
find_element,
find_elements,
require,
... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 26 | Python | 0.714 | suggestion | 128 | 51 | 51 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'id': 'dr-nonsense',
'title': 'Dr. Nonsense',
},
'playlist_mincount': 15,
}]
_PAGE_SIZE = 20
def _entries(self, playlist_url, playlist_id, page):
data = self._download_json(playlist_url, f'{playlist_id}-{page + 1}',
'Downloa... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?tarangplus\.in/(?P<id>[^#?/]+)/all/?(?:$|[?#])'
``` | 'url': 'https://tarangplus.in/tarangaplus-originals/balijatra/episodes',
'info_dict': {
'id': 'balijatra',
'title': 'Balijatra',
},
'playlist_mincount': 7,
}, {
'url': 'https://tarangplus.in/tarang-serials/bada-bohu/episodes',
'info_dict': {
... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 26 | Python | 0.714 | suggestion | 105 | 51 | 51 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'url': 'https://tarangplus.in/tarang-serials/bada-bohu/episodes',
'info_dict': {
'id': 'bada-bohu',
'title': 'Bada Bohu',
},
'playlist_mincount': 236,
}, {
'url': 'https://tarangplus.in/shows/dr-nonsense/episodes',
'info_dict': {
'i... | Let's reconstruct the URL using matches instead of doing the string manipulation
```suggestion
url_type, display_id = self._match_valid_url(url).group('type', 'id')
series_url = f'{self._BASE_URL}/{url_type}/{display_id}'
webpage = self._download_webpage('series_url, display_id)
``` | }),
'formats': self._extract_m3u8_formats(m3u8_url, display_id),
}
class TarangPlusEpisodesIE(TarangPlusBaseIE):
IE_NAME = 'tarangplus:episodes'
_VALID_URL = r'https?://(?:www\.)?tarangplus\.in/(?P<type>[^#?/]+)/(?P<id>[^#?/]+)/episodes/?(?:$|[?#])'
_TESTS = [{
'url... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 26 | Python | 1 | suggestion | 312 | 51 | 51 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
},
'playlist_mincount': 236,
}, {
'url': 'https://tarangplus.in/shows/dr-nonsense/episodes',
'info_dict': {
'id': 'dr-nonsense',
'title': 'Dr. Nonsense',
},
'playlist_mincount': 15,
}]
_PAGE_SIZE = 20
def _entries(self, playlist_ur... | Since my other suggestion is allowing query params and fragments and whatnot, let's construct the URL we pass again
```suggestion
entries = OnDemandPagedList(
functools.partial(self._entries, f'{series_url}/episodes', display_id),
self._PAGE_SIZE)
return self.playlist_resu... |
class TarangPlusEpisodesIE(TarangPlusBaseIE):
IE_NAME = 'tarangplus:episodes'
_VALID_URL = r'https?://(?:www\.)?tarangplus\.in/(?P<type>[^#?/]+)/(?P<id>[^#?/]+)/episodes/?(?:$|[?#])'
_TESTS = [{
'url': 'https://tarangplus.in/tarangaplus-originals/balijatra/episodes',
'info_dict': {
... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 26 | Python | 0.786 | suggestion | 405 | 51 | 51 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'title': 'Balijatra',
},
'playlist_mincount': 7,
}, {
'url': 'https://tarangplus.in/tarang-serials/bada-bohu/episodes',
'info_dict': {
'id': 'bada-bohu',
'title': 'Bada Bohu',
},
'playlist_mincount': 236,
}, {
'url': 'ht... | ```suggestion
data = self._download_json(
playlist_url, playlist_id, f'Downloading playlist JSON page {page + 1}',
query={'page_no': page})
for item in traverse_obj(data, ('items', ..., {str})):
yield self.url_result(
urljoin(self._BASE_URL, item... | **traverse_obj(hidden_inputs_data, {
'id': ('content_id', {str}),
'media_type': ('theme_type', {str}),
'categories': ('genre', {str}, filter, all, filter),
}),
'formats': self._extract_m3u8_formats(m3u8_url, display_id),
}
cla... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 26 | Python | 0.786 | suggestion | 360 | 51 | 51 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'id': 'latest-songs',
'title': 'Latest Songs',
},
'playlist_mincount': 46,
}, {
'url': 'https://tarangplus.in/premium-serials-episodes/all',
'info_dict': {
'id': 'premium-serials-episodes',
'title': 'Primetime Latest Episodes',
... | I prefer to use the traversal `find_element*` helpers whenever possible instead of the `get_element*` utils, since the latter are brittle and hard to remember how to use IMO
```suggestion
return self.playlist_result(
self._entries(webpage), display_id,
traverse_obj(webpage, ({fin... | 'title': 'Chhota Jaga',
},
'playlist_mincount': 33,
}, {
'url': 'https://tarangplus.in/kids-yali-show/all',
'info_dict': {
'id': 'kids-yali-show',
'title': 'Yali',
},
'playlist_mincount': 10,
}, {
'url': 'https://tarangp... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 26 | Python | 0.857 | refactor | 367 | 27 | 49 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'id': 'trailer',
'title': 'Trailer',
},
'playlist_mincount': 57,
}, {
'url': 'https://tarangplus.in/latest-songs/all',
'info_dict': {
'id': 'latest-songs',
'title': 'Latest Songs',
},
'playlist_mincount': 46,
}, {
... | ```suggestion
for url_path in traverse_obj(webpage, (
{find_elements(cls='item')}, ...,
{find_elements(tag='a', attr='href', value='/.+', html=True, regex=True)},
..., {extract_attributes}, 'href',
)):
yield self.url_result(urljoin(self._BASE_URL, ur... | class TarangPlusPlaylistIE(TarangPlusBaseIE):
IE_NAME = 'tarangplus:playlist'
_VALID_URL = r'https?://(?:www\.)?tarangplus\.in/(?P<id>[^#?/]+)/all/?(?:$|[?#])'
_TESTS = [{
'url': 'https://tarangplus.in/chhota-jaga/all',
'info_dict': {
'id': 'chhota-jaga',
'title': 'Ch... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 26 | Python | 0.857 | refactor | 434 | 34 | 51 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
import base64
import binascii
import functools
import re
from .common import InfoExtractor
from ..dependencies import Cryptodome
from ..utils import (
ExtractorError,
OnDemandPagedList,
extract_attributes,
get_element_by_id,
get_element_html_by_class,
get_element_text_and_html_by_tag,
get_e... | ```suggestion
clean_html,
extract_attributes,
urljoin,
)
from ..utils.traversal import (
find_element,
find_elements,
require,
traverse_obj,
)
``` | import base64
import binascii
import functools
import re
from .common import InfoExtractor
from ..dependencies import Cryptodome
from ..utils import (
ExtractorError,
OnDemandPagedList,
clean_html,
extract_attributes,
urljoin,
)
from ..utils.traversal import (
find_element,
find_elements,
... | @@ -0,0 +1,202 @@
+import base64
+import binascii
+import functools
+import re
+
+from .common import InfoExtractor
+from ..dependencies import Cryptodome
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ extract_attributes,
+ get_element_by_id,
+ get_element_html_by_class,
+ get_element... | yt_dlp/extractor/tarangplus.py | 14 | Python | 0.786 | refactor | 185 | 39 | 39 | false | [ie/tarangplus] Add extractors | 13,060 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'view_count': view_count,
'is_live': is_live,
}
def find_dmu(x):
data_movie_url = self._search_regex(
r'data-movie-url=(["\'])(?P<url>(?:(?!\1).)+)\1',
x, 'm3u8 url', group='url', default=None)
if data_movie_url:
... | ```suggestion
} if video_password else None
``` | 'view_count': view_count,
'is_live': is_live,
}
def find_dmu(x):
data_movie_url = self._search_regex(
r'data-movie-url=(["\'])(?P<url>(?:(?!\1).)+)\1',
x, 'm3u8 url', group='url', default=None)
if data_movie_url:
... | @@ -171,14 +173,18 @@ def find_dmu(x):
'player': 'pc_web',
})
+ password_params = {
+ 'word': hashlib.md5(video_password.encode()).hexdigest(),
+ } if video_password else {} | yt_dlp/extractor/twitcasting.py | 26 | Python | 0.571 | suggestion | 61 | 51 | 51 | false | [ie/twitcasting] Fix password-protected livestream extraction | 13,097 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
import itertools
import json
from .art19 import Art19IE
from .common import InfoExtractor
from ..networking.common import Request
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
int_or_none,
make_archive_id,
parse_iso8601,
smuggle_url,
try_call,
unsmuggle... | ```suggestion
from ..networking import PATCHRequest
``` | import itertools
import json
from .art19 import Art19IE
from .common import InfoExtractor
from ..networking import PATCHRequest
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
int_or_none,
make_archive_id,
parse_iso8601,
smuggle_url,
try_call,
unsmuggle_u... | @@ -3,6 +3,7 @@
from .art19 import Art19IE
from .common import InfoExtractor
+from ..networking.common import Request | yt_dlp/extractor/nebula.py | 6 | Python | 0.571 | suggestion | 57 | 31 | 31 | false | [ie/nebula] Support `--mark-watched` | 13,120 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | GeoffreyFrogeye |
'duration': ('duration', {int_or_none}),
'channel_id': 'channel_slug',
'uploader_id': 'channel_slug',
'channel': 'channel_title',
'uploader': 'channel_title',
'series': 'channel_title',
'creator': 'channel_ti... | ```suggestion
def _mark_watched(self, content_id, slug):
self._call_api(
PATCHRequest(f'https://content.api.nebula.app/{content_id.split(":")[0]}s/{content_id}/progress/'),
slug, 'Marking watched', 'Unable to mark watched', fatal=False,
data=json.dumps({'completed': ... | 'title': 'title',
'description': 'description',
'timestamp': ('published_at', {parse_iso8601}),
'duration': ('duration', {int_or_none}),
'channel_id': 'channel_slug',
'uploader_id': 'channel_slug',
'channel':... | @@ -111,6 +112,16 @@ def _extract_video_metadata(self, episode):
'uploader_url': channel_url,
}
+ def _mark_watched(self, content_id, slug):
+ data = {'completed': True}
+ req = Request(
+ f'https://content.api.nebula.app/{content_id.split(":")[0]}s/{content_id}/progr... | yt_dlp/extractor/nebula.py | 26 | Python | 0.929 | suggestion | 400 | 51 | 51 | false | [ie/nebula] Support `--mark-watched` | 13,120 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | GeoffreyFrogeye |
'description': 'md5:b4e2a14e3ff08f546a3209c75261e789',
'upload_date': '20230223',
'timestamp': 1677144070,
'channel': 'TLDR News EU',
'channel_id': 'tldrnewseu',
'uploader': 'TLDR News EU',
'uploader_id': 'tldrnewseu',
'uplo... | Could we just add a single `mark_watched` call to `NebulaBaseIE._extract_formats()` and remove all these other calls? | 'description': 'md5:b4e2a14e3ff08f546a3209c75261e789',
'upload_date': '20230223',
'timestamp': 1677144070,
'channel': 'TLDR News EU',
'channel_id': 'tldrnewseu',
'uploader': 'TLDR News EU',
'uploader_id': 'tldrnewseu',
'uplo... | @@ -221,6 +232,7 @@ def _real_extract(self, url):
slug = self._match_id(url)
url, smuggled_data = unsmuggle_url(url, {})
if smuggled_data.get('id'):
+ self.mark_watched(smuggled_data['id'], slug) | yt_dlp/extractor/nebula.py | 26 | Python | 0.571 | refactor | 117 | 51 | 51 | false | [ie/nebula] Support `--mark-watched` | 13,120 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | GeoffreyFrogeye |
'comment_count': int,
'channel_id': 'UCNMrnafwXD2XKeeQOyfkFCw',
'channel_follower_count': int,
'categories': ['Entertainment'],
'duration': 5269,
'upload_date': '20220514',
'age_limit': 0,
'channel': 'LTV_16plus',
... | assuming it's not harmful, could we do this
```suggestion
if embed_type in ('backscreen', 'telia'): # 'telia' only for backwards compat
``` | 'comment_count': int,
'channel_id': 'UCNMrnafwXD2XKeeQOyfkFCw',
'channel_follower_count': int,
'categories': ['Entertainment'],
'duration': 5269,
'upload_date': '20220514',
'age_limit': 0,
'channel': 'LTV_16plus',
... | @@ -208,7 +210,7 @@ def _real_extract(self, url):
r'window\.ltvEmbedPayload\s*=', webpage, 'embed json', video_id)
embed_type = traverse_obj(data, ('source', 'name', {str}))
- if embed_type == 'telia':
+ if embed_type == 'backscreen': | yt_dlp/extractor/lsm.py | 26 | Python | 0.929 | suggestion | 151 | 51 | 51 | false | [ie/lsm] Fix extraction | 13,126 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
def _real_extract(self, url):
video_id = urllib.parse.unquote(self._match_id(url))
webpage = self._download_webpage(url, video_id)
data = self._search_json(
r'window\.ltvEmbedPayload\s*=', webpage, 'embed json', video_id)
embed_type = traverse_obj(data, ('source', 'name',... | The other PR made this new path segment optional. Does the old URL format redirect to the new one? Or please explain | def _real_extract(self, url):
video_id = urllib.parse.unquote(self._match_id(url))
webpage = self._download_webpage(url, video_id)
data = self._search_json(
r'window\.ltvEmbedPayload\s*=', webpage, 'embed json', video_id)
embed_type = traverse_obj(data, ('source', 'name',... | @@ -226,9 +228,9 @@ def _real_extract(self, url):
class LSMReplayIE(InfoExtractor):
- _VALID_URL = r'https?://replay\.lsm\.lv/[^/?#]+/(?:ieraksts|statja)/[^/?#]+/(?P<id>\d+)'
+ _VALID_URL = r'https?://replay\.lsm\.lv/[^/?#]+/(?:skaties|klausies)/(?:ieraksts|statja)/[^/?#]+/(?P<id>\d+)' | yt_dlp/extractor/lsm.py | 26 | Python | 0.357 | style | 116 | 51 | 51 | false | [ie/lsm] Fix extraction | 13,126 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'md5': '84feb80fd7e6ec07744726a9f01cda4d',
'info_dict': {
'id': '183522',
'ext': 'm4a',
'duration': 1823,
'title': '#138 Nepilnīgā kompensējamo zāļu sistēma pat mēnešiem dzenā pacientus pa aptiekām',
'thumbnail': 'https://pic.latvijasradio.lv/p... | this can and should be fatal imo
```suggestion
playback_type = data['playback']['type']
``` | 'md5': '84feb80fd7e6ec07744726a9f01cda4d',
'info_dict': {
'id': '183522',
'ext': 'm4a',
'duration': 1823,
'title': '#138 Nepilnīgā kompensējamo zāļu sistēma pat mēnešiem dzenā pacientus pa aptiekām',
'thumbnail': 'https://pic.latvijasradio.lv/p... | @@ -267,12 +269,27 @@ def _real_extract(self, url):
data = self._search_nuxt_data(
self._fix_nuxt_data(webpage), video_id, context_name='__REPLAY__')
+ playback_type = traverse_obj(data, ('playback', 'type')) | yt_dlp/extractor/lsm.py | 26 | Python | 0.929 | suggestion | 102 | 51 | 51 | false | [ie/lsm] Fix extraction | 13,126 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'title': '#138 Nepilnīgā kompensējamo zāļu sistēma pat mēnešiem dzenā pacientus pa aptiekām',
'thumbnail': 'https://pic.latvijasradio.lv/public/assets/media/9/d/large_fd4675ac.jpg',
'upload_date': '20231102',
'timestamp': 1698913860,
'description': 'md5:7bac3b... | same here
```suggestion
'formats': self._extract_m3u8_formats(data['playback']['service']['hls_url'], video_id),
```
and do we want to try extracting subs from the m3u8 too? | 'title': '#138 Nepilnīgā kompensējamo zāļu sistēma pat mēnešiem dzenā pacientus pa aptiekām',
'thumbnail': 'https://pic.latvijasradio.lv/public/assets/media/9/d/large_fd4675ac.jpg',
'upload_date': '20231102',
'timestamp': 1698913860,
'description': 'md5:7bac3b... | @@ -267,12 +269,27 @@ def _real_extract(self, url):
data = self._search_nuxt_data(
self._fix_nuxt_data(webpage), video_id, context_name='__REPLAY__')
+ playback_type = traverse_obj(data, ('playback', 'type'))
+
+ if playback_type == 'playable_audio_lr':
+ playback_data =... | yt_dlp/extractor/lsm.py | 26 | Python | 0.786 | refactor | 195 | 49 | 49 | false | [ie/lsm] Fix extraction | 13,126 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'url': 'https://replay.lsm.lv/ru/skaties/statja/ltv/355067/v-kengaragse-nacalas-ukladka-relsov',
'only_matching': True,
}]
def _fix_nuxt_data(self, webpage):
return re.sub(r'Object\.create\(null(?:,(\{.+\}))?\)', lambda m: m.group(1) or 'null', webpage)
def _real_extract(self, url)... | ```suggestion
'url': data['playback']['service']['url'],
``` | 'url': 'https://replay.lsm.lv/ru/skaties/statja/ltv/355067/v-kengaragse-nacalas-ukladka-relsov',
'only_matching': True,
}, {
'url': 'https://replay.lsm.lv/lv/ieraksts/ltv/311130/4-studija-zolitudes-tragedija-un-incupes-stacija',
'only_matching': True,
}]
def _fix_nuxt_data(s... | @@ -267,12 +269,27 @@ def _real_extract(self, url):
data = self._search_nuxt_data(
self._fix_nuxt_data(webpage), video_id, context_name='__REPLAY__')
+ playback_type = traverse_obj(data, ('playback', 'type'))
+
+ if playback_type == 'playable_audio_lr':
+ playback_data =... | yt_dlp/extractor/lsm.py | 26 | Python | 0.571 | suggestion | 78 | 42 | 42 | false | [ie/lsm] Fix extraction | 13,126 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'url': 'https://replay.lsm.lv/lv/ieraksts/ltv/311130/4-studija-zolitudes-tragedija-un-incupes-stacija',
'only_matching': True,
}]
def _fix_nuxt_data(self, webpage):
return re.sub(r'Object\.create\(null(?:,(\{.+\}))?\)', lambda m: m.group(1) or 'null', webpage)
def _real_extract(sel... | ```suggestion
raise ExtractorError(f'Unsupported playback type "{playback_type}")
``` | 'url': 'https://replay.lsm.lv/lv/ieraksts/ltv/311130/4-studija-zolitudes-tragedija-un-incupes-stacija',
'only_matching': True,
}]
def _fix_nuxt_data(self, webpage):
return re.sub(r'Object\.create\(null(?:,(\{.+\}))?\)', lambda m: m.group(1) or 'null', webpage)
def _real_extract(sel... | @@ -267,12 +272,24 @@ def _real_extract(self, url):
data = self._search_nuxt_data(
self._fix_nuxt_data(webpage), video_id, context_name='__REPLAY__')
+ playback_type = data['playback']['type']
+
+ if playback_type == 'playable_audio_lr':
+ playback_data = {
+ ... | yt_dlp/extractor/lsm.py | 26 | Python | 0.786 | refactor | 99 | 39 | 39 | false | [ie/lsm] Fix extraction | 13,126 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'url': 'https://replay.lsm.lv/lv/ieraksts/ltv/311130/4-studija-zolitudes-tragedija-un-incupes-stacija',
'only_matching': True,
}]
def _fix_nuxt_data(self, webpage):
return re.sub(r'Object\.create\(null(?:,(\{.+\}))?\)', lambda m: m.group(1) or 'null', webpage)
def _real_extract(sel... | ```suggestion
raise ExtractorError(f'Unsupported playback type "{playback_type}"')
``` | 'url': 'https://replay.lsm.lv/lv/ieraksts/ltv/311130/4-studija-zolitudes-tragedija-un-incupes-stacija',
'only_matching': True,
}]
def _fix_nuxt_data(self, webpage):
return re.sub(r'Object\.create\(null(?:,(\{.+\}))?\)', lambda m: m.group(1) or 'null', webpage)
def _real_extract(sel... | @@ -267,12 +272,24 @@ def _real_extract(self, url):
data = self._search_nuxt_data(
self._fix_nuxt_data(webpage), video_id, context_name='__REPLAY__')
+ playback_type = data['playback']['type']
+
+ if playback_type == 'playable_audio_lr':
+ playback_data = {
+ ... | yt_dlp/extractor/lsm.py | 26 | Python | 0.929 | refactor | 100 | 39 | 39 | false | [ie/lsm] Fix extraction | 13,126 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Caesim404 |
'formats': formats,
'thumbnails': thumbnails,
# The best thumbnail that we are sure exists. Prevents unnecessary
# URL checking if user don't care about getting the best possible thumbnail
'thumbnail': traverse_obj(original_thumbnails, (-1, 'url')),
... | ```suggestion
else 'video'),
``` |
def is_bad_format(fmt):
if needs_live_processing and not fmt.get('is_from_start'):
return True
elif (live_status == 'is_live' and needs_live_processing != 'is_live'
and fmt.get('protocol') == 'http_dash_segments'):
return True
... | @@ -3787,7 +3789,10 @@ def is_bad_format(fmt):
'tags': keywords,
'playable_in_embed': get_first(playability_statuses, 'playableInEmbed'),
'live_status': live_status,
- 'media_type': 'livestream' if get_first(video_details, 'isLiveContent') else None,
+ 'media... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.571 | suggestion | 50 | 51 | 51 | false | [ie/youtube] Extract `media_type` for all videos | 13,136 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
def _entries(self, list_id):
total_count = 1
count = page_num = 0
while count < total_count:
json_parsed = self._download_json(
self._API_URL % (list_id, self._PAGE_SIZE, page_num + 1), list_id,
headers=self._API_HEADERS,
note='Down... | ```suggestion
IE_DESC = 'ニコニコ生放送'
_VALID_URL = r'https?://(?:sp\.)?live2?\.nicovideo\.jp/(?:watch|gate)/(?P<id>lv\d+)'
``` |
def _real_extract(self, url):
query = self._match_id(url)
return self.playlist_result(self._entries(url, query), query, query)
class NiconicoUserIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nicovideo\.jp/user/(?P<id>\d+)(?:/video)?/?(?:$|[#?])'
_TEST = {
'url': 'https://ww... | @@ -756,6 +754,7 @@ def _real_extract(self, url):
class NiconicoLiveIE(NiconicoBaseIE):
IE_NAME = 'niconico:live'
IE_DESC = 'ニコニコ生放送'
+
_VALID_URL = r'https?://(?:sp\.)?live2?\.nicovideo\.jp/(?:watch|gate)/(?P<id>lv\d+)' | yt_dlp/extractor/niconico.py | 26 | Python | 0.714 | suggestion | 133 | 51 | 51 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'description': '初めましてもかって言います❕\nのんびり自由に適当に暮らしてます',
'uploader': 'もか',
'channel': 'ゲストさんのコミュニティ',
'channel_id': 'co5776900',
'channel_url': 'https://com.nicovideo.jp/community/co5776900',
'timestamp': 1670677328,
'is_live': True,
... | ```suggestion
if err_msg := traverse_obj(webpage, ({find_element(cls='message')}, {clean_html})):
``` | count += 1
yield self.url_result(
f'https://www.nicovideo.jp/watch/{entry["essential"]["id"]}', ie=NiconicoIE)
page_num += 1
def _real_extract(self, url):
list_id = self._match_id(url)
return self.playlist_result(self._entries(list_id)... | @@ -787,41 +786,46 @@ class NiconicoLiveIE(NiconicoBaseIE):
def _real_extract(self, url):
video_id = self._match_id(url)
- webpage, urlh = self._download_webpage_handle(f'https://live.nicovideo.jp/watch/{video_id}', video_id)
-
- embedded_data = self._parse_json(unescapeHTML(self._search_r... | yt_dlp/extractor/niconico.py | 26 | Python | 0.714 | suggestion | 111 | 51 | 51 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'skip': 'livestream',
}, {
'url': 'https://live2.nicovideo.jp/watch/lv339533123',
'only_matching': True,
}, {
'url': 'https://sp.live.nicovideo.jp/watch/lv339533123',
'only_matching': True,
}, {
'url': 'https://sp.live2.nicovideo.jp/watch/lv339533123',
... | ```suggestion
embedded_data = traverse_obj(webpage, (
{find_element(tag='script', id='embedded-data', html=True)},
{extract_attributes}, 'data-props', {json.loads}))
frontend_id = traverse_obj(embedded_data, ('site', 'frontendId', {str_or_none}), default='9')
``` |
class NiconicoLiveIE(NiconicoBaseIE):
IE_NAME = 'niconico:live'
IE_DESC = 'ニコニコ生放送'
_VALID_URL = r'https?://(?:sp\.)?live2?\.nicovideo\.jp/(?:watch|gate)/(?P<id>lv\d+)'
_TESTS = [{
'note': 'this test case includes invisible characters for title, pasting them as-is',
'url': 'https://liv... | @@ -787,41 +786,46 @@ class NiconicoLiveIE(NiconicoBaseIE):
def _real_extract(self, url):
video_id = self._match_id(url)
- webpage, urlh = self._download_webpage_handle(f'https://live.nicovideo.jp/watch/{video_id}', video_id)
-
- embedded_data = self._parse_json(unescapeHTML(self._search_r... | yt_dlp/extractor/niconico.py | 26 | Python | 0.857 | refactor | 308 | 51 | 51 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'only_matching': True,
}, {
'url': 'https://sp.live2.nicovideo.jp/watch/lv339533123',
'only_matching': True,
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id, expected_status=404)
if err_msg := tra... | ```suggestion
ws_url = traverse_obj(embedded_data, ('site', 'relive', 'webSocketUrl', {url_or_none}, {require('websocket URL')}))
``` | _TESTS = [{
'note': 'this test case includes invisible characters for title, pasting them as-is',
'url': 'https://live.nicovideo.jp/watch/lv339533123',
'info_dict': {
'id': 'lv339533123',
'title': '激辛ペヤング食べます\u202a( ;ᯅ; )\u202c(歌枠オーディション参加中)',
'view_count'... | @@ -787,41 +786,46 @@ class NiconicoLiveIE(NiconicoBaseIE):
def _real_extract(self, url):
video_id = self._match_id(url)
- webpage, urlh = self._download_webpage_handle(f'https://live.nicovideo.jp/watch/{video_id}', video_id)
-
- embedded_data = self._parse_json(unescapeHTML(self._search_r... | yt_dlp/extractor/niconico.py | 26 | Python | 0.714 | suggestion | 143 | 51 | 51 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
while True:
recv = ws.recv()
if not recv:
continue
data = json.loads(recv)
if not isinstance(data, dict):
continue
if data.get('type') == 'stream':
m3u8_url = data['data']['uri']
qualities... | ```suggestion
raw_thumbs = traverse_obj(embedded_data, ('program', 'thumbnail', {dict})) or {}
``` | 'room': {
'commentable': True,
'protocol': 'webSocket',
},
'stream': {
'accessRightMethod': 'single_cookie',
'chasePlay': False,
'latency': 'high',
'pro... | @@ -841,17 +845,15 @@ def _real_extract(self, url):
raise ExtractorError('Disconnected at middle of extraction')
elif data.get('type') == 'error':
self.write_debug(recv)
- message = traverse_obj(data, ('body', 'code')) or recv
+ message = trav... | yt_dlp/extractor/niconico.py | 26 | Python | 0.714 | suggestion | 108 | 51 | 51 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
data = json.loads(recv)
if not data or not isinstance(data, dict):
continue
if data.get('type') == 'ping':
ws.send(r'{"type":"pong"}')
ws.send(r'{"type":"keepSeat"}')
e... | ```suggestion
f'[niconico:live] {video_id}: Connection error occured, reconnecting after 10 seconds: {e}')
``` | if not recv:
continue
data = json.loads(recv)
if not data or not isinstance(data, dict):
continue
if data.get('type') == 'ping':
ws.send(r'{"type":"pong"}')
... | @@ -81,7 +75,8 @@ def ws_main():
if ret is True:
return
except BaseException as e:
- self.to_screen('[{}] {}: Connection error occured, reconnecting after 10 seconds: {}'.format('niconico:live', video_id, str_or_none(e)))
+ ... | yt_dlp/downloader/niconico.py | 26 | Python | 0.857 | suggestion | 136 | 36 | 38 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
import json
import threading
import time
from .common import FileDownloader
from .external import FFmpegFD
from ..networking import Request
from ..utils import DownloadError, str_or_none, truncate_string
from ..utils.traversal import traverse_obj
class NiconicoLiveFD(FileDownloader):
""" Downloads niconico live ... | should we do this to support `--load-info-json`?
```suggestion
if reconnect or not isinstance(ws_extractor, WebSocketResponse):
``` | import json
import threading
import time
from .common import FileDownloader
from .external import FFmpegFD
from ..networking import Request
from ..networking.websocket import WebSocketResponse
from ..utils import DownloadError, str_or_none, truncate_string
from ..utils.traversal import traverse_obj
class NiconicoLiv... | @@ -5,47 +5,44 @@
from .common import FileDownloader
from .external import FFmpegFD
from ..networking import Request
-from ..utils import DownloadError, str_or_none, try_get
+from ..utils import DownloadError, str_or_none, truncate_string
+from ..utils.traversal import traverse_obj
class NiconicoLiveFD(FileDown... | yt_dlp/downloader/niconico.py | 25 | Python | 0.786 | refactor | 146 | 50 | 50 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
expire_time=unified_timestamp(cookie.get('expires')), path=cookie['path'], secure=cookie['secure'])
q_iter = (q for q in qualities[1:] if not q.startswith('audio_')) # ignore initial 'abr'
a_map = {96: 'audio_low', 192: 'audio_high'}
formats = self._extract_m3u8_formats(m3u8_u... | I kinda like moving this to `downloader_options` (and I assume it was necessary for tests to pass); however, we should document these in the `InfoExtractor` docstring, and we should set a default value for `max_quality` (`'high'`?)
```suggestion
'downloader_options': {
'max_quality': trav... |
for k, img_url in value.items():
res = parse_resolution(k, lenient=True) or parse_resolution(img_url, lenient=True)
width, height = res.get('width'), res.get('height')
thumbnails.append({
'id': f'{name}_{width}x{height}',
... | @@ -898,11 +894,16 @@ def _real_extract(self, url):
'abr': abr,
'format_id': a_map.get(abr, fmt['format_id']),
})
- fmt.update(fmt_common)
return {
'id': video_id,
'title': title,
+ 'downloader_options'... | yt_dlp/extractor/niconico.py | 26 | Python | 0.857 | refactor | 481 | 41 | 51 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
import json
import threading
import time
from .common import FileDownloader
from .external import FFmpegFD
from ..networking import Request
from ..utils import DownloadError, str_or_none, truncate_string
from ..utils.traversal import traverse_obj
class NiconicoLiveFD(FileDownloader):
""" Downloads niconico live ... | ```suggestion
opts = info_dict['downloader_options']
quality, ws_extractor, ws_url = opts['max_quality'], opts['ws'], opts['ws_url']
``` | import json
import threading
import time
from .common import FileDownloader
from .external import FFmpegFD
from ..networking import Request
from ..networking.websocket import WebSocketResponse
from ..utils import DownloadError, str_or_none, truncate_string
from ..utils.traversal import traverse_obj
class NiconicoLiv... | @@ -5,47 +5,44 @@
from .common import FileDownloader
from .external import FFmpegFD
from ..networking import Request
-from ..utils import DownloadError, str_or_none, try_get
+from ..utils import DownloadError, str_or_none, truncate_string
+from ..utils.traversal import traverse_obj
class NiconicoLiveFD(FileDown... | yt_dlp/downloader/niconico.py | 18 | Python | 0.786 | refactor | 155 | 43 | 43 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
import threading
import time
from .common import FileDownloader
from .external import FFmpegFD
from ..networking import Request
from ..networking.websocket import WebSocketResponse
from ..utils import DownloadError, str_or_none, truncate_string
from ..utils.traversal import traverse_obj
class NiconicoLiveFD(FileDown... | ```suggestion
# Support --load-info-json as if it is a reconnect attempt
if reconnect or not isinstance(ws_extractor, WebSocketResponse):
``` | import threading
import time
from .common import FileDownloader
from .external import FFmpegFD
from ..networking import Request
from ..networking.websocket import WebSocketResponse
from ..utils import DownloadError, str_or_none, truncate_string
from ..utils.traversal import traverse_obj
class NiconicoLiveFD(FileDown... | @@ -5,47 +5,45 @@
from .common import FileDownloader
from .external import FFmpegFD
from ..networking import Request
-from ..utils import DownloadError, str_or_none, try_get
+from ..networking.websocket import WebSocketResponse
+from ..utils import DownloadError, str_or_none, truncate_string
+from ..utils.traversal ... | yt_dlp/downloader/niconico.py | 26 | Python | 0.786 | refactor | 168 | 51 | 51 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'is_live': True,
},
'skip': 'livestream',
}, {
'url': 'https://live2.nicovideo.jp/watch/lv339533123',
'only_matching': True,
}, {
'url': 'https://sp.live.nicovideo.jp/watch/lv339533123',
'only_matching': True,
}, {
'url': 'https://sp.live2.... | oops, the line was too long (my original suggestion)
```suggestion
ws_url = traverse_obj(embedded_data, (
'site', 'relive', 'webSocketUrl', {url_or_none}, {require('websocket URL')}))
``` | 'is_live': True,
},
'skip': 'livestream',
}, {
'url': 'https://live2.nicovideo.jp/watch/lv339533123',
'only_matching': True,
}, {
'url': 'https://sp.live.nicovideo.jp/watch/lv339533123',
'only_matching': True,
}, {
'url': 'https://sp.live2.... | @@ -806,41 +808,38 @@ class NiconicoLiveIE(NiconicoBaseIE):
def _real_extract(self, url):
video_id = self._match_id(url)
- webpage, urlh = self._download_webpage_handle(f'https://live.nicovideo.jp/watch/{video_id}', video_id)
-
- embedded_data = self._parse_json(unescapeHTML(self._search_r... | yt_dlp/extractor/niconico.py | 26 | Python | 0.786 | refactor | 211 | 51 | 51 | false | [ie/niconico:live] Fix extractor and downloader | 13,158 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
}, {
'url': 'http://www.1tv.ru/shows/tochvtoch-supersezon/vystupleniya/evgeniy-dyatlov-vladimir-vysockiy-koni-priveredlivye-toch-v-toch-supersezon-fragment-vypuska-ot-06-11-2016',
'only_matching': True,
}, {
'url': 'https://www.sport1tv.ru/sport/chempionat-rossii-po-figurnomu-kataniyu-20... | ```suggestion
'url': src,
'ext': ext,
``` | }, {
'url': 'http://www.1tv.ru/shows/tochvtoch-supersezon/vystupleniya/evgeniy-dyatlov-vladimir-vysockiy-koni-priveredlivye-toch-v-toch-supersezon-fragment-vypuska-ot-06-11-2016',
'only_matching': True,
}, {
'url': 'https://www.sport1tv.ru/sport/chempionat-rossii-po-figurnomu-kataniyu-20... | @@ -57,96 +72,60 @@ class FirstTVIE(InfoExtractor):
'only_matching': True,
}]
+ def _entries(self, items):
+ for item in items:
+ video_id = str(item.get('id') or item['uid'])
+
+ formats, subtitles = [], {}
+ for f in traverse_obj(item, ('sources', lambda _, v... | yt_dlp/extractor/firsttv.py | 26 | Python | 0.571 | suggestion | 92 | 51 | 51 | false | [ie/1tv] Fix extractor | 13,168 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
'params': {'skip_download': 'm3u8'},
}, {
'url': 'http://www.1tv.ru/shows/tochvtoch-supersezon/vystupleniya/evgeniy-dyatlov-vladimir-vysockiy-koni-priveredlivye-toch-v-toch-supersezon-fragment-vypuska-ot-06-11-2016',
'only_matching': True,
}, {
'url': 'https://www.sport1tv.ru/spo... | ```suggestion
tbr = self._search_regex(fr'_(\d{{3,}})\.{ext}', src, 'tbr', default=None)
``` | 'params': {'skip_download': 'm3u8'},
}, {
'url': 'http://www.1tv.ru/shows/tochvtoch-supersezon/vystupleniya/evgeniy-dyatlov-vladimir-vysockiy-koni-priveredlivye-toch-v-toch-supersezon-fragment-vypuska-ot-06-11-2016',
'only_matching': True,
}, {
'url': 'https://www.sport1tv.ru/spo... | @@ -57,96 +72,60 @@ class FirstTVIE(InfoExtractor):
'only_matching': True,
}]
+ def _entries(self, items):
+ for item in items:
+ video_id = str(item.get('id') or item['uid'])
+
+ formats, subtitles = [], {}
+ for f in traverse_obj(item, ('sources', lambda _, v... | yt_dlp/extractor/firsttv.py | 26 | Python | 0.714 | suggestion | 114 | 51 | 51 | false | [ie/1tv] Fix extractor | 13,168 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
}, {
'url': 'https://www.sport1tv.ru/sport/chempionat-rossii-po-figurnomu-kataniyu-2025',
'only_matching': True,
}]
def _entries(self, items):
for item in items:
video_id = str(item.get('id') or item['uid'])
formats, subtitles = [], {}
for f in t... | ```suggestion
'tbr': int_or_none(tbr),
``` | }, {
'url': 'https://www.sport1tv.ru/sport/chempionat-rossii-po-figurnomu-kataniyu-2025',
'only_matching': True,
}]
def _entries(self, items):
for item in items:
video_id = str(item.get('id') or item['uid'])
formats, subtitles = [], {}
for f in t... | @@ -57,96 +72,60 @@ class FirstTVIE(InfoExtractor):
'only_matching': True,
}]
+ def _entries(self, items):
+ for item in items:
+ video_id = str(item.get('id') or item['uid'])
+
+ formats, subtitles = [], {}
+ for f in traverse_obj(item, ('sources', lambda _, v... | yt_dlp/extractor/firsttv.py | 26 | Python | 0.571 | suggestion | 68 | 51 | 51 | false | [ie/1tv] Fix extractor | 13,168 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
'release_timestamp': 1743512400,
'series': 'Star Trek: The Original Series',
'series_id': 'star-trek-the-original-series',
'thumbnail': r're:https?://.+\.(?:jpg|png)',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webp... | If we're hardcoding the language then this is a good candidate for `utils.traversal.subs_list_to_dict`.
(btw, core code already calls `determine_ext` on the url if there isn't an `ext` field present)
You could even inline this in the return
```suggestion
subtitles = traverse_obj(video_data, (
... | 'series': 'Star Trek: The Original Series',
'series_id': 'star-trek-the-original-series',
'thumbnail': r're:https?://.+\.(?:jpg|png)',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
... | @@ -1,76 +1,85 @@
from .common import InfoExtractor
-from ..utils import int_or_none, urljoin
+from ..utils import (
+ clean_html,
+ determine_ext,
+ parse_iso8601,
+ update_url,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
class StarTrekIE(InfoExtractor):
- _WORKING = False
- ... | yt_dlp/extractor/startrek.py | 26 | Python | 0.857 | suggestion | 398 | 45 | 36 | false | [ie/startrek] Fix extractor | 13,188 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
webpage, video_id), ('props', 'pageProps', {dict}), default={})
video_data = traverse_obj(page_props, ('video', 'data', {dict}))
if youtube_id := video_data.get('youtube_video_id'):
return self.url_result(youtube_id, 'Youtube')
series_id = traverse_obj(video_data, (
... | I like to `filter` before `all` to avoid returning empty strings in a list
any particular reason for the `str.upper` transformation?
```suggestion
'categories': ('category', 'data', 'category_name', {str.upper}, filter, all),
``` | from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import (
clean_html,
parse_iso8601,
update_url,
url_or_none,
)
from ..utils.traversal import subs_list_to_dict, traverse_obj
class StarTrekIE(InfoExtractor):
IE_NAME = 'startrek'
IE_DESC = 'STAR TREK'
_VALID_URL ... | @@ -1,76 +1,85 @@
from .common import InfoExtractor
-from ..utils import int_or_none, urljoin
+from ..utils import (
+ clean_html,
+ determine_ext,
+ parse_iso8601,
+ update_url,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
class StarTrekIE(InfoExtractor):
- _WORKING = False
- ... | yt_dlp/extractor/startrek.py | 26 | Python | 0.857 | suggestion | 251 | 33 | 77 | false | [ie/startrek] Fix extractor | 13,188 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'thumbnail': r're:https?://.+\.(?:jpg|png)',
},
}, {
'url': 'https://www.startrek.com/en-ca/videos/my-first-contact-senator-cory-booker',
'info_dict': {
'id': 'my-first-contact-senator-cory-booker',
'ext': 'mp4',
'title': 'My First Contact: Sen... | As I said in https://github.com/yt-dlp/yt-dlp/pull/13302#discussion_r2108411367, don't bother with `traverse_obj` if the rest of the extractor is broken without the data you're traversing for (unless you otherwise need the filtering/transformations/versatility of `traverse_obj`)
```suggestion
page_props = sel... | },
}, {
'url': 'https://www.startrek.com/en-ca/videos/my-first-contact-senator-cory-booker',
'info_dict': {
'id': 'my-first-contact-senator-cory-booker',
'ext': 'mp4',
'title': 'My First Contact: Senator Cory Booker',
'alt_title': 'md5:fe74a8bd... | @@ -1,76 +1,85 @@
from .common import InfoExtractor
-from ..utils import int_or_none, urljoin
+from ..utils import (
+ clean_html,
+ determine_ext,
+ parse_iso8601,
+ update_url,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
class StarTrekIE(InfoExtractor):
- _WORKING = False
- ... | yt_dlp/extractor/startrek.py | 26 | Python | 0.857 | bug | 437 | 51 | 48 | false | [ie/startrek] Fix extractor | 13,188 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'upload_date': '20240912',
'tags': 'count:5',
'thumbnail': r're:https?://.+/.+\.jpe?g',
'categories': ['Daiktiniai įrodymai'],
},
}, {
'url': 'https://www.lrt.lt/radioteka/irasas/2000304654/vakaras-su-knyga-svetlana-aleksijevic-cernobylio-malda-v-dalis... | if we're unpacking a traversal call now, we can pull `formats` out of there too
```suggestion
'id': video_id,
'formats': self._extract_m3u8_formats(media['playlist_item']['file'], video_id, 'mp4'),
**traverse_obj(media, {
'title': ('title', {str}),
... | 'upload_date': '20240912',
'tags': 'count:5',
'thumbnail': r're:https?://.+/.+\.jpe?g',
'categories': ['Daiktiniai įrodymai'],
},
}, {
'url': 'https://www.lrt.lt/radioteka/irasas/2000304654/vakaras-su-knyga-svetlana-aleksijevic-cernobylio-malda-v-dalis... | @@ -138,13 +137,15 @@ def _real_extract(self, url):
'https://www.lrt.lt/radioteka/api/media', video_id,
query={'url': f'/mediateka/irasas/{video_id}/{path}'})
- return traverse_obj(media, {
- 'id': ('id', {int}, {str_or_none}),
- 'title': ('title', {str}),
- ... | yt_dlp/extractor/lrt.py | 26 | Python | 0.857 | refactor | 706 | 29 | 29 | false | [ie/LRTRadio] Fix extractor | 13,200 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Pawka |
json_ld_data = self._search_json_ld(webpage, video_id)
tags = []
for tag in (media.get('tags') or []):
tag_name = tag.get('name')
if not tag_name:
continue
tags.append(tag_name)
clean_info = {
'description': clean_html(me... | Ah, I forgot the site is mostly(/all?) audio.
Maybe we should remove the `'mp4'` arg from the `_extract_m3u8_formats` call in that case.
However, audio-only AAC-over-HLS can be problematic sometimes when we download it as `m4a`.
There are a handful of sites/extractors where if we are downloading AAC HLS as `m... |
json_ld_data = self._search_json_ld(webpage, video_id)
tags = []
for tag in (media.get('tags') or []):
tag_name = tag.get('name')
if not tag_name:
continue
tags.append(tag_name)
clean_info = {
'description': clean_html(me... | @@ -118,7 +117,7 @@ class LRTRadioIE(LRTBaseIE):
'url': 'https://www.lrt.lt/radioteka/irasas/2000359728/nemarios-eiles-apie-pragarus-ir-skaistyklas-su-aiste-kiltinaviciute',
'info_dict': {
'id': '2000359728',
- 'ext': 'm4a',
+ 'ext': 'mp4', | yt_dlp/extractor/lrt.py | 26 | Python | 0.643 | refactor | 727 | 51 | 51 | false | [ie/LRTRadio] Fix extractor | 13,200 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Pawka |
'url': 'https://www.lrt.lt/radioteka/irasas/2000359728/nemarios-eiles-apie-pragarus-ir-skaistyklas-su-aiste-kiltinaviciute',
'info_dict': {
'id': '2000359728',
'ext': 'mp4',
'title': 'Nemarios eilės: apie pragarus ir skaistyklas su Aiste Kiltinavičiūte',
'... | ```suggestion
'formats': self._extract_m3u8_formats(media['playlist_item']['file'], video_id),
``` | 'url': 'https://www.lrt.lt/radioteka/irasas/2000359728/nemarios-eiles-apie-pragarus-ir-skaistyklas-su-aiste-kiltinaviciute',
'info_dict': {
'id': '2000359728',
'ext': 'm4a',
'title': 'Nemarios eilės: apie pragarus ir skaistyklas su Aiste Kiltinavičiūte',
'... | @@ -138,13 +137,15 @@ def _real_extract(self, url):
'https://www.lrt.lt/radioteka/api/media', video_id,
query={'url': f'/mediateka/irasas/{video_id}/{path}'})
- return traverse_obj(media, {
- 'id': ('id', {int}, {str_or_none}),
- 'title': ('title', {str}),
- ... | yt_dlp/extractor/lrt.py | 26 | Python | 0.786 | refactor | 112 | 36 | 36 | false | [ie/LRTRadio] Fix extractor | 13,200 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Pawka |
'url': re.sub(r'\d+x\d+(\.\w+)($|(?=[?#]))', r'0x0\g<1>', thumbnail),
'preference': 1,
}, {
'url': thumbnail,
}] if thumbnail else None
def _extract_twitch_m3u8_formats(self, path, video_id, token, signature):
formats = self._extract_m3u8_formats(
... | ```suggestion
fmt.setdefault('downloader_options', {})['ffmpeg_args_out'] = ['-f', 'mp4']
if self.get_param('live_from_start'):
fmt.setdefault('downloader_options', {})['ffmpeg_args'] = ['-live_start_index', '0']
``` | 'url': re.sub(r'\d+x\d+(\.\w+)($|(?=[?#]))', r'0x0\g<1>', thumbnail),
'preference': 1,
}, {
'url': thumbnail,
}] if thumbnail else None
def _extract_twitch_m3u8_formats(self, path, video_id, token, signature, live_from_start=False):
formats = self._extrac... | @@ -205,6 +205,8 @@ def _extract_twitch_m3u8_formats(self, path, video_id, token, signature):
if fmt.get('vcodec') and fmt['vcodec'].startswith('av01'):
# mpegts does not yet have proper support for av1
fmt['downloader_options'] = {'ffmpeg_args_out': ['-f', 'mp4']}
+ ... | yt_dlp/extractor/twitch.py | 26 | Python | 0.786 | suggestion | 264 | 51 | 51 | false | [ie/twitch] Support `--live-from-start` | 13,202 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
'title': 'Nobel Lecture by Peter Higgs',
'description': 'md5:9b12e275dbe3a8138484e70e00673a05',
'duration': 1800.0,
'thumbnail': r're:https?://www\.nobelprize\.org/images/.+\.jpg',
'timestamp': 1504883793,
'upload_date': '20170908',
},
... | is there a reason why we can't do this?
```suggestion
**self._search_json_ld(webpage, video_id),
```
(though you'd probably want to unpack this above the other fields so as not to overwrite them?) | from .common import InfoExtractor
from ..utils import (
UnsupportedError,
clean_html,
int_or_none,
parse_duration,
parse_qs,
str_or_none,
update_url,
)
from ..utils.traversal import find_element, traverse_obj
class NobelPrizeIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:mediaplayer|... | @@ -1,59 +1,62 @@
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- get_element_by_attribute,
- int_or_none,
- js_to_json,
- mimetype2ext,
- update_url_query,
+ clean_html,
+ parse_duration,
+ parse_qs,
+ unified_timestamp,
+ update_url,
+ url_or_none,
+)
+... | yt_dlp/extractor/nobelprize.py | 26 | Python | 0.786 | suggestion | 212 | 28 | 58 | false | [ie/nobelprize] Fix extractor | 13,205 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'title': 'Announcement of the 2016 Nobel Prize in Physics',
'description': 'md5:1a2d8a6ca80c88fb3b9a326e0b0e8e43',
'duration': 1560.0,
'thumbnail': r're:https?://www\.nobelprize\.org/images/.+\.jpg',
'timestamp': 1504883793,
'upload_date': '2017090... | I'd do this to maintain the old behavior
```suggestion
video_id = traverse_obj(parse_qs(url), (('id', 'qid'), -1, {int_or_none}, {str_or_none}, any))
if not video_id:
raise UnsupportedError(url)
webpage = self._download_webpage(
update_url(url, netloc='mediaplayer.n... | 'thumbnail': r're:https?://www\.nobelprize\.org/images/.+\.jpg',
'timestamp': 1504883793,
'upload_date': '20170908',
},
}, {
'url': 'https://mediaplayer.nobelprize.org/mediaplayer/?qid=12693',
'info_dict': {
'id': '12693',
'ext': 'm... | @@ -1,59 +1,62 @@
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- get_element_by_attribute,
- int_or_none,
- js_to_json,
- mimetype2ext,
- update_url_query,
+ clean_html,
+ parse_duration,
+ parse_qs,
+ unified_timestamp,
+ update_url,
+ url_or_none,
+)
+... | yt_dlp/extractor/nobelprize.py | 26 | Python | 0.929 | suggestion | 351 | 40 | 35 | false | [ie/nobelprize] Fix extractor | 13,205 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
def extract_chapter_information(e):
chapters = [{
'title': part.get('name'),
'start_time': part.get('startOffset'),
'end_time': part.get('endOffset'),
} for part in variadic(e.get('hasPart') or []) if part.get('@type') == 'Clip']
... | didn't realize `unescapeHTML` had that `assert` (which is dumb, but oh well):
```suggestion
'url': ({str}, {unescapeHTML}, {self._proto_relative_url}, {url_or_none}),
``` | def extract_chapter_information(e):
chapters = [{
'title': part.get('name'),
'start_time': part.get('startOffset'),
'end_time': part.get('endOffset'),
} for part in variadic(e.get('hasPart') or []) if part.get('@type') == 'Clip']
... | @@ -1675,9 +1675,9 @@ def extract_video_object(e):
'ext': mimetype2ext(e.get('encodingFormat')),
'title': unescapeHTML(e.get('name')),
'description': unescapeHTML(e.get('description')),
- 'thumbnails': [{'url': unescapeHTML(url)}
- ... | yt_dlp/extractor/common.py | 26 | Python | 0.714 | security | 193 | 51 | 51 | false | [ie/nobelprize] Fix extractor | 13,205 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
def extract_chapter_information(e):
chapters = [{
'title': part.get('name'),
'start_time': part.get('startOffset'),
'end_time': part.get('endOffset'),
} for part in variadic(e.get('hasPart') or []) if part.get('@type') == 'Clip']
... | ```suggestion
'thumbnails': traverse_obj(e, (('thumbnailUrl', 'thumbnailURL', 'thumbnail_url'), (None, ...), {
``` |
def extract_chapter_information(e):
chapters = [{
'title': part.get('name'),
'start_time': part.get('startOffset'),
'end_time': part.get('endOffset'),
} for part in variadic(e.get('hasPart') or []) if part.get('@type') == 'Clip']
... | @@ -1675,9 +1675,9 @@ def extract_video_object(e):
'ext': mimetype2ext(e.get('encodingFormat')),
'title': unescapeHTML(e.get('name')),
'description': unescapeHTML(e.get('description')),
- 'thumbnails': [{'url': unescapeHTML(url)}
- ... | yt_dlp/extractor/common.py | 26 | Python | 0.714 | suggestion | 132 | 51 | 51 | false | [ie/nobelprize] Fix extractor | 13,205 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'timestamp': 1504883793,
'upload_date': '20170908',
},
}, {
'url': 'https://mediaplayer.nobelprize.org/mediaplayer/?qid=12693',
'info_dict': {
'id': '12693',
'ext': 'mp4',
'title': 'Nobel Lecture by Peter Higgs',
'descri... | ```suggestion
**self._search_json_ld(webpage, video_id),
'id': video_id,
``` | },
}, {
'url': 'https://mediaplayer.nobelprize.org/mediaplayer/?qid=12693',
'info_dict': {
'id': '12693',
'ext': 'mp4',
'title': 'Nobel Lecture by Peter Higgs',
'description': 'md5:9b12e275dbe3a8138484e70e00673a05',
'duration': 1800... | @@ -1,59 +1,63 @@
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- get_element_by_attribute,
+ UnsupportedError,
+ clean_html,
int_or_none,
- js_to_json,
- mimetype2ext,
- update_url_query,
+ parse_duration,
+ parse_qs,
+ str_or_none,
+ unified_timestamp... | yt_dlp/extractor/nobelprize.py | 26 | Python | 0.714 | suggestion | 103 | 38 | 32 | false | [ie/nobelprize] Fix extractor | 13,205 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
UserNotLive,
int_or_none,
traverse_obj,
unified_strdate,
url_or_none,
urlencode_postdata,
)
class PandatvLiveIE(InfoExtractor):
_VALID_URL = r'(?P<base_url>https?://(?:www\.|m\.)?pandalive\.co\.kr)/play/(?P<id>[\da... | - is the site called "PandaTV"? or "PandaLive"? Calling the extractor "PandatvLive" seems confusing
- Since we never actually request the webpage, matching the origin from the input URL is pointless, we can just hardcode `https://www.pandalive.co.kr` below
- Are you sure there's never a `-` or `.` etc in the `ch... | from .common import InfoExtractor
from ..utils import (
ExtractorError,
UserNotLive,
filter_dict,
int_or_none,
join_nonempty,
parse_iso8601,
url_or_none,
urlencode_postdata,
)
from ..utils.traversal import traverse_obj
class PandaTvIE(InfoExtractor):
IE_DESC = 'pandalive.co.kr (팬더티... | @@ -0,0 +1,68 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandatvLiveIE(InfoExtractor):
+ _VALID_URL = r'(?P<base_url>https?://(?:www\.|m\.)?pand... | yt_dlp/extractor/pandatv.py | 14 | Python | 0.857 | refactor | 474 | 39 | 39 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
url_or_none,
urlencode_postdata,
)
class PandatvLiveIE(InfoExtractor):
_VALID_URL = r'(?P<base_url>https?://(?:www\.|m\.)?pandalive\.co\.kr)/play/(?P<id>[\da-z]+)'
_TESTS = [{
'url': 'https://www.pandalive.co.kr/play/bebenim',
'info_dict': {
'id': 'bebenim',
'ex... | per suggestion above
```suggestion
channel_id = self._match_id(url)
http_headers = {'Origin': 'https://www.pandalive.co.kr'}
``` | parse_iso8601,
url_or_none,
urlencode_postdata,
)
from ..utils.traversal import traverse_obj
class PandaTvIE(InfoExtractor):
IE_DESC = 'pandalive.co.kr (팬더티비)'
_VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/play/(?P<id>\w+)'
_TESTS = [{
'url': 'https://www.pandalive.co.kr/play... | @@ -0,0 +1,68 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandatvLiveIE(InfoExtractor):
+ _VALID_URL = r'(?P<base_url>https?://(?:www\.|m\.)?pand... | yt_dlp/extractor/pandatv.py | 26 | Python | 0.714 | suggestion | 148 | 51 | 51 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
'info_dict': {
'id': 'bebenim',
'ext': 'mp4',
'channel': '릴리ෆ',
'title': r're:앙앙❤ \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
'thumbnail': r're:https://cdn\.pandalive\.co\.kr/ivs/v1/.+/thumb.jpg',
'concurrent_view_count': int,
'like_count':... | - we can (and should) inline the POST data
- you don't need to include `200` in the `expected_status` tuple; it is implicit
- are there password-protected streams?
- these comments are unnecessary
```suggestion
video_meta = self._download_json(
'https://api.pandalive.co.kr/v1/live/play', chann... | _VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/play/(?P<id>\w+)'
_TESTS = [{
'url': 'https://www.pandalive.co.kr/play/bebenim',
'info_dict': {
'id': 'bebenim',
'ext': 'mp4',
'channel': '릴리ෆ',
'title': r're:앙앙❤ \d{4}-\d{2}-\d{2} \d{2}:\d{2}... | @@ -0,0 +1,68 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandatvLiveIE(InfoExtractor):
+ _VALID_URL = r'(?P<base_url>https?://(?:www\.|m\.)?pand... | yt_dlp/extractor/pandatv.py | 26 | Python | 1 | suggestion | 636 | 51 | 51 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
'upload_date': str,
},
'skip': 'The channel is not currently live',
}]
def _real_extract(self, url):
base_url, channel_id = self._match_valid_url(url).groups()
http_headers = {'Origin': base_url}
# Prepare POST data
post_data = {'action': 'watch', 'u... | - save the `error_code` so we can raise an unexpected error if it's something we're not aware of
- use `self.raise_login_required()` instead of writing your own cookies hint
```suggestion
if not video_meta.get('result'):
error_code = traverse_obj(video_meta, ('errorData', 'code', {str}))
... | 'concurrent_view_count': int,
'like_count': int,
'live_status': 'is_live',
'upload_date': str,
},
'skip': 'The channel is not currently live',
}]
def _real_extract(self, url):
channel_id = self._match_id(url)
video_meta = self._dow... | @@ -0,0 +1,68 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandatvLiveIE(InfoExtractor):
+ _VALID_URL = r'(?P<base_url>https?://(?:www\.|m\.)?pand... | yt_dlp/extractor/pandatv.py | 26 | Python | 1 | refactor | 654 | 44 | 51 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
http_headers = {'Origin': base_url}
# Prepare POST data
post_data = {'action': 'watch', 'userId': channel_id, 'password': '', 'shareLinkType': ''}
post_data_bytes = urlencode_postdata(post_data)
# Fetch video metadata
video_meta = self._download_json(
'https... | There's no point in making this non-fatal IMO
```suggestion
'formats': self._extract_m3u8_formats(
video_meta['PlayList']['hls'][0]['url'], channel_id, 'mp4', headers=http_headers, live=True),
``` |
def _real_extract(self, url):
channel_id = self._match_id(url)
video_meta = self._download_json(
'https://api.pandalive.co.kr/v1/live/play', channel_id,
'Downloading video meta data', 'Unable to download video meta data',
data=urlencode_postdata(filter_dict({
... | @@ -0,0 +1,68 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandatvLiveIE(InfoExtractor):
+ _VALID_URL = r'(?P<base_url>https?://(?:www\.|m\.)?pand... | yt_dlp/extractor/pandatv.py | 26 | Python | 0.857 | refactor | 228 | 37 | 51 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
post_data_bytes = urlencode_postdata(post_data)
# Fetch video metadata
video_meta = self._download_json(
'https://api.pandalive.co.kr/v1/live/play', channel_id, 'Downloading video meta data',
errnote=' Unable to download video meta data', data=post_data_bytes, expected_s... | can you show what the `startTime` value looks like? | 'https://api.pandalive.co.kr/v1/live/play', channel_id,
'Downloading video meta data', 'Unable to download video meta data',
data=urlencode_postdata(filter_dict({
'action': 'watch',
'userId': channel_id,
'password': self.get_param('vide... | @@ -0,0 +1,68 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandatvLiveIE(InfoExtractor):
+ _VALID_URL = r'(?P<base_url>https?://(?:www\.|m\.)?pand... | yt_dlp/extractor/pandatv.py | 26 | Python | 0.357 | question | 51 | 33 | 48 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
)
from .openrec import (
OpenRecCaptureIE,
OpenRecIE,
OpenRecMovieIE,
)
from .ora import OraTVIE
from .orf import (
ORFIPTVIE,
ORFONIE,
ORFFM4StoryIE,
ORFPodcastIE,
ORFRadioIE,
)
from .outsidetv import OutsideTVIE
from .owncloud import OwnCloudIE
from .packtpub import (
PacktPubCours... | ```suggestion
from .pandatv import PandaTvIE
``` | )
from .outsidetv import OutsideTVIE
from .owncloud import OwnCloudIE
from .packtpub import (
PacktPubCourseIE,
PacktPubIE,
)
from .palcomp3 import (
PalcoMP3ArtistIE,
PalcoMP3IE,
PalcoMP3VideoIE,
)
from .pandatv import PandaTvIE
from .panopto import (
PanoptoIE,
PanoptoListIE,
PanoptoPl... | @@ -1490,6 +1490,7 @@
PalcoMP3IE,
PalcoMP3VideoIE,
)
+from .pandatv import PandaTVIE | yt_dlp/extractor/_extractors.py | 26 | Python | 0.571 | suggestion | 50 | 51 | 51 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
UserNotLive,
int_or_none,
traverse_obj,
unified_strdate,
url_or_none,
urlencode_postdata,
)
class PandaTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/play/(?P<id>[\da-z]+)'
_TESTS ... | ```suggestion
class PandaTvIE(InfoExtractor):
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
UserNotLive,
filter_dict,
int_or_none,
join_nonempty,
parse_iso8601,
url_or_none,
urlencode_postdata,
)
from ..utils.traversal import traverse_obj
class PandaTvIE(InfoExtractor):
IE_DESC = 'pandalive.co.kr (팬더티... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandaTVIE(InfoExtractor): | yt_dlp/extractor/pandatv.py | 13 | Python | 0.643 | refactor | 51 | 38 | 38 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
UserNotLive,
int_or_none,
traverse_obj,
unified_strdate,
url_or_none,
urlencode_postdata,
)
class PandaTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/play/(?P<id>[\da-z]+)'
_TESTS ... | ```suggestion
'thumbnail': r're:https://cdn\.pandalive\.co\.kr/ivs/v1/.+/thumb\.jpg',
``` | from .common import InfoExtractor
from ..utils import (
ExtractorError,
UserNotLive,
filter_dict,
int_or_none,
join_nonempty,
parse_iso8601,
url_or_none,
urlencode_postdata,
)
from ..utils.traversal import traverse_obj
class PandaTvIE(InfoExtractor):
IE_DESC = 'pandalive.co.kr (팬더티... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandaTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/pla... | yt_dlp/extractor/pandatv.py | 22 | Python | 0.714 | suggestion | 103 | 47 | 47 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
class PandaTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/play/(?P<id>[\da-z]+)'
_TESTS = [{
'url': 'https://www.pandalive.co.kr/play/bebenim',
'info_dict': {
'id': 'bebenim',
'ext': 'mp4',
'channel': '릴리ෆ',
'title':... | if we're not using the headers in the api call then let's just inline them in the return
```suggestion
channel_id = self._match_id(url)
video_meta = self._download_json(
``` | )
from ..utils.traversal import traverse_obj
class PandaTvIE(InfoExtractor):
IE_DESC = 'pandalive.co.kr (팬더티비)'
_VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/play/(?P<id>\w+)'
_TESTS = [{
'url': 'https://www.pandalive.co.kr/play/bebenim',
'info_dict': {
'id': 'bebenim... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandaTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/pla... | yt_dlp/extractor/pandatv.py | 26 | Python | 0.714 | suggestion | 193 | 51 | 51 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
'info_dict': {
'id': 'bebenim',
'ext': 'mp4',
'channel': '릴리ෆ',
'title': r're:앙앙❤ \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
'thumbnail': r're:https://cdn\.pandalive\.co\.kr/ivs/v1/.+/thumb.jpg',
'concurrent_view_count': int,
'like_count':... | `password=None` is acceptable? shouldn't we use `filter_dict` here? it looks like we are catching the error code for "wrong password" and treating it as "no password". we need to filter the dict and catch error codes for both "wrong password" and "no password" and handle them separately | _VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/play/(?P<id>\w+)'
_TESTS = [{
'url': 'https://www.pandalive.co.kr/play/bebenim',
'info_dict': {
'id': 'bebenim',
'ext': 'mp4',
'channel': '릴리ෆ',
'title': r're:앙앙❤ \d{4}-\d{2}-\d{2} \d{2}:\d{2}... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandaTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/pla... | yt_dlp/extractor/pandatv.py | 26 | Python | 0.786 | bug | 287 | 51 | 51 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
elif error_code == 'needAdult':
self.raise_login_required('Adult verification is required for this stream')
elif error_code == 'needLogin':
self.raise_login_required('Login is required for this stream')
elif error_code == 'needCoinPurchase':
... | ```suggestion
'http_headers': {'Origin': 'https://www.pandalive.co.kr'},
``` | self.raise_login_required('Adult verification is required for this stream')
elif error_code == 'needLogin':
self.raise_login_required('Login is required for this stream')
elif error_code == 'needCoinPurchase':
raise ExtractorError('Coin purchase is... | @@ -0,0 +1,76 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ int_or_none,
+ traverse_obj,
+ unified_strdate,
+ url_or_none,
+ urlencode_postdata,
+)
+
+
+class PandaTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/pla... | yt_dlp/extractor/pandatv.py | 26 | Python | 0.571 | suggestion | 90 | 29 | 36 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
elif error_code == 'needUnlimitItem':
raise ExtractorError('Ticket purchase is required for this stream', expected=True)
elif error_code == 'needPw':
raise ExtractorError('Password protected video, use --video-password <password>', expected=True)
elif ... | are upcoming streams promoted on the website? i.e. is there a `release_timestamp` / `startTime` available before the stream starts? | elif error_code == 'needCoinPurchase':
raise ExtractorError('Coin purchase is required for this stream', expected=True)
elif error_code == 'needUnlimitItem':
raise ExtractorError('Ticket purchase is required for this stream', expected=True)
elif error_... | @@ -0,0 +1,78 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ filter_dict,
+ int_or_none,
+ parse_iso8601,
+ url_or_none,
+ urlencode_postdata,
+)
+from ..utils.traversal import traverse_obj
+
+
+class PandaTvIE(InfoExtractor):
+ _VALID_URL = r'htt... | yt_dlp/extractor/pandatv.py | 26 | Python | 0.5 | question | 131 | 28 | 33 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
'https://api.pandalive.co.kr/v1/live/play', channel_id,
'Downloading video meta data', 'Unable to download video meta data',
data=urlencode_postdata(filter_dict({
'action': 'watch',
'userId': channel_id,
'password': self.get_param('vide... | ```suggestion
error_msg = video_meta.get('message')
raise ExtractorError(join_nonempty(
'API returned error code', error_code,
error_msg and 'with error message:', error_msg,
delim=' '))
``` | channel_id = self._match_id(url)
video_meta = self._download_json(
'https://api.pandalive.co.kr/v1/live/play', channel_id,
'Downloading video meta data', 'Unable to download video meta data',
data=urlencode_postdata(filter_dict({
'action': 'watch',
... | @@ -0,0 +1,78 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ filter_dict,
+ int_or_none,
+ parse_iso8601,
+ url_or_none,
+ urlencode_postdata,
+)
+from ..utils.traversal import traverse_obj
+
+
+class PandaTvIE(InfoExtractor):
+ _VALID_URL = r'htt... | yt_dlp/extractor/pandatv.py | 26 | Python | 1 | refactor | 288 | 45 | 50 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
self.raise_login_required('Login is required for this stream')
elif error_code == 'needCoinPurchase':
raise ExtractorError('Coin purchase is required for this stream', expected=True)
elif error_code == 'needUnlimitItem':
raise ExtractorError('Ticke... | I'm guessing these are pre-muxed video+audio formats?
Returning `http_headers` in the info dict root won't work with ffmpeg if there are separate video and audio formats being downloaded
Though this is arguably a core problem and not this extractor's problem | self.raise_login_required('Adult verification is required for this stream')
elif error_code == 'needLogin':
self.raise_login_required('Login is required for this stream')
elif error_code == 'needCoinPurchase':
raise ExtractorError('Coin purchase is... | @@ -0,0 +1,78 @@
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ UserNotLive,
+ filter_dict,
+ int_or_none,
+ parse_iso8601,
+ url_or_none,
+ urlencode_postdata,
+)
+from ..utils.traversal import traverse_obj
+
+
+class PandaTvIE(InfoExtractor):
+ _VALID_URL = r'htt... | yt_dlp/extractor/pandatv.py | 26 | Python | 0.643 | refactor | 264 | 31 | 36 | false | [ie/pandatv] Add extractor | 13,210 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ptlydpr |
if error_code == 2204:
self._verify_video_password(event_id, path='event')
continue
if error_code == 3200:
raise ExtractorError(self._REFERER_HINT, expected=True)
if error_msg := response.get('error'):
... | missed this when refactoring; if we have `release_timestamp` then we know we have `start_time` too
```suggestion
self.raise_no_formats(f'This live event is scheduled for {start_time}', expected=True)
``` | raise
response = traverse_obj(e.cause.response.read(), ({json.loads}, {dict})) or {}
error_code = response.get('error_code')
if error_code == 2204:
self._verify_video_password(event_id, path='event')
continue
... | @@ -1626,3 +1648,376 @@ def _real_extract(self, url):
return self.url_result(vimeo_url, VimeoIE, video_id, url_transparent=True,
description=description)
+
+
+class VimeoEventIE(VimeoBaseInfoExtractor):
+ IE_NAME = 'vimeo:event'
+ _VALID_URL = r'https?://(?:www\.)?vimeo\... | yt_dlp/extractor/vimeo.py | 26 | Python | 0.857 | refactor | 218 | 51 | 51 | false | [ie/vimeo:event] Add extractor | 13,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
'uploader_url': 'https://vimeo.com/pawsneffect',
'comment_count': int,
'like_count': int,
'duration': 33115,
'thumbnail': r're:https://i\.vimeocdn\.com/video/\d+-[\da-f]+-d',
'timestamp': 1740261836,
'upload_date': '20250222',
... | Because of this, I'm not adding playlist/`--no-playlist` support. IMO the expected behavior here is to get the only video you are able to watch on the Vimeo website.
Another factor is that these streams are often several hours/GBs, and since `--yes-playlist` is the yt-dlp default, the unexpected/undesired playlist d... | 'url': 'https://vimeo.com/event/4940578',
'info_dict': {
'id': '1059263570',
'ext': 'mp4',
'display_id': '4940578',
'title': 'TMAC AKC AGILITY 2-22-2025',
'uploader': 'Paws \'N Effect',
'uploader_id': 'pawsneffect',
'upl... | @@ -1626,3 +1648,376 @@ def _real_extract(self, url):
return self.url_result(vimeo_url, VimeoIE, video_id, url_transparent=True,
description=description)
+
+
+class VimeoEventIE(VimeoBaseInfoExtractor):
+ IE_NAME = 'vimeo:event'
+ _VALID_URL = r'https?://(?:www\.)?vimeo\... | yt_dlp/extractor/vimeo.py | 26 | Python | 0.643 | suggestion | 376 | 51 | 51 | false | [ie/vimeo:event] Add extractor | 13,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
**self._hidden_inputs(password_form),
}), note='Logging in with video password')
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 418:
raise ExtractorError('Wrong video password', expected=True)
... | probably should break this line up | **self._hidden_inputs(password_form),
}), note='Logging in with video password')
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 418:
raise ExtractorError('Wrong video password', expected=True)
... | @@ -1626,3 +1648,376 @@ def _real_extract(self, url):
return self.url_result(vimeo_url, VimeoIE, video_id, url_transparent=True,
description=description)
+
+
+class VimeoEventIE(VimeoBaseInfoExtractor):
+ IE_NAME = 'vimeo:event'
+ _VALID_URL = r'https?://(?:www\.)?vimeo\... | yt_dlp/extractor/vimeo.py | 26 | Python | 0.143 | suggestion | 35 | 51 | 51 | false | [ie/vimeo:event] Add extractor | 13,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
'thumbnail': r're:https://i\.vimeocdn\.com/video/\d+-[\da-f]+-d',
'chapters': 'count:37',
'release_timestamp': 1744290000,
'release_date': '20250410',
'live_status': 'was_live',
},
'params': {'skip_download': 'm3u8'},
'expected_warnings... | test if it's safe to prune these | 'id': '1071439154',
'ext': 'mp4',
'display_id': '5034253',
'title': 'Advancing Humans with AI',
'description': r're:AI is here to stay, but how do we ensure that people flourish in a world of pervasive AI use.{322}$',
'uploader': 'MIT Media Lab',
... | @@ -1626,3 +1648,376 @@ def _real_extract(self, url):
return self.url_result(vimeo_url, VimeoIE, video_id, url_transparent=True,
description=description)
+
+
+class VimeoEventIE(VimeoBaseInfoExtractor):
+ IE_NAME = 'vimeo:event'
+ _VALID_URL = r'https?://(?:www\.)?vimeo\... | yt_dlp/extractor/vimeo.py | 26 | Python | 0.071 | suggestion | 32 | 51 | 51 | false | [ie/vimeo:event] Add extractor | 13,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
import functools
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
str_or_none,
strftime_or_none,
traverse_obj,
unified_timestamp,
url_or_none,
)
class VolejTVBaseIE(InfoExtractor):
_API_URL = 'https://api-volejtv-prod.apps.okd4.devopsie.cloud/api'
def _call... | IMO we only need the `_call_api` method **or** the `_API_URL` class constant; we don't need both. I'd prefer to inline the api base url in the method
```suggestion
def _call_api(self, endpoint, display_id, query=None):
return self._download_json(
f'https://api-volejtv-prod.apps.okd4.devops... | import functools
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
int_or_none,
join_nonempty,
orderedSet,
str_or_none,
strftime_or_none,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import (
require,
traverse_obj,
)
class VolejTVBaseIE(In... | @@ -1,40 +1,148 @@
+import functools
+
from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ str_or_none,
+ strftime_or_none,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VolejTVBaseIE(InfoExtractor):
+ _API_URL = 'https://api-volejtv-prod.apps.okd4.... | yt_dlp/extractor/volejtv.py | 19 | Python | 0.857 | suggestion | 375 | 44 | 44 | false | [ie/volejtv] Fix and add extractors | 13,226 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'series': 'ZLATÁ EVROPSKÁ VOLEJBALOVÁ LIGA',
'season': '2023-2024',
'timestamp': 1718553600,
'upload_date': '20240616',
},
}, {
'url': 'https://volej.tv/match/487520',
'info_dict': {
'id': '487520',
'ext': 'mp4',
... | `tbr_resolution_mapping` should be a class constant; also consider mapping the bitrates to height integers and returning `height` in the format dicts instead of a `format_note` (this will display a RESOLUTION of 1080p etc in the formats list) |
class VolejTVIE(VolejTVBaseIE):
IE_NAME = 'volejtv:match'
_VALID_URL = r'https?://volej\.tv/match/(?P<id>\d+)'
_TESTS = [{
'url': 'https://volej.tv/match/270579',
'info_dict': {
'id': '270579',
'ext': 'mp4',
'title': 'SWE-CZE (2024-06-16)',
'... | @@ -1,40 +1,148 @@
+import functools
+
from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ str_or_none,
+ strftime_or_none,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VolejTVBaseIE(InfoExtractor):
+ _API_URL = 'https://api-volejtv-prod.apps.okd4.... | yt_dlp/extractor/volejtv.py | 26 | Python | 0.643 | suggestion | 242 | 51 | 51 | false | [ie/volejtv] Fix and add extractors | 13,226 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'season': '2023-2024',
'timestamp': 1718553600,
'upload_date': '20240616',
},
}, {
'url': 'https://volej.tv/match/487520',
'info_dict': {
'id': '487520',
'ext': 'mp4',
'thumbnail': r're:https://.+\.(png|jpeg)',
... | ```suggestion
for video in traverse_obj(json_data, ('videos', 0, 'qualities', lambda _, v: v['cloud_front_path'])):
``` |
class VolejTVIE(VolejTVBaseIE):
IE_NAME = 'volejtv:match'
_VALID_URL = r'https?://volej\.tv/match/(?P<id>\d+)'
_TESTS = [{
'url': 'https://volej.tv/match/270579',
'info_dict': {
'id': '270579',
'ext': 'mp4',
'title': 'SWE-CZE (2024-06-16)',
'c... | @@ -1,40 +1,148 @@
+import functools
+
from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ str_or_none,
+ strftime_or_none,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VolejTVBaseIE(InfoExtractor):
+ _API_URL = 'https://api-volejtv-prod.apps.okd4.... | yt_dlp/extractor/volejtv.py | 26 | Python | 0.714 | suggestion | 129 | 51 | 51 | false | [ie/volejtv] Fix and add extractors | 13,226 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'url': 'https://volej.tv/match/487520',
'info_dict': {
'id': '487520',
'ext': 'mp4',
'thumbnail': r're:https://.+\.(png|jpeg)',
'title': 'CZE-FRA (2024-09-06)',
'categories': ['mládež'],
'series': 'Mistrovství Evropy do 20 let',
... | format metadata should not be fatal | 'url': 'https://volej.tv/match/270579',
'info_dict': {
'id': '270579',
'ext': 'mp4',
'title': 'SWE-CZE (2024-06-16)',
'categories': ['ženy'],
'series': 'ZLATÁ EVROPSKÁ VOLEJBALOVÁ LIGA',
'season': '2023-2024',
'timestamp... | @@ -1,40 +1,148 @@
+import functools
+
from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ str_or_none,
+ strftime_or_none,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VolejTVBaseIE(InfoExtractor):
+ _API_URL = 'https://api-volejtv-prod.apps.okd4.... | yt_dlp/extractor/volejtv.py | 26 | Python | 0.143 | style | 35 | 51 | 51 | false | [ie/volejtv] Fix and add extractors | 13,226 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
'categories': ['mládež'],
'series': 'Mistrovství Evropy do 20 let',
'season': '2024-2025',
'timestamp': 1725627600,
'upload_date': '20240906',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self... | `{str}` should suffice, yeah?
```suggestion
'series': ('competition_name', {str}),
'season': ('season', {str}),
``` | 'series': 'ZLATÁ EVROPSKÁ VOLEJBALOVÁ LIGA',
'season': '2023-2024',
'timestamp': 1718553600,
'upload_date': '20240616',
},
}, {
'url': 'https://volej.tv/match/487520',
'info_dict': {
'id': '487520',
'ext': 'mp4',
... | @@ -1,40 +1,148 @@
+import functools
+
from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ str_or_none,
+ strftime_or_none,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VolejTVBaseIE(InfoExtractor):
+ _API_URL = 'https://api-volejtv-prod.apps.okd4.... | yt_dlp/extractor/volejtv.py | 26 | Python | 0.786 | suggestion | 151 | 51 | 51 | false | [ie/volejtv] Fix and add extractors | 13,226 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
}]
def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self._call_api(f'match/{video_id}', video_id)
formats = []
tbr_resolution_mapping = {'6000': '1080p', '2400': '720p', '1500': '480p', '800': '360p'}
for video in traverse_obj(json_data, ('videos'... | ```suggestion
teams = traverse_obj(json_data, ('teams', ..., 'shortcut', {str}, {orderedSet}))
``` | 'info_dict': {
'id': '487520',
'ext': 'mp4',
'thumbnail': r're:https://.+\.(png|jpeg)',
'title': 'FRA-CZE (2024-09-06)',
'categories': ['mládež'],
'series': 'Mistrovství Evropy do 20 let',
'season': '2024-2025',
'tim... | @@ -1,40 +1,148 @@
+import functools
+
from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ str_or_none,
+ strftime_or_none,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VolejTVBaseIE(InfoExtractor):
+ _API_URL = 'https://api-volejtv-prod.apps.okd4.... | yt_dlp/extractor/volejtv.py | 26 | Python | 0.714 | suggestion | 108 | 51 | 51 | false | [ie/volejtv] Fix and add extractors | 13,226 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
}, {
'url': 'https://volej.tv/match/487520',
'info_dict': {
'id': '487520',
'ext': 'mp4',
'thumbnail': r're:https://.+\.(png|jpeg)',
'title': 'FRA-CZE (2024-09-06)',
'categories': ['mládež'],
'series': 'Mistrovství Evropy do 20 ... | ```suggestion
'height': ('quality', {self.TBR_HEIGHT_MAPPING.get}),
``` | 'id': '270579',
'ext': 'mp4',
'title': 'SWE-CZE (2024-06-16)',
'categories': ['ženy'],
'series': 'ZLATÁ EVROPSKÁ VOLEJBALOVÁ LIGA',
'season': '2023-2024',
'timestamp': 1718553600,
'upload_date': '20240616',
},
},... | @@ -1,40 +1,148 @@
+import functools
+
from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ join_nonempty,
+ orderedSet,
+ str_or_none,
+ strftime_or_none,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VolejTVBaseIE(InfoExtractor... | yt_dlp/extractor/volejtv.py | 26 | Python | 0.571 | suggestion | 89 | 51 | 51 | false | [ie/volejtv] Fix and add extractors | 13,226 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
import functools
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
int_or_none,
join_nonempty,
orderedSet,
str_or_none,
strftime_or_none,
traverse_obj,
unified_timestamp,
url_or_none,
)
class VolejTVBaseIE(InfoExtractor):
TBR_HEIGHT_MAPPING = {'6000':... | ```suggestion
TBR_HEIGHT_MAPPING = {
'6000': 1080,
'2400': 720,
'1500': 480,
'800': 360,
}
``` | import functools
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
int_or_none,
join_nonempty,
orderedSet,
str_or_none,
strftime_or_none,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import (
require,
traverse_obj,
)
class VolejTVBaseIE(In... | @@ -1,40 +1,148 @@
+import functools
+
from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ join_nonempty,
+ orderedSet,
+ str_or_none,
+ strftime_or_none,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VolejTVBaseIE(InfoExtractor... | yt_dlp/extractor/volejtv.py | 18 | Python | 0.714 | suggestion | 141 | 43 | 43 | false | [ie/volejtv] Fix and add extractors | 13,226 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
video_id = self._match_id(url)
json_data = self._call_api(f'match/{video_id}', video_id)
formats = []
for video in traverse_obj(json_data, ('videos', 0, 'qualities', lambda _, v: v['cloud_front_path'])):
formats.append(traverse_obj(video, {
'url': ('cloud_fron... | ```suggestion
data['title'] = join_nonempty(
join_nonempty(*teams, delim='-'),
strftime_or_none(data.get('timestamp'), '%Y-%m-%d'),
delim=' ')
``` | 'series': 'Mistrovství Evropy do 20 let',
'season': '2024-2025',
'timestamp': 1725627600,
'upload_date': '20240906',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self._call_api(f'match/{video_id}', video_... | @@ -1,40 +1,148 @@
+import functools
+
from .common import InfoExtractor
+from ..utils import (
+ InAdvancePagedList,
+ int_or_none,
+ join_nonempty,
+ orderedSet,
+ str_or_none,
+ strftime_or_none,
+ traverse_obj,
+ unified_timestamp,
+ url_or_none,
+)
+
+
+class VolejTVBaseIE(InfoExtractor... | yt_dlp/extractor/volejtv.py | 26 | Python | 0.714 | suggestion | 195 | 51 | 51 | false | [ie/volejtv] Fix and add extractors | 13,226 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | subrat-lima |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.