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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
formats = []
for quality in traverse_obj(stream, ('resource', 'data', 'qualityLevels', ...)):
url = urljoin(stream['cdn'], format_path(traverse_obj(
stream, ('resource', 'data', 'qualityLevelParams', quality['name'], {dict}))))
format_id = tra... | ```suggestion
hls_aes['key'] = urlh.read().hex()
formats.append({
``` |
formats = []
for quality in traverse_obj(stream, ('resource', 'data', 'qualityLevels', ...)):
url = urljoin(stream['cdn'], format_path(traverse_obj(
stream, ('resource', 'data', 'qualityLevelParams', quality['name'], {dict}))))
format_id = tra... | @@ -17,8 +17,133 @@
from ..utils.traversal import traverse_obj
-class FloatplaneIE(InfoExtractor):
+class FloatplaneBaseIE(InfoExtractor):
+ def _real_extract(self, url):
+ post_id = self._match_id(url)
+
+ post_data = self._download_json(
+ f'{self._BASE_URL}/api/v3/content/post', post... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.714 | suggestion | 114 | 51 | 51 | false | [ie/sauceplus] Add extractor | 13,567 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ceandreasen |
key_url = self._search_regex(
r'#EXT-X-KEY:METHOD=AES-128,URI="(https?://[^"]+)"',
m3u8_data, 'HLS AES key URI', default=None)
if key_url:
urlh = self._request_webpage(
key_url, media_id, fatal=False, imp... | On second thought, I'm a bit wary of returning this `hls_media_playlist_data` since it's not strictly necessary. Can you test how large the resulting `.info.json` file is when you add `--write-info-json` to your download command? | errnote=join_nonempty('Failed to download', format_id, 'm3u8 information', delim=' '))
if not m3u8_data:
continue
key_url = self._search_regex(
r'#EXT-X-KEY:METHOD=AES-128,URI="(https?://[^"]+)"',
... | @@ -17,8 +17,133 @@
from ..utils.traversal import traverse_obj
-class FloatplaneIE(InfoExtractor):
+class FloatplaneBaseIE(InfoExtractor):
+ def _real_extract(self, url):
+ post_id = self._match_id(url)
+
+ post_data = self._download_json(
+ f'{self._BASE_URL}/api/v3/content/post', post... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.571 | question | 229 | 51 | 51 | false | [ie/sauceplus] Add extractor | 13,567 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ceandreasen |
from .floatplane import FloatplaneBaseIE
class SauceplusIE(FloatplaneBaseIE):
_VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
_BASE_URL = 'https://www.sauceplus.com'
_HEADERS = {'Origin': _BASE_URL,
'Referer': _BASE_URL + '/'}
_IMPERSONATE_TARGET = 'chrome' ... | formatting
```suggestion
_HEADERS = {
'Origin': _BASE_URL,
'Referer': f'{_BASE_URL}/',
}
``` | from .floatplane import FloatplaneBaseIE
class SaucePlusIE(FloatplaneBaseIE):
IE_DESC = 'Sauce+'
_VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
_BASE_URL = 'https://www.sauceplus.com'
_HEADERS = {
'Origin': _BASE_URL,
'Referer': f'{_BASE_URL}/',
}
_... | @@ -0,0 +1,38 @@
+from .floatplane import FloatplaneBaseIE
+
+
+class SauceplusIE(FloatplaneBaseIE):
+ _VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
+ _BASE_URL = 'https://www.sauceplus.com'
+ _HEADERS = {'Origin': _BASE_URL,
+ 'Referer': _BASE_URL + '/'} | yt_dlp/extractor/sauceplus.py | 8 | Python | 0.714 | suggestion | 122 | 33 | 33 | false | [ie/sauceplus] Add extractor | 13,567 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ceandreasen |
**common_info,
'id': post_id,
'display_id': post_id,
**traverse_obj(post_data, {
'title': ('title', {str}),
'description': ('text', {clean_html}),
'like_count': ('likes', {int_or_none}),
'dislike_count': ('di... | should we do this for floatplane too?
```suggestion
_HEADERS = {
'Origin': _BASE_URL,
'Referer': f'{_BASE_URL}/',
}
``` | 'formats': formats,
})
post_info = {
**common_info,
'id': post_id,
'display_id': post_id,
**traverse_obj(post_data, {
'title': ('title', {str}),
'description': ('text', {clean_html}),
'li... | @@ -17,8 +17,133 @@
from ..utils.traversal import traverse_obj
-class FloatplaneIE(InfoExtractor):
+class FloatplaneBaseIE(InfoExtractor):
+ def _real_extract(self, url):
+ post_id = self._match_id(url)
+
+ post_data = self._download_json(
+ f'{self._BASE_URL}/api/v3/content/post', post... | yt_dlp/extractor/floatplane.py | 26 | Python | 0.786 | question | 149 | 51 | 51 | false | [ie/sauceplus] Add extractor | 13,567 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ceandreasen |
from .floatplane import FloatplaneBaseIE
class SauceplusIE(FloatplaneBaseIE):
_VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
_BASE_URL = 'https://www.sauceplus.com'
_HEADERS = {'Origin': _BASE_URL,
'Referer': _BASE_URL + '/'}
_IMPERSONATE_TARGET = 'chrome' ... | if we don't need `'chrome'` we can just use `True`
```suggestion
_IMPERSONATE_TARGET = True
``` | from .floatplane import FloatplaneBaseIE
class SaucePlusIE(FloatplaneBaseIE):
IE_DESC = 'Sauce+'
_VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
_BASE_URL = 'https://www.sauceplus.com'
_HEADERS = {
'Origin': _BASE_URL,
'Referer': f'{_BASE_URL}/',
}
_... | @@ -0,0 +1,38 @@
+from .floatplane import FloatplaneBaseIE
+
+
+class SauceplusIE(FloatplaneBaseIE):
+ _VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
+ _BASE_URL = 'https://www.sauceplus.com'
+ _HEADERS = {'Origin': _BASE_URL,
+ 'Referer': _BASE_URL + '/'}
+ _IMPE... | yt_dlp/extractor/sauceplus.py | 9 | Python | 0.786 | suggestion | 102 | 34 | 34 | false | [ie/sauceplus] Add extractor | 13,567 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ceandreasen |
from .floatplane import FloatplaneBaseIE
class SauceplusIE(FloatplaneBaseIE):
_VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
_BASE_URL = 'https://www.sauceplus.com'
_HEADERS = {
'Origin': _BASE_URL,
'Referer': f'{_BASE_URL}/',
}
_IMPERSONATE_TARGET = Tr... | I'm gonna be pedantic here (sorry), should this be `SaucePlusIE`? | from .floatplane import FloatplaneBaseIE
class SaucePlusIE(FloatplaneBaseIE):
IE_DESC = 'Sauce+'
_VALID_URL = r'https?://(?:(?:www|beta)\.)?sauceplus\.com/post/(?P<id>\w+)'
_BASE_URL = 'https://www.sauceplus.com'
_HEADERS = {
'Origin': _BASE_URL,
'Referer': f'{_BASE_URL}/',
}
_... | @@ -0,0 +1,40 @@
+from .floatplane import FloatplaneBaseIE
+
+
+class SauceplusIE(FloatplaneBaseIE): | yt_dlp/extractor/sauceplus.py | 4 | Python | 0.429 | question | 65 | 29 | 29 | false | [ie/sauceplus] Add extractor | 13,567 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ceandreasen |
RutubeEmbedIE,
RutubeIE,
RutubeMovieIE,
RutubePersonIE,
RutubePlaylistIE,
RutubeTagsIE,
)
from .rutv import RUTVIE
from .ruutu import RuutuIE
from .ruv import (
RuvIE,
RuvSpilaIE,
)
from .s4c import (
S4CIE,
S4CSeriesIE,
)
from .safari import (
SafariApiIE,
SafariCourseIE... | ```suggestion
from .sauceplus import SaucePlusIE
``` | RutubeEmbedIE,
RutubeIE,
RutubeMovieIE,
RutubePersonIE,
RutubePlaylistIE,
RutubeTagsIE,
)
from .rutv import RUTVIE
from .ruutu import RuutuIE
from .ruv import (
RuvIE,
RuvSpilaIE,
)
from .s4c import (
S4CIE,
S4CSeriesIE,
)
from .safari import (
SafariApiIE,
SafariCourseIE... | @@ -1824,6 +1824,7 @@
from .saitosan import SaitosanIE
from .samplefocus import SampleFocusIE
from .sapo import SapoIE
+from .sauceplus import SauceplusIE | yt_dlp/extractor/_extractors.py | 26 | Python | 0.571 | suggestion | 54 | 51 | 51 | false | [ie/sauceplus] Add extractor | 13,567 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | ceandreasen |
if not re.match(r'https?://', relinker_url):
return {'formats': [{'url': relinker_url}]}
# set User-Agent to generic 'Rai' to avoid quality filtering from
# the media server and get the maximum qualities available
relinker = self._download_xml(
relinker_url, vide... | by default, `determine_ext()` will always return a string, so we can simplify this
```suggestion
ext = determine_ext(media_url).lower()
``` | if not re.match(r'https?://', relinker_url):
return {'formats': [{'url': relinker_url}]}
# set User-Agent to generic 'Rai' to avoid quality filtering from
# the media server and get the maximum qualities available
relinker = self._download_xml(
relinker_url, vide... | @@ -82,6 +82,8 @@ def fix_cdata(s):
geoprotection = xpath_text(relinker, './geoprotection', default='N') == 'Y'
ext = determine_ext(media_url)
+ if ext:
+ ext = ext.lower() | yt_dlp/extractor/rai.py | 26 | Python | 0.786 | refactor | 150 | 51 | 51 | false | [ie/rai] Fix extraction on uppercase file extensions | 13,572 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | moonshinerd |
'info_dict': {
'id': '1ebae2a7-7cdb-42bb-842e-fe0d193e9707',
'ext': 'mp3',
'title': 'Il Ruggito del Coniglio del 10/12/2021',
'alt_title': 'md5:0e6476cd57858bb0f3fcc835d305b455',
'description': 'md5:2a17d2107e59a4a8faa0e18334139ee2',
'thumb... | what's the point of this? all tests should have real data. and we don't want to `skip` this; we want to actually test it | 'ext': 'mp3',
'title': 'Il Ruggito del Coniglio del 10/12/2021',
'alt_title': 'md5:0e6476cd57858bb0f3fcc835d305b455',
'description': 'md5:2a17d2107e59a4a8faa0e18334139ee2',
'thumbnail': r're:^https?://.+\.jpg$',
'uploader': 'rai radio 2',
... | @@ -503,6 +505,16 @@ class RaiPlaySoundIE(RaiBaseIE):
'upload_date': '20211201',
},
'params': {'skip_download': True},
+ }, {
+ # case-sensitivity test for uppercase extension
+ 'url': 'https://www.raiplaysound.it/audio/2020/05/Storia--Lunita-dItalia-e-lunificazione-della... | yt_dlp/extractor/rai.py | 26 | Python | 0.571 | question | 120 | 51 | 51 | false | [ie/rai] Fix extraction on uppercase file extensions | 13,572 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | moonshinerd |
'md5': '8970abf8caf8aef4696e7b1f2adfc696',
'info_dict': {
'id': '1ebae2a7-7cdb-42bb-842e-fe0d193e9707',
'ext': 'mp3',
'title': 'Il Ruggito del Coniglio del 10/12/2021',
'alt_title': 'md5:0e6476cd57858bb0f3fcc835d305b455',
'description': 'md5:2a... | you need to *actually run* the test script. it will fail and output the missing fields. copy/paste them and add them to the test data here. run the test again until it passes. commit the added test data. | 'md5': '8970abf8caf8aef4696e7b1f2adfc696',
'info_dict': {
'id': '1ebae2a7-7cdb-42bb-842e-fe0d193e9707',
'ext': 'mp3',
'title': 'Il Ruggito del Coniglio del 10/12/2021',
'alt_title': 'md5:0e6476cd57858bb0f3fcc835d305b455',
'description': 'md5:2a... | @@ -503,6 +503,15 @@ class RaiPlaySoundIE(RaiBaseIE):
'upload_date': '20211201',
},
'params': {'skip_download': True},
+ }, {
+ # case-sensitivity test for uppercase extension
+ 'url': 'https://www.raiplaysound.it/audio/2020/05/Storia--Lunita-dItalia-e-lunificazione-della... | yt_dlp/extractor/rai.py | 26 | Python | 0.429 | bug | 203 | 51 | 51 | false | [ie/rai] Fix extraction on uppercase file extensions | 13,572 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | moonshinerd |
elif m and m.group('function'):
fname = m.group('fname')
argvals = [self.interpret_expression(v, local_vars, allow_recursion)
for v in self._separate(m.group('args'))]
if fname in local_vars:
return local_vars[fname](argvals, allow_recu... | ```suggestion
(?<![a-zA-Z$0-9.])%s\s*=\s*{\s*
``` |
elif m and m.group('function'):
fname = m.group('fname')
argvals = [self.interpret_expression(v, local_vars, allow_recursion)
for v in self._separate(m.group('args'))]
if fname in local_vars:
return local_vars[fname](argvals, allow_recu... | @@ -857,7 +857,7 @@ def extract_object(self, objname, *global_stack):
obj = {}
obj_m = re.search(
r'''(?x)
- (?<!\.)%s\s*=\s*{\s*
+ (?<![a-zA-Z\.])%s\s*=\s*{\s* | yt_dlp/jsinterp.py | 26 | Python | 0.571 | suggestion | 67 | 51 | 51 | false | [jsinterp] Fix `extract_object` | 13,580 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class SkebIE(InfoExtractor):
_VALID_URL = r'https?://skeb\.jp/@(?P<uploader_id>[^/]+)/works/(?P<id>\d+)'
_TESTS = [{
'url': 'https://s... | ```suggestion
_VALID_URL = r'https?://skeb\.jp/@(?P<uploader_id>[^/?#]+)/works/(?P<id>\d+)'
``` | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
clean_html,
int_or_none,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class SkebIE(InfoExtractor):
_VALID_URL = r'https?://skeb\.jp/@(?P<uploader_id>[... | @@ -1,140 +1,103 @@
from .common import InfoExtractor
-from ..utils import ExtractorError, determine_ext, parse_qs, traverse_obj
+from ..utils import (
+ clean_html,
+ int_or_none,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal import traverse_obj
class SkebIE(InfoExtractor):
- _VALID_URL... | yt_dlp/extractor/skeb.py | 12 | Python | 0.714 | suggestion | 101 | 37 | 37 | false | [ie/skeb] Rework extractor | 13,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'id': '489408',
'ext': 'mp3',
'title': '3',
'description': 'md5:6de1f8f876426a6ac321c123848176a8',
'display_id': '3',
'duration': 98,
'genres': ['voice'],
'tags': 'count:11',
'thumbnail': r're:https?://.+',
... | UA is unnecessary in my testing
```suggestion
``` | 'ext': 'mp3',
'title': '3-1',
'description': 'md5:6de1f8f876426a6ac321c123848176a8',
'duration': 98,
'genres': ['voice'],
'tags': 'count:11',
'thumbnail': r're:https?://.+',
'uploader': '古川ノブ@宮城の動画勢Vtuber',
'uplo... | @@ -1,140 +1,117 @@
from .common import InfoExtractor
-from ..utils import ExtractorError, determine_ext, parse_qs, traverse_obj
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal i... | yt_dlp/extractor/skeb.py | 26 | Python | 0.571 | suggestion | 51 | 51 | 51 | false | [ie/skeb] Rework extractor | 13,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
if not isinstance(e.cause, HTTPError) or e.cause.status != 429:
raise
webpage = e.cause.response.read().decode()
value = self._search_regex(
r'document\.cookie\s*=\s*["\']request_key=([^;"\']+)', webpage, 'request key')
self._set_cookie('sk... | ```suggestion
if ext not in ('mp3', 'mp4'):
self.report_warning(f'Skipping unsupported extension "{ext}"')
continue
``` | try:
works = self._call_api(uploader_id, work_id)
except ExtractorError as e:
if not isinstance(e.cause, HTTPError) or e.cause.status != 429:
raise
webpage = e.cause.response.read().decode()
value = self._search_regex(
r'doc... | @@ -1,140 +1,117 @@
from .common import InfoExtractor
-from ..utils import ExtractorError, determine_ext, parse_qs, traverse_obj
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal i... | yt_dlp/extractor/skeb.py | 26 | Python | 0.714 | suggestion | 167 | 51 | 51 | false | [ie/skeb] Rework extractor | 13,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
}]
def _call_api(self, uploader_id, work_id):
return self._download_json(
f'https://skeb.jp/api/users/{uploader_id}/works/{work_id}', work_id, headers={
'Accept': 'application/json',
'Authorization': 'Bearer null',
'User-Agent': 'Mozilla/5.0 (... | I don't like duplicating the playlist id as the entries' `title` and `display_id`
`display_id` is redundant if it's the same as the playlist id, could be removed
if there's really no alternative we could use for the entries' `title`, then let's enumerate the `previews` and use `{work_id}-{idx}` | 'genres': ['video'],
},
'playlist_count': 2,
'expected_warnings': ['Skipping unsupported extension'],
}]
def _call_api(self, uploader_id, work_id):
return self._download_json(
f'https://skeb.jp/api/users/{uploader_id}/works/{work_id}', work_id, headers={
... | @@ -1,140 +1,117 @@
from .common import InfoExtractor
-from ..utils import ExtractorError, determine_ext, parse_qs, traverse_obj
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal i... | yt_dlp/extractor/skeb.py | 26 | Python | 0.643 | suggestion | 301 | 51 | 51 | false | [ie/skeb] Rework extractor | 13,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
def _real_extract(self, url):
uploader_id, work_id = self._match_valid_url(url).group('uploader_id', 'id')
try:
works = self._call_api(uploader_id, work_id)
except ExtractorError as e:
if not isinstance(e.cause, HTTPError) or e.cause.status != 429:
rai... | maybe starting from `1` would be more user-friendly? and might be nice to filter for a valid `url`
```suggestion
for idx, preview in enumerate(traverse_obj(works, ('previews', lambda _, v: url_or_none(v['url']))), 1):
``` | 'Accept': 'application/json',
'Authorization': 'Bearer null',
})
def _real_extract(self, url):
uploader_id, work_id = self._match_valid_url(url).group('uploader_id', 'id')
try:
works = self._call_api(uploader_id, work_id)
except Extrac... | @@ -1,140 +1,116 @@
from .common import InfoExtractor
-from ..utils import ExtractorError, determine_ext, parse_qs, traverse_obj
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal i... | yt_dlp/extractor/skeb.py | 26 | Python | 0.857 | suggestion | 232 | 51 | 51 | false | [ie/skeb] Rework extractor | 13,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
works = self._call_api(uploader_id, work_id)
info = {
'uploader_id': uploader_id,
**traverse_obj(works, {
'age_limit': ('nsfw', {bool}, {lambda x: 18 if x else None}),
'description': (('source_body', 'body'), {clean_html}, filter, any),
... | inline subs in the append call. also let's ditch hardcoding the bitrate and inline `vcodec` below too
```suggestion
``` | webpage = e.cause.response.read().decode()
value = self._search_regex(
r'document\.cookie\s*=\s*["\']request_key=([^;"\']+)', webpage, 'request key')
self._set_cookie('skeb.jp', 'request_key', value)
works = self._call_api(uploader_id, work_id)
in... | @@ -1,140 +1,116 @@
from .common import InfoExtractor
-from ..utils import ExtractorError, determine_ext, parse_qs, traverse_obj
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal i... | yt_dlp/extractor/skeb.py | 26 | Python | 0.714 | suggestion | 121 | 48 | 50 | false | [ie/skeb] Rework extractor | 13,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
'age_limit': ('nsfw', {bool}, {lambda x: 18 if x else None}),
'description': (('source_body', 'body'), {clean_html}, filter, any),
'genres': ('genre', {str}, filter, all, filter),
'tags': ('tag_list', ..., {str}, filter, all, filter),
'uplo... | subs extraction should be non-fatal
```suggestion
'subtitles': {
'ja': [{
'ext': 'vtt',
'url': preview['vtt_url'],
}],
} if url_or_none(preview.get('vtt_url')) else None,
'vcod... |
info = {
'uploader_id': uploader_id,
**traverse_obj(works, {
'age_limit': ('nsfw', {bool}, {lambda x: 18 if x else None}),
'description': (('source_body', 'body'), {clean_html}, filter, any),
'genres': ('genre', {str}, filter, all, filter)... | @@ -1,140 +1,116 @@
from .common import InfoExtractor
-from ..utils import ExtractorError, determine_ext, parse_qs, traverse_obj
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal i... | yt_dlp/extractor/skeb.py | 26 | Python | 0.857 | refactor | 363 | 43 | 45 | false | [ie/skeb] Rework extractor | 13,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
clean_html,
int_or_none,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class SkebIE(InfoExtractor):
_VALID_URL = r'https?://skeb\.jp/@(?P<uploader_id>[... | ```suggestion
'title': '10-1',
``` | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
clean_html,
int_or_none,
str_or_none,
url_or_none,
)
from ..utils.traversal import traverse_obj
class SkebIE(InfoExtractor):
_VALID_URL = r'https?://skeb\.jp/@(?P<uploader_id>[... | @@ -1,140 +1,116 @@
from .common import InfoExtractor
-from ..utils import ExtractorError, determine_ext, parse_qs, traverse_obj
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal i... | yt_dlp/extractor/skeb.py | 20 | Python | 0.429 | suggestion | 48 | 45 | 45 | false | [ie/skeb] Rework extractor | 13,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
url_or_none,
)
from ..utils.traversal import traverse_obj
class SkebIE(InfoExtractor):
_VALID_URL = r'https?://skeb\.jp/@(?P<uploader_id>[^/?#]+)/works/(?P<id>\d+)'
_TESTS = [{
'url': 'https://skeb.jp/@riiru_wm/works/10',
'info_dict': {
'id': '466853',
'ext': 'mp4',... | ```suggestion
'title': '3-1',
``` | url_or_none,
)
from ..utils.traversal import traverse_obj
class SkebIE(InfoExtractor):
_VALID_URL = r'https?://skeb\.jp/@(?P<uploader_id>[^/?#]+)/works/(?P<id>\d+)'
_TESTS = [{
'url': 'https://skeb.jp/@riiru_wm/works/10',
'info_dict': {
'id': '466853',
'ext': 'mp4',... | @@ -1,140 +1,116 @@
from .common import InfoExtractor
-from ..utils import ExtractorError, determine_ext, parse_qs, traverse_obj
+from ..networking.exceptions import HTTPError
+from ..utils import (
+ ExtractorError,
+ clean_html,
+ int_or_none,
+ str_or_none,
+ url_or_none,
+)
+from ..utils.traversal i... | yt_dlp/extractor/skeb.py | 26 | Python | 0.429 | suggestion | 47 | 51 | 51 | false | [ie/skeb] Rework extractor | 13,593 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
streaks_id = traverse_obj(video_info, ('streaks', 'videoRefID', {str}))
if streaks_id and not streaks_id.startswith('ref:'):
streaks_id = f'ref:{streaks_id}'
# Deprecated Brightcove extraction reachable w/extractor-arg or fallback; errors are expected
if backend == 'brightco... | I think I'd prefer to keep the change confined to the TVer extractor only (and revert the changes to `streaks.py`)
```suggestion
try:
streaks_info = self._extract_from_streaks_api(video_info['streaks']['projectID'], streaks_id, {
'Origin': 'https://tver.jp',
'Ref... | 'episode_number': ('no', {int_or_none}),
}),
}
brightcove_id = traverse_obj(video_info, ('video', ('videoRefID', 'videoID'), {str}, any))
if brightcove_id and not brightcove_id.isdecimal():
brightcove_id = f'ref:{brightcove_id}'
streaks_id = trav... | @@ -219,16 +219,17 @@ def _real_extract(self, url):
'_type': 'url_transparent',
'url': smuggle_url(
self.BRIGHTCOVE_URL_TEMPLATE % (account_id, brightcove_id),
- {'geo_countries': ['JP']}),
+ {'geo_countries': self._GEO_COUNTRI... | yt_dlp/extractor/tver.py | 26 | Python | 1 | refactor | 661 | 33 | 51 | false | [ie/TVer] Support `--ignore-no-formats-error` when geo-blocked | 13,598 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | arabcoders |
if backend != 'brightcove':
self.report_warning(
'No STREAKS ID found; falling back to Brightcove extraction', video_id=video_id)
if not brightcove_id:
raise ExtractorError('Unable to extract brightcove reference ID', expected=True)
... | ```suggestion
**streaks_info,
**metadata,
'id': video_id,
'_old_archive_ids': [make_archive_id('BrightcoveNew', brightcove_id)] if brightcove_id else None,
}
``` | brightcove_id = f'ref:{brightcove_id}'
streaks_id = traverse_obj(video_info, ('streaks', 'videoRefID', {str}))
if streaks_id and not streaks_id.startswith('ref:'):
streaks_id = f'ref:{streaks_id}'
# Deprecated Brightcove extraction reachable w/extractor-arg or fallback;... | @@ -219,16 +219,17 @@ def _real_extract(self, url):
'_type': 'url_transparent',
'url': smuggle_url(
self.BRIGHTCOVE_URL_TEMPLATE % (account_id, brightcove_id),
- {'geo_countries': ['JP']}),
+ {'geo_countries': self._GEO_COUNTRI... | yt_dlp/extractor/tver.py | 26 | Python | 0.786 | suggestion | 223 | 27 | 45 | false | [ie/TVer] Support `--ignore-no-formats-error` when geo-blocked | 13,598 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | arabcoders |
from .streaks import StreaksBaseIE
from ..utils import (
ExtractorError,
int_or_none,
join_nonempty,
make_archive_id,
smuggle_url,
str_or_none,
strip_or_none,
update_url_query,
)
from ..utils.traversal import require, traverse_obj
class TVerIE(StreaksBaseIE):
_VALID_URL = r'https?:... | import GeoRestrictedError from utils | if backend != 'brightcove':
self.report_warning(
'No STREAKS ID found; falling back to Brightcove extraction', video_id=video_id)
if not brightcove_id:
raise ExtractorError('Unable to extract brightcove reference ID', expected=True)
... | @@ -219,15 +219,22 @@ def _real_extract(self, url):
'_type': 'url_transparent',
'url': smuggle_url(
self.BRIGHTCOVE_URL_TEMPLATE % (account_id, brightcove_id),
- {'geo_countries': ['JP']}),
+ {'geo_countries': self._GEO_COUNTRI... | yt_dlp/extractor/tver.py | 26 | Python | 0.214 | suggestion | 36 | 242 | 37 | false | [ie/TVer] Support `--ignore-no-formats-error` when geo-blocked | 13,598 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | arabcoders |
import json
import urllib.parse
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
filter_dict,
float_or_none,
join_nonempty,
mimetype2ext,
parse_iso8601,
unsmuggle_url,
update_url_query,
url_or_none,
)
from ..utils.... | revert all of this in this file | import json
import urllib.parse
from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
filter_dict,
float_or_none,
join_nonempty,
mimetype2ext,
parse_iso8601,
unsmuggle_url,
update_url_query,
url_or_none,
)
from ..utils.... | @@ -22,7 +22,7 @@ class StreaksBaseIE(InfoExtractor):
_GEO_BYPASS = False
_GEO_COUNTRIES = ['JP']
- def _extract_from_streaks_api(self, project_id, media_id, headers=None, query=None, ssai=False):
+ def _extract_from_streaks_api(self, project_id, media_id, headers=None, query=None, ssai=False, metadat... | yt_dlp/extractor/streaks.py | 25 | Python | 0.071 | suggestion | 31 | 50 | 50 | false | [ie/TVer] Support `--ignore-no-formats-error` when geo-blocked | 13,598 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | arabcoders |
import itertools
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import int_or_none, traverse_obj, url_or_none, urljoin
class TenPlayIE(InfoExtractor):
IE_NAME = '10play'
_VALID_URL = r'https?://(?:www\.)?10(play)?\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
_NETRC... | all groups in a `_VALID_URL` pattern must be either named or non-capturing
```suggestion
_VALID_URL = r'https?://(?:www\.)?10(?:play)?\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
``` | import itertools
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import int_or_none, traverse_obj, url_or_none, urljoin
class TenPlayIE(InfoExtractor):
IE_NAME = '10play'
_VALID_URL = r'https?://(?:www\.)?10(?:play)?\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
_NET... | @@ -7,7 +7,7 @@
class TenPlayIE(InfoExtractor):
IE_NAME = '10play'
- _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
+ _VALID_URL = r'https?://(?:www\.)?10(play)?\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})' | yt_dlp/extractor/tenplay.py | 10 | Python | 0.714 | suggestion | 193 | 35 | 35 | false | [ie/tenplay] Support new 10.com.au domain | 13,611 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Georift |
return {
'id': content_id,
'formats': formats,
'subtitles': {'en': [{'url': data['captionUrl']}]} if url_or_none(data.get('captionUrl')) else None,
'uploader': 'Channel 10',
'uploader_id': '2199827728001',
**traverse_obj(data, {
... | same
```suggestion
_VALID_URL = r'https?://(?:www\.)?10(?:play)?\.com\.au/(?P<show>[^/?#]+)/episodes/(?P<season>[^/?#]+)/?(?:$|[?#])'
``` | formats = self._extract_m3u8_formats(m3u8_url, content_id, 'mp4')
return {
'id': content_id,
'formats': formats,
'subtitles': {'en': [{'url': data['captionUrl']}]} if url_or_none(data.get('captionUrl')) else None,
'uploader': 'Channel 10',
... | @@ -137,7 +137,7 @@ def _real_extract(self, url):
class TenPlaySeasonIE(InfoExtractor):
IE_NAME = '10play:season'
- _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?P<show>[^/?#]+)/episodes/(?P<season>[^/?#]+)/?(?:$|[?#])'
+ _VALID_URL = r'https?://(?:www\.)?10(play)?\.com\.au/(?P<show>[^/?#]+)/episode... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.714 | suggestion | 144 | 51 | 51 | false | [ie/tenplay] Support new 10.com.au domain | 13,611 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Georift |
import itertools
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import int_or_none, traverse_obj, url_or_none, urljoin
class TenPlayIE(InfoExtractor):
IE_NAME = '10play'
_VALID_URL = r'https?://(?:www\.)?10(play)?\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
_NETRC... | ~~can you change one of the *actual* tests (not just the `only_matching` test) to use the new domain? and share a log of the modified test running successfully, please~~ | import itertools
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import int_or_none, traverse_obj, url_or_none, urljoin
class TenPlayIE(InfoExtractor):
IE_NAME = '10play'
_VALID_URL = r'https?://(?:www\.)?10(?:play)?\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
_NET... | @@ -7,7 +7,7 @@
class TenPlayIE(InfoExtractor):
IE_NAME = '10play'
- _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
+ _VALID_URL = r'https?://(?:www\.)?10(play)?\.com\.au/(?:[^/?#]+/)+(?P<id>tpv\d{6}[a-z]{5})'
_NETRC_MACHINE = '10play'
_TESTS = [{
... | yt_dlp/extractor/tenplay.py | 13 | Python | 0.571 | suggestion | 169 | 38 | 38 | false | [ie/tenplay] Support new 10.com.au domain | 13,611 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Georift |
'thumbnail': r're:https?://resources\.newspicks\.com/.+\.(?:jpe?g|png)',
'timestamp': 1719086400,
'upload_date': '20240622',
},
}]
def _real_extract(self, url):
series_id = self._match_id(url)
video_id = traverse_obj(parse_qs(url), ('movieId', -1, {st... | If the provided `duration` is only accurate to the minute (rather than the second), then it's not worth extracting IMO, since such an inaccurate duration could potentially cause problems with postprocessing.
```suggestion
``` | 'timestamp': 1719086400,
'upload_date': '20240622',
},
}]
def _real_extract(self, url):
series_id = self._match_id(url)
video_id = traverse_obj(parse_qs(url), ('movieId', -1, {str}, {require('movie ID')}))
webpage = self._download_webpage(url, video_id)
... | @@ -1,53 +1,74 @@
-import re
-
from .common import InfoExtractor
-from ..utils import ExtractorError
+from ..utils import (
+ clean_html,
+ int_or_none,
+ parse_iso8601,
+ parse_qs,
+ url_or_none,
+)
+from ..utils.traversal import require, traverse_obj
class NewsPicksIE(InfoExtractor):
- _VALID_... | yt_dlp/extractor/newspicks.py | 26 | Python | 0.857 | refactor | 227 | 32 | 30 | false | [ie/newspicks] Rework Extractor | 13,612 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | doe1080 |
str_to_int,
traverse_obj,
try_call,
try_get,
unified_timestamp,
url_or_none,
variadic,
)
class _PoTokenContext(enum.Enum):
PLAYER = 'player'
GVS = 'gvs'
SUBS = 'subs'
class StreamingProtocol(enum.Enum):
HTTPS = 'https'
DASH = 'dash'
HLS = 'hls'
@dataclasses.data... | ```suggestion
# Try to fetch a PO Token even if it is not required.
``` | str_to_int,
traverse_obj,
try_call,
try_get,
unified_timestamp,
url_or_none,
variadic,
)
class _PoTokenContext(enum.Enum):
PLAYER = 'player'
GVS = 'gvs'
SUBS = 'subs'
class StreamingProtocol(enum.Enum):
HTTPS = 'https'
DASH = 'dash'
HLS = 'hls'
@dataclasses.data... | @@ -38,6 +39,60 @@ class _PoTokenContext(enum.Enum):
SUBS = 'subs'
+class StreamingProtocol(enum.Enum):
+ HTTPS = 'https'
+ DASH = 'dash'
+ HLS = 'hls'
+
+
+@dataclasses.dataclass
+class BasePoTokenPolicy:
+ required: bool = False
+ # Try fetch a PO Token even if it is not required. | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.571 | suggestion | 77 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
@dataclasses.dataclass
class BasePoTokenPolicy:
required: bool = False
# Try fetch a PO Token even if it is not required.
recommended: bool = False
not_required_for_premium: bool = False
@dataclasses.dataclass
class GvsPoTokenPolicy(BasePoTokenPolicy):
not_required_with_player_token: bool = False... | can we pull the `GVS_PO_TOKEN_POLICY` dict out into its own constant (`WEB_GVS_PO_TOKEN_POLICY`?) so that we can use it in `WEB_PO_TOKEN_POLICIES` as well as `web_creator`, `web_music` and `mweb`? |
@dataclasses.dataclass
class BasePoTokenPolicy:
required: bool = False
# Try to fetch a PO Token even if it is not required.
recommended: bool = False
not_required_for_premium: bool = False
@dataclasses.dataclass
class GvsPoTokenPolicy(BasePoTokenPolicy):
not_required_with_player_token: bool = Fa... | @@ -38,6 +39,60 @@ class _PoTokenContext(enum.Enum):
SUBS = 'subs'
+class StreamingProtocol(enum.Enum):
+ HTTPS = 'https'
+ DASH = 'dash'
+ HLS = 'hls'
+
+
+@dataclasses.dataclass
+class BasePoTokenPolicy:
+ required: bool = False
+ # Try fetch a PO Token even if it is not required.
+ recomme... | yt_dlp/extractor/youtube/_base.py | 26 | Python | 0.571 | question | 196 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
*formats, subtitles = self._extract_formats_and_subtitles(streaming_data, video_id, player_url, live_status, duration)
if all(f.get('has_drm') for f in formats):
# If there are no formats that definitely don't have DRM, all have DRM
for f in formats:
f['has_drm'] ... | is this all we use `webpage_ytcfg` for in this method? is it because the user's cookies are useless if the webpage was skipped? a comment is warranted here IMO | else 'is_upcoming' if is_upcoming
else 'was_live' if live_content
else 'not_live' if False in (is_live, live_content)
else None)
streaming_data = traverse_obj(player_responses, (..., 'streamingData'))
*formats, s... | @@ -3704,14 +3720,60 @@ def _list_formats(self, video_id, microformats, video_details, player_responses,
return live_broadcast_details, live_status, streaming_data, formats, subtitles
+ def _download_initial_data(self, video_id, webpage, webpage_client, webpage_ytcfg):
+ initial_data = None
+ ... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.571 | question | 159 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
f['has_drm'] = True
return live_broadcast_details, live_status, streaming_data, formats, subtitles
def _download_initial_data(self, video_id, webpage, webpage_client, webpage_ytcfg):
initial_data = None
if webpage and 'initial_data' not in self._configuration_arg('webpage_s... | fallback is unnecessary afaict
```suggestion
tlr = traverse_obj(
initial_data, ('topbar', 'desktopTopbarRenderer', 'logo', 'topbarLogoRenderer'))
```
but if it's needed for some reason I'm not seeing, then we should also expect the type
```suggestion
tlr = traverse_obj(initial_data, (... | streaming_data = traverse_obj(player_responses, (..., 'streamingData'))
*formats, subtitles = self._extract_formats_and_subtitles(streaming_data, video_id, player_url, live_status, duration)
if all(f.get('has_drm') for f in formats):
# If there are no formats that definitely don't ha... | @@ -3704,14 +3720,60 @@ def _list_formats(self, video_id, microformats, video_details, player_responses,
return live_broadcast_details, live_status, streaming_data, formats, subtitles
+ def _download_initial_data(self, video_id, webpage, webpage_client, webpage_ytcfg):
+ initial_data = None
+ ... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 1 | suggestion | 418 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
def _download_initial_data(self, video_id, webpage, webpage_client, webpage_ytcfg):
initial_data = None
if webpage and 'initial_data' not in self._configuration_arg('webpage_skip'):
initial_data = self.extract_yt_initial_data(video_id, webpage, fatal=False)
if not traverse_ob... | I don't see why we need the truthy check before traversal
```suggestion
return (
traverse_obj(tlr, ('iconImage', 'iconType')) == 'YOUTUBE_PREMIUM_LOGO'
or 'premium' in (self._get_text(tlr, 'tooltipText') or '').lower()
)
``` | for f in formats:
f['has_drm'] = True
return live_broadcast_details, live_status, streaming_data, formats, subtitles
def _download_initial_data(self, video_id, webpage, webpage_client, webpage_ytcfg):
initial_data = None
if webpage and 'initial_data' not in self... | @@ -3704,14 +3720,60 @@ def _list_formats(self, video_id, microformats, video_details, player_responses,
return live_broadcast_details, live_status, streaming_data, formats, subtitles
+ def _download_initial_data(self, video_id, webpage, webpage_client, webpage_ytcfg):
+ initial_data = None
+ ... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.929 | suggestion | 270 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
# Only web/mweb clients provide translationLanguages, so include initial_pr in the traversal
translation_languages = {
lang['languageCode']: self._get_text(lang['languageName'], max_runs=1)
for lang in traverse_obj(player_responses, (
..., 'captions', 'playerCapti... | don't we need `from __future__ import annotations` for 3.9 if we do this?
also, below we are accessing attributes of `pot_policy`, so there's no point to the `.get()` here:
```suggestion
pot_policy: GvsPoTokenPolicy = self._get_default_ytcfg(client_name)['SUBS_PO_TOKEN_POLICY']
``` | })
subtitles = {}
skipped_subs_clients = set()
# Only web/mweb clients provide translationLanguages, so include initial_pr in the traversal
translation_languages = {
lang['languageCode']: self._get_text(lang['languageName'], max_runs=1)
for lang ... | @@ -3984,7 +4046,7 @@ def process_language(container, base_url, lang_code, sub_name, client_name, quer
pctr = pr['captions']['playerCaptionsTracklistRenderer']
client_name = pr['streamingData'][STREAMING_DATA_CLIENT_NAME]
innertube_client_name = pr['streamingData'][STREAMING_DATA_... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.786 | suggestion | 300 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
remove_start(get_lang_code(sub), 'a-')
for sub in all_captions if sub.get('kind') == 'asr'}
for pr in prs:
pctr = pr['captions']['playerCaptionsTracklistRenderer']
client_name = pr['streamingData'][STREAMING_DATA_CLIENT_NAME]
innertube_client_name = p... | tempted to suggest a shorter attribute name like `premium_exempt` just to make some of these lines shorter lol | lambda _, v: v['streamingData'] and v['captions']['playerCaptionsTracklistRenderer']))
all_captions = traverse_obj(prs, (
..., 'captions', 'playerCaptionsTracklistRenderer', 'captionTracks', ..., {dict}))
need_subs_langs = {get_lang_code(sub) for sub in all_captions if sub.get('k... | @@ -3997,11 +4059,11 @@ def process_language(container, base_url, lang_code, sub_name, client_name, quer
requires_pot = (
# We can detect the experiment for now
any(e in traverse_obj(qs, ('exp', ...)) for e in ('xpe', 'xpv'))
- or _PoTokenCon... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.5 | suggestion | 110 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
# Normally tiny is the smallest video-only formats. But
# audio-only formats with unknown quality may get tagged as tiny
'tiny',
'audio_quality_ultralow', 'audio_quality_low', 'audio_quality_medium', 'audio_quality_high', # Audio only formats
'small', 'medium... | no reason for this not to be a method instead of a nested func IMO | # Normally tiny is the smallest video-only formats. But
# audio-only formats with unknown quality may get tagged as tiny
'tiny',
'audio_quality_ultralow', 'audio_quality_low', 'audio_quality_medium', 'audio_quality_high', # Audio only formats
'small', 'medium... | @@ -3323,6 +3314,15 @@ def build_fragments(f):
}),
} for range_start in range(0, f['filesize'], CHUNK_SIZE))
+ def pot_required(policy, is_premium_subscriber, has_player_token):
+ return (
+ policy.required
+ and not (policy.not_required_wi... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.286 | suggestion | 66 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
if player_url:
self.report_warning(
f'nsig extraction failed: Some formats may be missing\n'
f' n = {query["n"][0]} ; player = {player_url}\n'
f' {bug_reports_message(before=""... | ```suggestion
pot_policy: GvsPoTokenPolicy = self._get_default_ytcfg(client_name)['GVS_PO_TOKEN_POLICY'][StreamingProtocol.HTTPS]
``` | if player_url:
self.report_warning(
f'nsig extraction failed: Some formats may be missing\n'
f' n = {query["n"][0]} ; player = {player_url}\n'
f' {bug_reports_message(before=""... | @@ -3442,18 +3442,23 @@ def build_fragments(f):
self.report_warning(
'Some formats are possibly damaged. They will be deprioritized', video_id, only_once=True)
- po_token = fmt.get(STREAMING_DATA_INITIAL_PO_TOKEN)
+ fetch_po_token_func = fmt.get(STREAMING_DA... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.714 | suggestion | 147 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
self.write_debug(e, only_once=True)
else:
self.report_warning(
'Cannot decrypt nsig without player_url: Some formats may be missing',
video_id=video_id, only_once=True)
continu... | ```suggestion
pot_policy, fmt[STREAMING_DATA_IS_PREMIUM_SUBSCRIBER],
fmt[STREAMING_DATA_PLAYER_TOKEN_PROVIDED]))
``` | self.write_debug(e, only_once=True)
else:
self.report_warning(
'Cannot decrypt nsig without player_url: Some formats may be missing',
video_id=video_id, only_once=True)
continu... | @@ -3442,18 +3442,23 @@ def build_fragments(f):
self.report_warning(
'Some formats are possibly damaged. They will be deprioritized', video_id, only_once=True)
- po_token = fmt.get(STREAMING_DATA_INITIAL_PO_TOKEN)
+ fetch_po_token_func = fmt.get(STREAMING_DA... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.714 | suggestion | 159 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
except ExtractorError as e:
if player_url:
self.report_warning(
f'nsig extraction failed: Some formats may be missing\n'
f' n = {query["n"][0]} ; player = {player_url}\n'
... | ```suggestion
fetch_po_token_func = fmt[STREAMING_DATA_FETCH_GVS_PO_TOKEN]
``` | except ExtractorError as e:
if player_url:
self.report_warning(
f'nsig extraction failed: Some formats may be missing\n'
f' n = {query["n"][0]} ; player = {player_url}\n'
... | @@ -3442,18 +3442,23 @@ def build_fragments(f):
self.report_warning(
'Some formats are possibly damaged. They will be deprioritized', video_id, only_once=True)
- po_token = fmt.get(STREAMING_DATA_INITIAL_PO_TOKEN)
+ fetch_po_token_func = fmt.get(STREAMING_DA... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.571 | suggestion | 92 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
self.report_warning(
'Cannot decrypt nsig without player_url: Some formats may be missing',
video_id=video_id, only_once=True)
continue
tbr = float_or_none(fmt.get('averageBitrate') or fmt.get('bitrate'), 10... | line too long
```suggestion
po_token = (
gvs_pots.get(client_name)
or fetch_po_token_func(required=require_po_token or pot_policy.recommended))
``` | self.report_warning(
'Cannot decrypt nsig without player_url: Some formats may be missing',
video_id=video_id, only_once=True)
continue
tbr = float_or_none(fmt.get('averageBitrate') or fmt.get('bitrate'), 10... | @@ -3442,18 +3442,23 @@ def build_fragments(f):
self.report_warning(
'Some formats are possibly damaged. They will be deprioritized', video_id, only_once=True)
- po_token = fmt.get(STREAMING_DATA_INITIAL_PO_TOKEN)
+ fetch_po_token_func = fmt.get(STREAMING_DA... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.714 | refactor | 196 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
po_token = gvs_pots.get(client_name) or fetch_po_token_func(required=require_po_token or pot_policy.recommended)
if po_token:
fmt_url = update_url_query(fmt_url, {'pot': po_token})
if client_name not in gvs_pots:
gvs_pots[client_name] = po_to... | were we labeling all pot client formats as "MISSING POT" before this? oof |
po_token = (
gvs_pots.get(client_name)
or fetch_po_token_func(required=require_po_token or pot_policy.recommended))
if po_token:
fmt_url = update_url_query(fmt_url, {'pot': po_token})
if client_name not in gvs_pots:
... | @@ -3468,7 +3473,7 @@ def build_fragments(f):
name, fmt.get('isDrc') and 'DRC',
try_get(fmt, lambda x: x['projectionType'].replace('RECTANGULAR', '').lower()),
try_get(fmt, lambda x: x['spatialAudioType'].replace('SPATIAL_AUDIO_TYPE_', '').lower()),
- ... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.214 | style | 73 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
f['language_preference'] = PREFERRED_LANG_VALUE
if itag in ('616', '235'):
f['format_note'] = join_nonempty(f.get('format_note'), 'Premium', delim=' ')
f['source_preference'] += 100
f['quality'] = q(itag_qualities.get(try_get(f, lambda f: f['form... | ```suggestion
is_premium_subscriber = sd[STREAMING_DATA_IS_PREMIUM_SUBSCRIBER]
has_player_token = sd[STREAMING_DATA_PLAYER_TOKEN_PROVIDED]
``` | if original_language and f.get('language') == original_language:
f['format_note'] = join_nonempty(f.get('format_note'), '(default)', delim=' ')
f['language_preference'] = PREFERRED_LANG_VALUE
if itag in ('616', '235'):
f['format_note'] = join_none... | @@ -3591,39 +3587,59 @@ def process_manifest_format(f, proto, client_name, itag, po_token):
subtitles = {}
for sd in streaming_data:
client_name = sd[STREAMING_DATA_CLIENT_NAME]
- po_token = sd.get(STREAMING_DATA_INITIAL_PO_TOKEN)
+ fetch_pot_func = sd[STREAMING_DATA... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.714 | suggestion | 169 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
f['source_preference'] += 100
f['quality'] = q(itag_qualities.get(try_get(f, lambda f: f['format_id'].split('-')[0]), -1))
if f['quality'] == -1 and f.get('height'):
f['quality'] = q(res_qualities[min(res_qualities, key=lambda x: abs(x - f['height']))])
... | ```suggestion
pot_policy: GvsPoTokenPolicy = self._get_default_ytcfg(
client_name)['GVS_PO_TOKEN_POLICY'][StreamingProtocol.HLS]
``` | if itag in ('616', '235'):
f['format_note'] = join_nonempty(f.get('format_note'), 'Premium', delim=' ')
f['source_preference'] += 100
f['quality'] = q(itag_qualities.get(try_get(f, lambda f: f['format_id'].split('-')[0]), -1))
if f['quality'] == -1 an... | @@ -3591,39 +3587,59 @@ def process_manifest_format(f, proto, client_name, itag, po_token):
subtitles = {}
for sd in streaming_data:
client_name = sd[STREAMING_DATA_CLIENT_NAME]
- po_token = sd.get(STREAMING_DATA_INITIAL_PO_TOKEN)
+ fetch_pot_func = sd[STREAMING_DATA... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.714 | suggestion | 171 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
hls_manifest_url = 'hls' not in skip_manifests and sd.get('hlsManifestUrl')
if hls_manifest_url:
pot_policy: GvsPoTokenPolicy = self._get_default_ytcfg(client_name).get('GVS_PO_TOKEN_POLICY')[StreamingProtocol.HLS]
require_po_token = pot_required(pot_policy, is_pr... | ```suggestion
pot_policy: GvsPoTokenPolicy = self._get_default_ytcfg(
client_name)['GVS_PO_TOKEN_POLICY'][StreamingProtocol.DASH]
``` | has_player_token = sd[STREAMING_DATA_PLAYER_TOKEN_PROVIDED]
hls_manifest_url = 'hls' not in skip_manifests and sd.get('hlsManifestUrl')
if hls_manifest_url:
pot_policy: GvsPoTokenPolicy = self._get_default_ytcfg(
client_name)['GVS_PO_TOKEN_POLICY'... | @@ -3591,39 +3587,59 @@ def process_manifest_format(f, proto, client_name, itag, po_token):
subtitles = {}
for sd in streaming_data:
client_name = sd[STREAMING_DATA_CLIENT_NAME]
- po_token = sd.get(STREAMING_DATA_INITIAL_PO_TOKEN)
+ fetch_pot_func = sd[STREAMING_DATA... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.714 | suggestion | 172 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
if self.get_param('verbose') or all_formats:
f['format_note'] = join_nonempty(
f.get('format_note'), short_client_name(client_name), delim=', ')
if f.get('fps') and f['fps'] <= 1:
del f['fps']
if proto == 'hls' and f.get('has_drm')... | ```suggestion
if client_name not in gvs_pots:
gvs_pots[client_name] = po_token
``` | if f['quality'] == -1 and f.get('height'):
f['quality'] = q(res_qualities[min(res_qualities, key=lambda x: abs(x - f['height']))])
if self.get_param('verbose') or all_formats:
f['format_note'] = join_nonempty(
f.get('format_note'), short_client... | @@ -3591,39 +3587,59 @@ def process_manifest_format(f, proto, client_name, itag, po_token):
subtitles = {}
for sd in streaming_data:
client_name = sd[STREAMING_DATA_CLIENT_NAME]
- po_token = sd.get(STREAMING_DATA_INITIAL_PO_TOKEN)
+ fetch_pot_func = sd[STREAMING_DATA... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.714 | suggestion | 129 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
query.update(self._get_checkok_params())
initial_data = self._extract_response(
item_id=video_id, ep='next', fatal=False,
ytcfg=webpage_ytcfg, query=query, check_get_keys='contents',
note='Downloading initial data API JSON', default_client=webpage_... | ```suggestion
is_premium_subscriber = self._is_premium_subscriber(initial_data)
``` | query.update(self._get_checkok_params())
initial_data = self._extract_response(
item_id=video_id, ep='next', fatal=False,
ytcfg=webpage_ytcfg, query=query, check_get_keys='contents',
note='Downloading initial data API JSON', default_client=webpage_... | @@ -3704,14 +3725,60 @@ def _list_formats(self, video_id, microformats, video_details, player_responses,
return live_broadcast_details, live_status, streaming_data, formats, subtitles
+ def _download_initial_data(self, video_id, webpage, webpage_client, webpage_ytcfg):
+ initial_data = None
+ ... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.571 | suggestion | 93 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
streaming_data = traverse_obj(player_responses, (..., 'streamingData'))
*formats, subtitles = self._extract_formats_and_subtitles(streaming_data, video_id, player_url, live_status, duration)
if all(f.get('has_drm') for f in formats):
# If there are no formats that definitely don't ha... | ```suggestion
def _is_premium_subscriber(self, initial_data):
``` | streaming_data = traverse_obj(player_responses, (..., 'streamingData'))
*formats, subtitles = self._extract_formats_and_subtitles(streaming_data, video_id, player_url, live_status, duration)
if all(f.get('has_drm') for f in formats):
# If there are no formats that definitely don't ha... | @@ -3704,14 +3725,60 @@ def _list_formats(self, video_id, microformats, video_details, player_responses,
return live_broadcast_details, live_status, streaming_data, formats, subtitles
+ def _download_initial_data(self, video_id, webpage, webpage_client, webpage_ytcfg):
+ initial_data = None
+ ... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.571 | suggestion | 71 | 51 | 51 | false | [ie/youtube] Improve client PO Token enforcement policy | 13,640 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
import urllib
from .common import InfoExtractor
from ..utils import (
ExtractorError,
filter_dict,
unsmuggle_url,
)
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_BASE_URL = 'https://mir24.tv'
_HEADERS = {
'Origin': _BASE_URL,
... | we won't need `urllib` if we use `yt_dlp.utils.parse_qs` instead
```suggestion
from .common import InfoExtractor
``` | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,60 @@
+import urllib
+from .common import InfoExtractor | yt_dlp/extractor/mir24tv.py | 2 | Python | 0.786 | refactor | 119 | 27 | 27 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
ExtractorError,
filter_dict,
unsmuggle_url,
)
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_BASE_URL = 'https://mir24.tv'
_HEADERS = {
'Origin': _BASE_URL,
'Referer': f'{_BASE_URL}/',
}
_TESTS = [{
'url'... | unless there is another extractor that is smuggling data to this extractor, this is unnecessary
```suggestion
``` |
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii-otkrylis-v-uzbekistane.-na-prazdnichnom-koncerte-vystupili-zvezdy-rossijskoj-estrada',
'info_d... | @@ -0,0 +1,60 @@
+import urllib
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ filter_dict,
+ unsmuggle_url,
+)
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _BASE_URL = 'https://mir24.tv'
+ _HEADERS = {
+... | yt_dlp/extractor/mir24tv.py | 26 | Python | 0.786 | refactor | 115 | 51 | 35 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
'Origin': _BASE_URL,
'Referer': f'{_BASE_URL}/',
}
_TESTS = [{
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii-otkrylis-v-uzbekistane.-na-prazdnichnom-koncerte-vystupili-zvezdy-rossijskoj-estrada',
'info_dict': {
'id': '16635210',
'title': 'Дни к... | Let's keep it simple
```suggestion
webpage = self._download_webpage(url, video_id, impersonate=True)
``` | 'title': 'Дни культуры России открылись в Узбекистане. На праздничном концерте выступили звезды российской эстрады',
'ext': 'mp4',
'thumbnail': r're:https://images\.mir24\.tv/.+\.jpg',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
... | @@ -0,0 +1,60 @@
+import urllib
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ filter_dict,
+ unsmuggle_url,
+)
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _BASE_URL = 'https://mir24.tv'
+ _HEADERS = {
+... | yt_dlp/extractor/mir24tv.py | 26 | Python | 0.714 | suggestion | 115 | 49 | 26 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii-otkrylis-v-uzbekistane.-na-prazdnichnom-koncerte-vystupili-zvezdy-rossijskoj-estrada',
'info_dict': {
'id': '16635210',
'title': 'Дни культуры России открылись в Узбекистане. На праздничном концерте выступили звезды россий... | ```suggestion
iframe_url = self._search_regex(
r'<iframe\b[^>]+\bsrc=["\'](https?://mir24\.tv/players/[^"\']+)',
webpage, 'iframe URL')
``` | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,60 @@
+import urllib
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ filter_dict,
+ unsmuggle_url,
+)
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _BASE_URL = 'https://mir24.tv'
+ _HEADERS = {
+... | yt_dlp/extractor/mir24tv.py | 26 | Python | 0.714 | suggestion | 175 | 45 | 38 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
def _real_extract(self, url):
video_id = self._match_id(url)
url, smuggled_data = unsmuggle_url(url, {})
impersonate = self._configuration_arg('impersonate', [''])
try:
webpage = self._request_webpage(url, video_id, headers=filter_dict({
'Accept-Encoding'... | We can use `traverse_obj` and its transformation syntax with `yt_dlp.utils.parse_qs` and other utils to reduce this to a couple lines of code:
```suggestion
m3u8_url = traverse_obj(iframe_url, (
{parse_qs}, 'source', -1, {self._proto_relative_url}, {url_or_none}, {require('m3u8 URL')}))
``` | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,60 @@
+import urllib
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ filter_dict,
+ unsmuggle_url,
+)
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _BASE_URL = 'https://mir24.tv'
+ _HEADERS = {
+... | yt_dlp/extractor/mir24tv.py | 26 | Python | 0.857 | suggestion | 315 | 36 | 38 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
import urllib
from .common import InfoExtractor
from ..utils import (
ExtractorError,
filter_dict,
unsmuggle_url,
)
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_BASE_URL = 'https://mir24.tv'
_HEADERS = {
'Origin': _BASE_URL,
... | if my other suggestions are applied, we'll need these instead:
```suggestion
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
``` | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,60 @@
+import urllib
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ filter_dict,
+ unsmuggle_url,
+) | yt_dlp/extractor/mir24tv.py | 7 | Python | 0.786 | suggestion | 178 | 32 | 32 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
import urllib
from .common import InfoExtractor
from ..utils import (
ExtractorError,
filter_dict,
unsmuggle_url,
)
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_BASE_URL = 'https://mir24.tv'
_HEADERS = {
'Origin': _BASE_URL,
... | If you modeled this after another extractor, you should know that the `_BASE_URL` and `_HEADERS` constants are not required for all extractors. It's just a common convention that the other extractor elected to use. They're not necessary in this extractor, so we can remove:
```suggestion
``` | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,60 @@
+import urllib
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ filter_dict,
+ unsmuggle_url,
+)
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _BASE_URL = 'https://mir24.tv'
+ _HEADERS = {
+... | yt_dlp/extractor/mir24tv.py | 15 | Python | 0.857 | refactor | 293 | 40 | 38 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
import urllib
from .common import InfoExtractor
from ..utils import (
ExtractorError,
filter_dict,
unsmuggle_url,
)
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_BASE_URL = 'https://mir24.tv'
_HEADERS = {
'Origin': _BASE_URL,
... | again, not necessary
```suggestion
``` | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,60 @@
+import urllib
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ filter_dict,
+ unsmuggle_url,
+)
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _BASE_URL = 'https://mir24.tv'
+ _HEADERS = {
+... | yt_dlp/extractor/mir24tv.py | 25 | Python | 0.429 | suggestion | 40 | 50 | 38 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
'Accept-Encoding': 'identity',
'Referer': smuggled_data.get('referer'),
}), impersonate=impersonate)
except ExtractorError:
raise ExtractorError('try again with --extractor-args "generic:impersonate"', expected=True)
webpage = webpage.read().decod... | The `_og_search_title()` and `_html_search_meta('og:title', ...)` do the exact same thing. Use a different fallback, and inline this in the return:
```suggestion
return {
'id': video_id,
'title': self._og_search_title(webpage, default=None) or self._html_extract_title(webpage),
``` | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,60 @@
+import urllib
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ filter_dict,
+ unsmuggle_url,
+)
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _BASE_URL = 'https://mir24.tv'
+ _HEADERS = {
+... | yt_dlp/extractor/mir24tv.py | 26 | Python | 0.857 | refactor | 319 | 29 | 38 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
'Referer': smuggled_data.get('referer'),
}), impersonate=impersonate)
except ExtractorError:
raise ExtractorError('try again with --extractor-args "generic:impersonate"', expected=True)
webpage = webpage.read().decode()
iframe_url = self._search_regex(
... | Do any videos on this site have subtitles? | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,60 @@
+import urllib
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ filter_dict,
+ unsmuggle_url,
+)
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _BASE_URL = 'https://mir24.tv'
+ _HEADERS = {
+... | yt_dlp/extractor/mir24tv.py | 26 | Python | 0.071 | question | 42 | 28 | 38 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii-... | ```suggestion
class Mir24tvIE(InfoExtractor):
``` | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,32 @@
+from .common import InfoExtractor
+from ..utils import parse_qs, url_or_none
+from ..utils.traversal import require, traverse_obj
+
+class Mir24tvIE(InfoExtractor): | yt_dlp/extractor/mir24tv.py | 5 | Python | 0.643 | refactor | 55 | 30 | 30 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii-otkrylis-v-uzbekistane.-na-prazdnichnom-koncerte-vystupili-zvezdy-rossijskoj-estrada',
'info_dict': {
'id': '... | ```suggestion
'thumbnail': self._og_search_thumbnail(webpage, default=None),
``` | class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii-otkrylis-v-uzbekistane.-na-prazdnichnom-koncerte-vystupili-zvezdy-rossijskoj-estrada',
'info_dic... | @@ -0,0 +1,33 @@
+from .common import InfoExtractor
+from ..utils import parse_qs, url_or_none
+from ..utils.traversal import require, traverse_obj
+
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _TESTS = [{
+ 'url': 'https://mir24.tv/news/1... | yt_dlp/extractor/mir24tv.py | 26 | Python | 0.571 | suggestion | 94 | 29 | 33 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii... | update the test with the thumbnail | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,33 @@
+from .common import InfoExtractor
+from ..utils import parse_qs, url_or_none
+from ..utils.traversal import require, traverse_obj
+
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _TESTS = [{
+ 'url': 'https://mir24.tv/news/1... | yt_dlp/extractor/mir24tv.py | 14 | Python | 0.071 | suggestion | 34 | 34 | 38 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii... | ```suggestion
'thumbnail': r're:https://images\.mir24\.tv/.+\.jpg',
``` | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,34 @@
+from .common import InfoExtractor
+from ..utils import parse_qs, url_or_none
+from ..utils.traversal import require, traverse_obj
+
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _TESTS = [{
+ 'url': 'https://mir24.tv/news/1... | yt_dlp/extractor/mir24tv.py | 14 | Python | 0.571 | suggestion | 85 | 35 | 38 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
from ..utils.traversal import require, traverse_obj
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii-otkrylis-v-uzbekistane.-na-prazdnichnom-koncerte-vystupili-zvezdy-rossijsko... | ```suggestion
m3u8_url = traverse_obj(iframe_url, (
{parse_qs}, 'source', -1, {self._proto_relative_url}, {url_or_none}, {require('m3u8 URL')}))
formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4', m3u8_id='hls')
``` | from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii-otkrylis-v-uzbekistane.-na-prazdnichnom-koncerte-v... | @@ -0,0 +1,34 @@
+from .common import InfoExtractor
+from ..utils import parse_qs, url_or_none
+from ..utils.traversal import require, traverse_obj
+
+
+class Mir24tvIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
+ _TESTS = [{
+ 'url': 'https://mir24.tv/news/1... | yt_dlp/extractor/mir24tv.py | 26 | Python | 0.857 | refactor | 284 | 33 | 36 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24tvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16635210/dni-kultury-rossii... | ```suggestion
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
``` | from .common import InfoExtractor
from ..utils import parse_qs, url_or_none
from ..utils.traversal import require, traverse_obj
class Mir24TvIE(InfoExtractor):
IE_NAME = 'mir24.tv'
_VALID_URL = r'https?://(?:www\.)?mir24\.tv/news/(?P<id>[0-9]+)/[^/?#]+'
_TESTS = [{
'url': 'https://mir24.tv/news/16... | @@ -0,0 +1,34 @@
+from .common import InfoExtractor
+from ..utils import parse_qs, url_or_none
+from ..utils.traversal import require, traverse_obj
+
+
+class Mir24tvIE(InfoExtractor): | yt_dlp/extractor/mir24tv.py | 6 | Python | 0.643 | refactor | 77 | 31 | 31 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
from .medici import MediciIE
from .megaphone import MegaphoneIE
from .megatvcom import (
MegaTVComEmbedIE,
MegaTVComIE,
)
from .meipai import MeipaiIE
from .melonvod import MelonVODIE
from .metacritic import MetacriticIE
from .mgtv import MGTVIE
from .microsoftembed import (
MicrosoftBuildIE,
MicrosoftE... | ```suggestion
from .mir24tv import Mir24TvIE
``` | from .medici import MediciIE
from .megaphone import MegaphoneIE
from .megatvcom import (
MegaTVComEmbedIE,
MegaTVComIE,
)
from .meipai import MeipaiIE
from .melonvod import MelonVODIE
from .metacritic import MetacriticIE
from .mgtv import MGTVIE
from .microsoftembed import (
MicrosoftBuildIE,
MicrosoftE... | @@ -1147,6 +1147,7 @@
MindsIE,
)
from .minoto import MinotoIE
+from .mir24tv import Mir24tvIE | yt_dlp/extractor/_extractors.py | 26 | Python | 0.571 | suggestion | 50 | 51 | 51 | false | [ie/mir24.tv] Add extractor | 13,651 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
if client not in self._CLIENT_CONFIGS:
raise ExtractorError(
f'Unsupported API client "{client}" requested. '
f'Supported clients are: {", ".join(self._CLIENT_CONFIGS)}', expected=True)
client_config = self._CLIENT_CONFIGS[client]
if client_config['RE... | Is it reasonable to add a `force_extract` parameter here so that libraries can use that instead of supplying the configuration argument, just like with `force_client` on `_call_videos_api`? | client = force_client or self._configuration_arg('client', [self._DEFAULT_CLIENT], ie_key=VimeoIE)[0]
if client not in self._CLIENT_CONFIGS:
raise ExtractorError(
f'Unsupported API client "{client}" requested. '
f'Supported clients are: {", ".join(self._CLIENT... | @@ -277,52 +321,85 @@ def _parse_config(self, config, video_id):
'_format_sort_fields': ('quality', 'res', 'fps', 'hdr:12', 'source'),
}
- def _fetch_oauth_token(self):
- if not self._ios_oauth_token:
- self._ios_oauth_token = self.cache.load(self._NETRC_MACHINE, self._IOS_O... | yt_dlp/extractor/vimeo.py | 26 | Python | 0.571 | refactor | 189 | 51 | 51 | false | [ie/vimeo] Fix extractor | 13,692 | yt-dlp/yt-dlp | 132,642 | Python | Maxr1998 | bashonly |
def _search_nextjs_data(self, webpage, video_id, *, fatal=True, default=NO_DEFAULT, **kw):
if default == '{}':
self._downloader.deprecation_warning('using `default=\'{}\'` is deprecated, use `default={}` instead')
default = {}
if default is not NO_DEFAULT:
fatal =... | ```suggestion
if data and isinstance(name, str) and re.fullmatch(r'\$L[0-9a-f]+', name):
``` | def _search_nextjs_data(self, webpage, video_id, *, fatal=True, default=NO_DEFAULT, **kw):
if default == '{}':
self._downloader.deprecation_warning('using `default=\'{}\'` is deprecated, use `default={}` instead')
default = {}
if default is not NO_DEFAULT:
fatal =... | @@ -1797,9 +1797,9 @@ def flatten(flight_data):
if not isinstance(data, dict):
return
children = data.pop('children', None)
- if data and isinstance(name, str) and name.startswith('$'):
+ if data and isinstance(name, str) and name.star... | yt_dlp/extractor/common.py | 26 | Python | 0.714 | suggestion | 110 | 51 | 51 | false | [ie] Rework `_search_nextjs_v13_data` helper | 13,711 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
return self._wbi_key_cache['key']
def _sign_wbi(self, params, video_id):
params['wts'] = round(time.time())
params = {
k: ''.join(filter(lambda char: char not in "!'()*", str(v)))
for k, v in sorted(params.items())
}
query = urllib.parse.urlencode(par... | ```suggestion
# playurl requests carrying old UA will be rejected
headers = {
'User-Agent': f'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{random.randint(118,138)}.0.0.0 Safari/537.36,
**(headers or {}),
}
``` | return self._wbi_key_cache['key']
def _sign_wbi(self, params, video_id):
params['wts'] = round(time.time())
params = {
k: ''.join(filter(lambda char: char not in "!'()*", str(v)))
for k, v in sorted(params.items())
}
query = urllib.parse.urlencode(par... | @@ -175,6 +175,12 @@ def _download_playinfo(self, bvid, cid, headers=None, query=None):
else:
note = f'Downloading video formats for cid {cid}'
+ # TODO: remove this patch once utils.networking.random_user_agent() is updated, see #13735
+ # playurl requests carrying old UA will be ... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.857 | suggestion | 307 | 51 | 51 | false | [ie/bilibili] Pass newer user-agent with API requests | 13,736 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
})
return self._wbi_key_cache['key']
def _sign_wbi(self, params, video_id):
params['wts'] = round(time.time())
params = {
k: ''.join(filter(lambda char: char not in "!'()*", str(v)))
for k, v in sorted(params.items())
}
query = urllib.parse.ur... | ```suggestion
'User-Agent': f'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{random.randint(118,138)}.0.0.0 Safari/537.36',
``` | })
return self._wbi_key_cache['key']
def _sign_wbi(self, params, video_id):
params['wts'] = round(time.time())
params = {
k: ''.join(filter(lambda char: char not in "!'()*", str(v)))
for k, v in sorted(params.items())
}
query = urllib.parse.ur... | @@ -175,6 +175,13 @@ def _download_playinfo(self, bvid, cid, headers=None, query=None):
else:
note = f'Downloading video formats for cid {cid}'
+ # TODO: remove this patch once utils.networking.random_user_agent() is updated, see #13735
+ # playurl requests carrying old UA will be ... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.786 | suggestion | 183 | 51 | 51 | false | [ie/bilibili] Pass newer user-agent with API requests | 13,736 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
})
return self._wbi_key_cache['key']
def _sign_wbi(self, params, video_id):
params['wts'] = round(time.time())
params = {
k: ''.join(filter(lambda char: char not in "!'()*", str(v)))
for k, v in sorted(params.items())
}
query = urllib.parse.ur... | I went with a simple hardcode here since we are planning on bumping the default UA versions after next release (soon) | })
return self._wbi_key_cache['key']
def _sign_wbi(self, params, video_id):
params['wts'] = round(time.time())
params = {
k: ''.join(filter(lambda char: char not in "!'()*", str(v)))
for k, v in sorted(params.items())
}
query = urllib.parse.ur... | @@ -175,6 +175,13 @@ def _download_playinfo(self, bvid, cid, headers=None, query=None):
else:
note = f'Downloading video formats for cid {cid}'
+ # TODO: remove this patch once utils.networking.random_user_agent() is updated, see #13735
+ # playurl requests carrying old UA will be ... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.357 | suggestion | 117 | 51 | 51 | false | [ie/bilibili] Pass newer user-agent with API requests | 13,736 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | c-basalt |
{'mp3', 'mp4', 'm4a', 'm4p', 'm4b', 'm4r', 'm4v', 'ismv', 'isma', 'mov'},
{'webm', 'weba'},
)
for ext in preferences or vexts:
current_exts = {ext, *vexts, *aexts}
if ext == 'mkv' or current_exts == {ext} or any(
ext_sets.issuperset(current_exts) for ext_sets in C... | What do you think of simplifying to:
```suggestion
return (
determine_ext(getheader('x-amz-meta-name'), default_ext=None)
or getheader('x-amz-meta-file-type')
or mimetype2ext(getheader('Content-Type'), default=default))
``` | {'mp3', 'mp4', 'm4a', 'm4p', 'm4b', 'm4r', 'm4v', 'ismv', 'isma', 'mov'},
{'webm', 'weba'},
)
for ext in preferences or vexts:
current_exts = {ext, *vexts, *aexts}
if ext == 'mkv' or current_exts == {ext} or any(
ext_sets.issuperset(current_exts) for ext_sets in C... | @@ -3105,19 +3105,16 @@ def get_compatible_ext(*, vcodecs, acodecs, vexts, aexts, preferences=None):
def urlhandle_detect_ext(url_handle, default=NO_DEFAULT):
getheader = url_handle.headers.get
- cd = getheader('Content-Disposition')
- if cd:
- m = re.match(r'attachment;\s*filename="(?P<filename>[^... | yt_dlp/utils/_utils.py | 26 | Python | 1 | refactor | 257 | 51 | 51 | false | [utils] `urlhandle_detect_ext`: Use `x-amz-meta-file-type` headers | 13,749 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | bashonly |
if not files_data:
self.raise_no_formats('No files data found')
file_info = files_data.get('file')
if not file_info:
self.raise_no_formats('No file information found')
m3u8_url = file_info.get('url')
if not m3u8_url:
self.raise_no_formats('No... | Use `utils.parse_duration()`:
```suggestion
# Parse duration from duration string (format: "HH:MM:SS:FF", ignoring FF)
duration_str = file_info.get('duration')
duration = parse_duration(':'.join((duration or '').split(':')[:3]))
```
If FF is a frame within the second and there is a known f... | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,88 @@
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
unified_timestamp,
)
class ParlviewIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?parlview\.aph\.gov\.au/(?:[^/]+)?\bvideoID=(?P<id>\d{6})'
+ _WORKING = True
+ _V... | yt_dlp/extractor/parlview.py | 26 | Python | 0.857 | suggestion | 558 | 46 | 64 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | barryvan |
m3u8_url = file_info.get('url')
if not m3u8_url:
self.raise_no_formats('No M3U8 URL found')
formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', 'm3u8_native')
# Parse duration from duration string (format: "HH:MM:SS:FF")
duration_str = file_info.get('dur... | The conversion function tests for validity:
```suggestion
upload_date = unified_timestamp(video_details.get('recordingFrom'))
``` | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,88 @@
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
unified_timestamp,
)
class ParlviewIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?parlview\.aph\.gov\.au/(?:[^/]+)?\bvideoID=(?P<id>\d{6})'
+ _WORKING = True
+ _V... | yt_dlp/extractor/parlview.py | 26 | Python | 0.714 | suggestion | 140 | 39 | 64 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | barryvan |
'description': 'Official Recording of Senate Proceedings from the Australian Parliament',
'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/SenateParlview06.jpg',
'upload_date': '20250326',
'uploader': 'Australian Parliament House',
... | At this point the error isn't just a lack of formats, so `raise ExtractorError(...)` is more appropriate. If a useful message is included when not `wasSuccesful`, it could be spliced into the raised error message.
```suggestion
video_details = traverse_obj(api_data, ('videoDetails', {dict}))
if not v... | 'description': 'Official Recording of Senate Proceedings from the Australian Parliament',
'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/SenateParlview06.jpg',
'upload_date': '20250325',
'duration': 17999,
'timestamp': 1742939... | @@ -1,63 +1,88 @@
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
unified_timestamp,
)
class ParlviewIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?parlview\.aph\.gov\.au/(?:[^/]+)?\bvideoID=(?P<id>\d{6})'
+ _WORKING = True
+ _V... | yt_dlp/extractor/parlview.py | 26 | Python | 1 | refactor | 509 | 51 | 49 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | barryvan |
_API_URL = 'https://vodapi.aph.gov.au/api/search/parlview/%s'
def _real_extract(self, url):
video_id = self._match_id(url)
api_data = self._download_json(self._API_URL % video_id, video_id)
if not api_data:
self.raise_no_formats('Failed to retrieve API data')
if not... | The m3u8 extraction will fail, or not, so let it do so:
```suggestion
m3u8_url = traverse_obj(video_details, ('files', 'file', 'url', {str}))
``` | 'id': 'SV1394.dv',
'ext': 'mp4',
'title': 'Senate Select Committee on Uranium Mining and Milling [Part 1]',
'description': 'Official Recording of Senate Committee Proceedings from the Australian Parliament',
'thumbnail': 'https://aphbroadcasting-prod.z01.azure... | @@ -1,63 +1,88 @@
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
unified_timestamp,
)
class ParlviewIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?parlview\.aph\.gov\.au/(?:[^/]+)?\bvideoID=(?P<id>\d{6})'
+ _WORKING = True
+ _V... | yt_dlp/extractor/parlview.py | 26 | Python | 0.786 | bug | 156 | 51 | 37 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | barryvan |
try:
time_parts = duration_str.split(':')
if len(time_parts) >= 3:
hours = int(time_parts[0])
minutes = int(time_parts[1])
seconds = int(time_parts[2])
duration = hours * 3600 + minutes * 60 + sec... | Roll above extraction into the return value (with appropriate imports):
```suggestion
'formats': formats,
'uploader': 'Australian Parliament House',
** traverse_obj(video_details, {
'title': (('parlViewTitle', 'title'), {str}, any),
'description'... | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,88 @@
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
unified_timestamp,
)
class ParlviewIE(InfoExtractor):
- _WORKING = False
- _VALID_URL = r'https?://(?:www\.)?parlview\.aph\.gov\.au/(?:[^/]+)?\bvideoID=(?P<id>\d{6})'
+ _WORKING = True
+ _V... | yt_dlp/extractor/parlview.py | 26 | Python | 0.857 | refactor | 843 | 28 | 64 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | barryvan |
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:.*/)?video/(?P<id>\d{5,7})'
_TESTS = [{
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'info_dict': {
'id': '3406614',
'ext': 'mp4',
'title': 'Senate Chamber',
... | This check is redundant now.
```suggestion
``` | 'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/SenateParlview06.jpg',
'upload_date': '20250325',
'duration': 17999,
'timestamp': 1742939400,
},
'params': {
'skip_download': True,
},
}, {
'ur... | @@ -1,63 +1,63 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.429 | suggestion | 48 | 48 | 48 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | barryvan |
from yt_dlp.utils.traversal import (
traverse_obj,
)
from .common import InfoExtractor
from ..utils import (
ExtractorError,
join_nonempty,
parse_duration,
unified_timestamp,
url_or_none,
)
class ParlviewIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au... | yt-dlp uses relative imports
```suggestion
``` | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+ | yt_dlp/extractor/parlview.py | 4 | Python | 0.5 | suggestion | 46 | 29 | 29 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
from yt_dlp.utils.traversal import (
traverse_obj,
)
from .common import InfoExtractor
from ..utils import (
ExtractorError,
join_nonempty,
parse_duration,
unified_timestamp,
url_or_none,
)
class ParlviewIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au... | So the import should be here
```suggestion
)
from ..utils.traversal import traverse_obj
``` | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
) | yt_dlp/extractor/parlview.py | 12 | Python | 0.643 | suggestion | 92 | 37 | 37 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
from yt_dlp.utils.traversal import (
traverse_obj,
)
from .common import InfoExtractor
from ..utils import (
ExtractorError,
join_nonempty,
parse_duration,
unified_timestamp,
url_or_none,
)
class ParlviewIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au... | That is the default value
```suggestion
``` | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 16 | Python | 0.429 | suggestion | 43 | 41 | 41 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
url_or_none,
)
class ParlviewIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:.*/)?video/(?P<id>\d{5,7})'
_TESTS = [{
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'info_dict': {
'id': '3406614'... | No need to use a template var when we only use the variable once.
```suggestion
``` | 'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'info_dict': {
'id': '3406614',
'ext': 'mp4',
'title': 'Senate Chamber',
'description': 'Official Recording of Senate Proceedings from the Australian Parliament',
... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.643 | suggestion | 85 | 51 | 51 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
from yt_dlp.utils.traversal import (
traverse_obj,
)
from .common import InfoExtractor
from ..utils import (
ExtractorError,
join_nonempty,
parse_duration,
unified_timestamp,
url_or_none,
)
class ParlviewIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au... | Are there any videos that are not under `/News_and_Events/Watch_Read_Listen/ParlView/video/`?
The IDs are also not only numeric. See: https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/SV1394.dv
```suggestion
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/Parl... | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 17 | Python | 0.786 | suggestion | 392 | 42 | 42 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
traverse_obj,
)
from .common import InfoExtractor
from ..utils import (
ExtractorError,
join_nonempty,
parse_duration,
unified_timestamp,
url_or_none,
)
class ParlviewIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:.*/)?video/(?P<id>\d{5,7})'
_... | Did you actually run these tests? The data is incomplete. |
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
'ur... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.214 | question | 57 | 51 | 51 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
'uploader': 'Australian Parliament House',
},
'params': {
'skip_download': True,
},
}, {
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'only_matching': True,
}]
_API_URL = 'https://vodapi.aph.gov.au/a... | I don't think hardcoding this adds any value
```suggestion
``` | 'info_dict': {
'id': 'SV1394.dv',
'ext': 'mp4',
'title': 'Senate Select Committee on Uranium Mining and Milling [Part 1]',
'description': 'Official Recording of Senate Committee Proceedings from the Australian Parliament',
'thumbnail': 'https://aphbroa... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.571 | suggestion | 62 | 36 | 38 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
join_nonempty,
parse_duration,
unified_timestamp,
url_or_none,
)
class ParlviewIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:.*/)?video/(?P<id>\d{5,7})'
_TESTS = [{
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/vide... | We don't need two times the same URL tested | class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'info_dict': {
'id': '3406614',
... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.071 | suggestion | 43 | 51 | 51 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'info_dict': {
'id': '3406614',
'ext': 'mp4',
'title': 'Senate Chamber',
'description': 'Official Recording of Senate Proceedings from the Australian Parliament',
... | There is nothing useful we can do without this data, so this can just be fatal
```suggestion
``` | 'duration': 17999,
'timestamp': 1742939400,
},
'params': {
'skip_download': True,
},
}, {
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/SV1394.dv',
'info_dict': {
'id': 'SV1394.dv',
... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.643 | suggestion | 98 | 44 | 46 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
class ParlviewIE(InfoExtractor):
_WORKING = True
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:.*/)?video/(?P<id>\d{5,7})'
_TESTS = [{
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'info_dict': {
'id': '3406614',
'ext': ... | We can directly get the `video_details` here
```suggestion
video_details = self._download_json(
f'https://vodapi.aph.gov.au/api/search/parlview/{video_id}' , video_id)['videoDetails']
``` | 'title': 'Senate Chamber',
'description': 'Official Recording of Senate Proceedings from the Australian Parliament',
'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/SenateParlview06.jpg',
'upload_date': '20250325',
'duration': ... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.786 | suggestion | 211 | 48 | 50 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
'ext': 'mp4',
'title': 'Senate Chamber',
'description': 'Official Recording of Senate Proceedings from the Australian Parliament',
'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/SenateParlview06.jpg',
'upload_date': '20250326'... | Same here. We should also extract subtitles
```suggestion
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
video_details['files']['file']['url'], video_id, 'mp4')
``` | 'params': {
'skip_download': True,
},
}, {
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/SV1394.dv',
'info_dict': {
'id': 'SV1394.dv',
'ext': 'mp4',
'title': 'Senate Select Committee on Uranium Mining a... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.857 | refactor | 200 | 41 | 43 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
'params': {
'skip_download': True,
},
}, {
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'only_matching': True,
}]
_API_URL = 'https://vodapi.aph.gov.au/api/search/parlview/%s'
def _real_extract(self, url):
... | ```suggestion
'formats': formats,
'subtitles': subtitles,
``` | 'ext': 'mp4',
'title': 'Senate Select Committee on Uranium Mining and Milling [Part 1]',
'description': 'Official Recording of Senate Committee Proceedings from the Australian Parliament',
'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/Co... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.571 | suggestion | 85 | 34 | 36 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
},
}, {
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'only_matching': True,
}]
_API_URL = 'https://vodapi.aph.gov.au/api/search/parlview/%s'
def _real_extract(self, url):
video_id = self._match_id(url)
api_data = self.... | How about
```suggestion
'duration': ('files', 'file', 'duration', {DURATION_RE.fullmatch}, 'duration', {parse_duration}),
```
where we define `DURATION_RE` above as
```py
DURATION_RE = re.compile(r'(?P<duration>\d+:\d+:\d+):\d+')
``` | 'description': 'Official Recording of Senate Committee Proceedings from the Australian Parliament',
'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/CommitteeThumbnail06.jpg',
'upload_date': '19960822',
'duration': 14765,
'times... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.786 | question | 257 | 32 | 34 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
}, {
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'only_matching': True,
}]
_API_URL = 'https://vodapi.aph.gov.au/api/search/parlview/%s'
def _real_extract(self, url):
video_id = self._match_id(url)
api_data = self._download_j... | This is an iso timestamp
```suggestion
'timestamp': ('recordingFrom', {parse_iso8601}),
``` | 'thumbnail': 'https://aphbroadcasting-prod.z01.azurefd.net/vod-storage/vod-logos/CommitteeThumbnail06.jpg',
'upload_date': '19960822',
'duration': 14765,
'timestamp': 840754200,
},
'params': {
'skip_download': True,
},
}]
def _... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.714 | suggestion | 107 | 31 | 33 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
},
'params': {
'skip_download': True,
},
}, {
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/3406614',
'only_matching': True,
}]
_API_URL = 'https://vodapi.aph.gov.au/api/search/parlview/%s'
def _real_extract(self, url... | ```suggestion
**traverse_obj(video_details, {
``` | 'id': 'SV1394.dv',
'ext': 'mp4',
'title': 'Senate Select Committee on Uranium Mining and Milling [Part 1]',
'description': 'Official Recording of Senate Committee Proceedings from the Australian Parliament',
'thumbnail': 'https://aphbroadcasting-prod.z01.azure... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.571 | suggestion | 61 | 35 | 37 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
'only_matching': True,
}]
_API_URL = 'https://vodapi.aph.gov.au/api/search/parlview/%s'
def _real_extract(self, url):
video_id = self._match_id(url)
api_data = self._download_json(self._API_URL % video_id, video_id)
video_details = traverse_obj(api_data, ('videoDetails', {d... | This is not really a series. I would just drop it
```suggestion
``` | 'duration': 14765,
'timestamp': 840754200,
},
'params': {
'skip_download': True,
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
video_details = self._download_json(
f'https://vodapi.aph.gov.au/api/search... | @@ -1,63 +1,61 @@
+from yt_dlp.utils.traversal import (
+ traverse_obj,
+)
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
+ ExtractorError,
+ join_nonempty,
+ parse_duration,
unified_timestamp,
+ url_or_none,
)
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.571 | suggestion | 67 | 29 | 31 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
import re
from yt_dlp.utils._utils import parse_iso8601
from .common import InfoExtractor
from ..utils import (
parse_duration,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:.*/)?video/(?P<id>[^/?#]+)'
_TE... | Please follow the import conventions
```suggestion
``` | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,69 @@
+import re
+
+from yt_dlp.utils._utils import parse_iso8601 | yt_dlp/extractor/parlview.py | 3 | Python | 0.571 | suggestion | 56 | 28 | 28 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
import re
from yt_dlp.utils._utils import parse_iso8601
from .common import InfoExtractor
from ..utils import (
parse_duration,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:.*/)?video/(?P<id>[^/?#]+)'
_TE... | ```suggestion
parse_duration,
parse_iso8601,
``` | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,69 @@
+import re
+
+from yt_dlp.utils._utils import parse_iso8601
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
- unified_timestamp,
+ parse_duration, | yt_dlp/extractor/parlview.py | 7 | Python | 0.571 | suggestion | 59 | 32 | 32 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
},
'params': {
'skip_download': True,
},
}, {
'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/SV1394.dv',
'info_dict': {
'id': 'SV1394.dv',
'ext': 'mp4',
'title': 'Senate Select Committee on Urani... | This can be fatal. There is nothing useful we can do without this data.
```suggestion
video_details = self._download_json(
f'https://vodapi.aph.gov.au/api/search/parlview/{video_id}', video_id)['videoDetails']
``` | 'url': 'https://www.aph.gov.au/News_and_Events/Watch_Read_Listen/ParlView/video/SV1394.dv',
'info_dict': {
'id': 'SV1394.dv',
'ext': 'mp4',
'title': 'Senate Select Committee on Uranium Mining and Milling [Part 1]',
'description': 'Official Recording of Sen... | @@ -1,63 +1,69 @@
+import re
+
+from yt_dlp.utils._utils import parse_iso8601
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
- unified_timestamp,
+ parse_duration,
+ url_or_none,
)
+from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 26 | Python | 0.857 | suggestion | 237 | 45 | 39 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
import re
from yt_dlp.utils._utils import parse_iso8601
from .common import InfoExtractor
from ..utils import (
parse_duration,
url_or_none,
)
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:.*/)?video/(?P<id>[^/?#]+)'
_TE... | Are there any videos that are not under `/News_and_Events/Watch_Read_Listen/ParlView/video/`?
If yes, add a test case. Otherwise, we should adjust the `_VALID_URL` to:
```suggestion
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
``` | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,69 @@
+import re
+
+from yt_dlp.utils._utils import parse_iso8601
+
from .common import InfoExtractor
from ..utils import (
- int_or_none,
- try_get,
- unified_timestamp,
+ parse_duration,
+ url_or_none,
)
+from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
- ... | yt_dlp/extractor/parlview.py | 14 | Python | 0.857 | suggestion | 306 | 39 | 39 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | barryvan |
from .common import InfoExtractor
from ..utils import (
int_or_none,
try_get,
unified_timestamp,
)
class ParlviewIE(InfoExtractor):
_WORKING = False
_VALID_URL = r'https?://(?:www\.)?parlview\.aph\.gov\.au/(?:[^/]+)?\bvideoID=(?P<id>\d{6})'
_TESTS = [{
'url': 'https://parlview.aph.gov.... | are we sure about being so strict with the url path? would this be sufficient?
```suggestion
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/(?:[^/?#]+/){2}/ParlView/video/(?P<id>[^/?#]+)'
``` | import re
from .common import InfoExtractor
from ..utils import parse_duration, parse_iso8601, url_or_none
from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?aph\.gov\.au/News_and_Events/Watch_Read_Listen/ParlView/video/(?P<id>[^/?#]+)'
_TESTS = [{
... | @@ -1,63 +1,63 @@
+import re
+
from .common import InfoExtractor
-from ..utils import (
- int_or_none,
- try_get,
- unified_timestamp,
-)
+from ..utils import parse_duration, parse_iso8601, url_or_none
+from ..utils.traversal import traverse_obj
class ParlviewIE(InfoExtractor):
- _WORKING = False
- ... | yt_dlp/extractor/parlview.py | 9 | Python | 0.714 | question | 198 | 34 | 34 | false | [ie/Parlview] Rework extractor | 13,788 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | barryvan |
'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$',
},
}]
def _real_extract(self, url):
episode_id = self._match_id(url)
headers = self.geo_verification_headers()
webpage = self._download_webpage(url, episode_id, headers=headers)
if '您所在的地区无法观看本片' in webpage:
... | ```suggestion
# play_info can be structured in at least three different ways, e.g.:
``` | 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$',
},
}]
def _real_extract(self, url):
episode_id = self._match_id(url)
headers = self.geo_verification_headers()
webpage = self._download_webpage(url, episode_id, headers=headers)
if '您所在的地区无法观看本片' in webpage:
... | @@ -899,13 +899,26 @@ def _real_extract(self, url):
'Extracting episode', query={'fnval': 12240, 'ep_id': episode_id},
headers=headers))
+ # play_info can be structured least three different ways, e.g.: | yt_dlp/extractor/bilibili.py | 26 | Python | 0.571 | suggestion | 97 | 51 | 51 | false | [ie/BiliBiliBangumi] Fix extractor | 13,800 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | bashonly |
from .common import InfoExtractor
from ..utils import (
join_nonempty,
strip_or_none,
traverse_obj,
unified_timestamp,
)
class SportDeutschlandIE(InfoExtractor):
_VALID_URL = r'https?://(?:player\.)?sportdeutschland\.tv/(?P<id>(?:[^/]+/)?[^?#/&]+)'
_TESTS = [{
# Single-part video, dire... | ```suggestion
_VALID_URL = r'https?://(?:player\.)?sportdeutschland\.tv/(?P<id>(?:[^/?#]+/)?[^?#/&]+)'
``` | from .common import InfoExtractor
from ..utils import (
join_nonempty,
strip_or_none,
traverse_obj,
unified_timestamp,
)
class SportDeutschlandIE(InfoExtractor):
_VALID_URL = r'https?://(?:player\.)?sportdeutschland\.tv/(?P<id>(?:[^/?#]+/)?[^?#/&]+)'
_TESTS = [{
# Single-part video, di... | @@ -8,70 +8,86 @@
class SportDeutschlandIE(InfoExtractor):
- _VALID_URL = r'https?://sportdeutschland\.tv/(?P<id>(?:[^/]+/)?[^?#/&]+)'
+ _VALID_URL = r'https?://(?:player\.)?sportdeutschland\.tv/(?P<id>(?:[^/]+/)?[^?#/&]+)' | yt_dlp/extractor/sportdeutschland.py | 11 | Python | 0.714 | suggestion | 112 | 36 | 36 | false | [ie/sportdeuschland] Support embedded player URLs | 13,833 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | InvalidUsernameException |
'playable_in_embed': True,
'availability': 'public',
'live_status': 'not_live',
},
}, {
# data-plyr-embed-id="B1TZV8rNZoc" data-plyr-provider="youtube"
'url': 'https://www.vnis.edu.vn',
'info_dict': {
'id': 'vnis.edu',
'titl... | ```suggestion
plyr_embeds = re.finditer(r'''(?x)
<div[^>]+(?:
data-plyr-embed-id="(?P<id1>[^"]+)"[^>]+data-plyr-provider="(?P<provider1>[^"]+)"|
data-plyr-provider="(?P<provider2>[^"]+)"[^>]+data-plyr-embed-id="(?P<id2>[^"]+)"
)[^>]*>''', webpage)
``... | 'playable_in_embed': True,
'availability': 'public',
'live_status': 'not_live',
},
}, {
# data-plyr-embed-id="B1TZV8rNZoc" data-plyr-provider="youtube"
'url': 'https://www.vnis.edu.vn',
'info_dict': {
'id': 'vnis.edu',
'titl... | @@ -0,0 +1,104 @@
+import re
+
+from .common import InfoExtractor
+from .vimeo import VimeoIE
+
+
+class PlyrEmbedIE(InfoExtractor):
+ _VALID_URL = False
+ _WEBPAGE_TESTS = [{
+ # data-plyr-embed-id="https://player.vimeo.com/video/522319456/90e5c96063?dnt=1"
+ 'url': 'https://www.dhm.de/zeughauskino... | yt_dlp/extractor/plyr.py | 26 | Python | 0.786 | suggestion | 321 | 38 | 38 | false | [ie/PlyrEmbed] Add extractor | 13,836 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.