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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'id': '1000000023016',
'episode_number': 3,
'season_number': 1,
'cast': ['Nachi Nozawa', 'Yoshiko Sakakibara', 'Toshiko Fujita'],
'age_limit': 0,
'episode': 'Episode 3',
'season': 'Season 1',
'duration': 1485.067,
... | line too long
```suggestion
if idetails.get('err_code') == 1200:
self.raise_geo_restricted(
'This video is not available from your location due to geo restriction. '
'You may be able to bypass it by using the /details/ page instead of the /watch/ page',
... | 'cast': ['Xun Zhou', 'Xiaoming Huang', 'Yi-Lin Sie', 'Sonia Sui', 'Quniciren'],
'duration': 5811.597,
'description': 'md5:892fd62a05611d394141e8394ace0bc6',
'age_limit': 13,
}
}, {
'url': 'https://www.retrocrush.tv/watch/1000000023016/Archenemy! Crysta... | @@ -0,0 +1,128 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ iri_to_uri,
+ parse_age_limit,
+ smuggle_url,
+ traverse_obj,
+ unsmuggle_url,
+)
+
+
+class CineverseBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https://www\.(?P<host>(?:cineverse|asiancrush|dovechannel|s... | yt_dlp/extractor/cineverse.py | 26 | Python | 0.857 | refactor | 378 | 51 | 51 | false | add Cineverse IEs | 8,146 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
'season': 'Season 1',
'duration': 1485.067,
'description': 'Cobra meets a beautiful bounty hunter by the name of Jane Royal.',
'series': 'Space Adventure COBRA (Original Japanese)',
}
}]
def _real_extract(self, url):
url, smuggled_data = unsmuggle... | ```suggestion
return {
'subtitles': filter_dict({
'en': traverse_obj(idetails, (('cc_url_vtt', 'subtitle_url'), {'url': {url_or_none}})) or None,
}),
``` | 'url': 'https://www.retrocrush.tv/watch/1000000023016/Archenemy! Crystal Bowie',
'skip': 'geo-blocked',
'info_dict': {
'title': 'Archenemy! Crystal Bowie',
'ext': 'mp4',
'id': '1000000023016',
'episode_number': 3,
'season_number': 1,
... | @@ -0,0 +1,128 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ iri_to_uri,
+ parse_age_limit,
+ smuggle_url,
+ traverse_obj,
+ unsmuggle_url,
+)
+
+
+class CineverseBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https://www\.(?P<host>(?:cineverse|asiancrush|dovechannel|s... | yt_dlp/extractor/cineverse.py | 26 | Python | 0.786 | suggestion | 206 | 51 | 51 | false | add Cineverse IEs | 8,146 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
self.raise_geo_restricted(msg='This video is not available from your location due to geo restriction.\nYou may be able to bypass it by using the /details/ page instead of the /watch/ page.',
countries=smuggled_data.get('geo_countries'))
# x-forwarded-for sho... | another way to do this (import `functools` and `float_or_none`)
```suggestion
'duration': ('duration', {functools.partial(float_or_none, scale=1000)}),
``` |
def _real_extract(self, url):
url, smuggled_data = unsmuggle_url(url, default={})
self._initialize_geo_bypass({
'countries': smuggled_data.get('geo_countries'),
})
video_id = self._match_id(url)
html = self._download_webpage(url, video_id)
idetails = self... | @@ -0,0 +1,128 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ iri_to_uri,
+ parse_age_limit,
+ smuggle_url,
+ traverse_obj,
+ unsmuggle_url,
+)
+
+
+class CineverseBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https://www\.(?P<host>(?:cineverse|asiancrush|dovechannel|s... | yt_dlp/extractor/cineverse.py | 26 | Python | 0.714 | suggestion | 174 | 51 | 51 | false | add Cineverse IEs | 8,146 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
_TESTS = [{
'url': 'https://www.retrocrush.tv/details/1000000023012/Space-Adventure-COBRA-(Original-Japanese)',
'playlist_mincount': 30,
'info_dict': {
'title': 'Space Adventure COBRA (Original Japanese)',
'id': '1000000023012',
}
}, {
'url': 'http... | line too long
```suggestion
geo_countries = traverse_obj(pageprops, ('itemDetailsData', 'geo_country', {lambda x: x.split(', ')}))
geoblocked = traverse_obj(pageprops, (
'itemDetailsData', 'playback_err_msg')) == 'This title is not available in your location.'
``` | 'modified_timestamp': ('details', 'updated_by', 0, 'update_time', 'time', {int_or_none}),
'season_number': ('details', 'season', {int_or_none}),
'episode_number': ('details', 'episode', {int_or_none}),
'age_limit': ('details', 'rating_code', {parse_age_lim... | @@ -0,0 +1,128 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ iri_to_uri,
+ parse_age_limit,
+ smuggle_url,
+ traverse_obj,
+ unsmuggle_url,
+)
+
+
+class CineverseBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https://www\.(?P<host>(?:cineverse|asiancrush|dovechannel|s... | yt_dlp/extractor/cineverse.py | 26 | Python | 0.786 | refactor | 297 | 43 | 51 | false | add Cineverse IEs | 8,146 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
},
}]
def _real_extract(self, url):
host, series_id = self._match_valid_url(url).group('host', 'id')
html = self._download_webpage(url, series_id)
pageprops = self._search_nextjs_data(html, series_id)['props']['pageProps']
geo_countries = traverse_obj(pageprops, ('itemD... | instead of duplicating the `item_url`/`smuggle_url` code, I would move it into a function. could refactor like this:
```suggestion
def item_result(item):
item_url = iri_to_uri(f'https://www.{host}/watch/{item["item_id"]}/{item["title"]}')
if geoblocked:
item_url = sm... | 'id': '1000000023012',
}
}, {
'url': 'https://www.asiancrush.com/details/NNVG4938/Hansel-and-Gretel',
'info_dict': {
'id': 'NNVG4938',
'ext': 'mp4',
'title': 'Hansel and Gretel',
'description': 'md5:e3e4c35309c2e82aee044f972c2fb05d'... | @@ -0,0 +1,128 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ iri_to_uri,
+ parse_age_limit,
+ smuggle_url,
+ traverse_obj,
+ unsmuggle_url,
+)
+
+
+class CineverseBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https://www\.(?P<host>(?:cineverse|asiancrush|dovechannel|s... | yt_dlp/extractor/cineverse.py | 26 | Python | 0.857 | refactor | 851 | 27 | 35 | false | add Cineverse IEs | 8,146 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
import re
from .common import InfoExtractor
from ..utils import (
filter_dict,
int_or_none,
iri_to_uri,
parse_age_limit,
smuggle_url,
traverse_obj,
unsmuggle_url,
url_or_none,
)
class CineverseBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map... | ```suggestion
_VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, (
``` | import re
from .common import InfoExtractor
from ..utils import (
filter_dict,
int_or_none,
parse_age_limit,
smuggle_url,
traverse_obj,
unsmuggle_url,
url_or_none,
)
class CineverseBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, (
... | @@ -0,0 +1,137 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ filter_dict,
+ int_or_none,
+ iri_to_uri,
+ parse_age_limit,
+ smuggle_url,
+ traverse_obj,
+ unsmuggle_url,
+ url_or_none,
+)
+
+
+class CineverseBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https:... | yt_dlp/extractor/cineverse.py | 17 | Python | 0.571 | security | 98 | 42 | 42 | false | add Cineverse IEs | 8,146 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
}, {
'url': 'https://www.asiancrush.com/details/NNVG4938/Hansel-and-Gretel',
'info_dict': {
'id': 'NNVG4938',
'ext': 'mp4',
'title': 'Hansel and Gretel',
'description': 'md5:e3e4c35309c2e82aee044f972c2fb05d',
'cast': ['Jeong-myeong Cheon', ... | ```suggestion
item_url = iri_to_uri(f'https://www.{host}/watch/{item["item_id"]}/{item["title"]}')
if geoblocked:
item_url = smuggle_url(item_url, {'geo_countries': geo_countries})
return self.url_result(item_url, CineverseIE)
``` | 'url': 'https://www.asiancrush.com/details/NNVG4938/Hansel-and-Gretel',
'info_dict': {
'id': 'NNVG4938',
'ext': 'mp4',
'title': 'Hansel and Gretel',
'description': 'md5:e3e4c35309c2e82aee044f972c2fb05d',
'cast': ['Jeong-myeong Cheon', 'Eun Won-... | @@ -0,0 +1,137 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ filter_dict,
+ int_or_none,
+ iri_to_uri,
+ parse_age_limit,
+ smuggle_url,
+ traverse_obj,
+ unsmuggle_url,
+ url_or_none,
+)
+
+
+class CineverseBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https:... | yt_dlp/extractor/cineverse.py | 26 | Python | 0.786 | suggestion | 287 | 33 | 32 | false | add Cineverse IEs | 8,146 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
from ..utils import (
filter_dict,
int_or_none,
iri_to_uri,
parse_age_limit,
smuggle_url,
traverse_obj,
unsmuggle_url,
url_or_none,
)
class CineverseBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, (
'cineverse.com',
'a... | ```suggestion
_VALID_URL = rf'{CineverseBaseIE._VALID_URL_BASE}/watch/(?P<id>[A-Z0-9]+)'
```
here + below | from ..utils import (
filter_dict,
int_or_none,
parse_age_limit,
smuggle_url,
traverse_obj,
unsmuggle_url,
url_or_none,
)
class CineverseBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https://www\.(?P<host>%s)' % '|'.join(map(re.escape, (
'cineverse.com',
'asiancrush.com',
... | @@ -0,0 +1,137 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ filter_dict,
+ int_or_none,
+ iri_to_uri,
+ parse_age_limit,
+ smuggle_url,
+ traverse_obj,
+ unsmuggle_url,
+ url_or_none,
+)
+
+
+class CineverseBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https://ww... | yt_dlp/extractor/cineverse.py | 26 | Python | 0.714 | suggestion | 112 | 51 | 51 | false | add Cineverse IEs | 8,146 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | garret1317 |
'cineverse.com',
'asiancrush.com',
'dovechannel.com',
'screambox.com',
'midnightpulp.com',
'fandor.com',
'retrocrush.tv',
)))
class CineverseIE(CineverseBaseIE):
_VALID_URL = r'%s/watch/(?P<id>[A-Z0-9]+)' % CineverseBaseIE._VALID_URL_BASE
_TESTS = [{... | It this deliberately using spaces? If so maybe we can add a comment as to why (iri related?) | 'asiancrush.com',
'dovechannel.com',
'screambox.com',
'midnightpulp.com',
'fandor.com',
'retrocrush.tv',
)))
class CineverseIE(CineverseBaseIE):
_VALID_URL = rf'{CineverseBaseIE._VALID_URL_BASE}/watch/(?P<id>[A-Z0-9]+)'
_TESTS = [{
'url': 'https://ww... | @@ -0,0 +1,137 @@
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ filter_dict,
+ int_or_none,
+ iri_to_uri,
+ parse_age_limit,
+ smuggle_url,
+ traverse_obj,
+ unsmuggle_url,
+ url_or_none,
+)
+
+
+class CineverseBaseIE(InfoExtractor):
+ _VALID_URL_BASE = r'https://ww... | yt_dlp/extractor/cineverse.py | 26 | Python | 0.214 | suggestion | 92 | 51 | 51 | false | add Cineverse IEs | 8,146 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | garret1317 |
tags = None
if self._is_logged_in:
metadata = self._call_api('info', video_id, {'itemId': video_id})
tags = traverse_obj(metadata, ('tags', ..., 'tag', {str}))
# Sorted by "confidence", higher confidence = earlier in list
confidences = traverse_obj(metada... | ```suggestion
'_old_archive_ids': [make_archive_id('Pr0grammStatic', video_id)],
**traverse_obj(video_info, {
``` | self.raise_no_formats('Could not extract a video', expected=bool(source), video_id=video_id)
tags = None
if self._is_logged_in:
metadata = self._call_api('info', video_id, {'itemId': video_id})
tags = traverse_obj(metadata, ('tags', ..., 'tag', {str}))
# ... | @@ -1,97 +1,153 @@
-import re
+import json
+from datetime import date
+from urllib.parse import unquote
from .common import InfoExtractor
-from ..utils import merge_dicts
+from ..compat import functools
+from ..utils import ExtractorError, urljoin
+from ..utils.traversal import traverse_obj
-class Pr0grammStatic... | yt_dlp/extractor/pr0gramm.py | 26 | Python | 0.714 | suggestion | 140 | 34 | 36 | false | [ie/pr0gramm] Rewrite pr0gramm extractor | 8,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
def _is_logged_in(self):
return 'pp' in self._get_cookies(self.BASE_URL)
@functools.cached_property
def _maximum_flags(self):
# We need to guess the flags for the content otherwise the api will raise an error
# We can guess the maximum allowed flags for the account from the cookies
... | ```suggestion
self.raise_login_required()
``` | def _is_logged_in(self):
return 'pp' in self._get_cookies(self.BASE_URL)
@functools.cached_property
def _maximum_flags(self):
# We need to guess the flags for the content otherwise the api will raise an error
# We can guess the maximum allowed flags for the account from the cookies
... | @@ -1,97 +1,150 @@
-import re
+import json
+from datetime import date
+from urllib.parse import unquote
from .common import InfoExtractor
-from ..utils import merge_dicts
+from ..compat import functools
+from ..utils import ExtractorError, urljoin
+from ..utils.traversal import traverse_obj
-class Pr0grammStatic... | yt_dlp/extractor/pr0gramm.py | 26 | Python | 0.571 | suggestion | 67 | 51 | 51 | false | [ie/pr0gramm] Rewrite pr0gramm extractor | 8,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
}]
BASE_URL = 'https://pr0gramm.com'
@functools.cached_property
def _is_logged_in(self):
return 'pp' in self._get_cookies(self.BASE_URL)
@functools.cached_property
def _maximum_flags(self):
# We need to guess the flags for the content otherwise the api will raise an error
... | ```suggestion
data = self._download_json(
f'https://pr0gramm.com/api/items/{endpoint}', video_id, query=query,
note=note, expected_status=403)
``` | }]
BASE_URL = 'https://pr0gramm.com'
@functools.cached_property
def _is_logged_in(self):
return 'pp' in self._get_cookies(self.BASE_URL)
@functools.cached_property
def _maximum_flags(self):
# We need to guess the flags for the content otherwise the api will raise an error
... | @@ -1,97 +1,151 @@
-import re
+import json
+from datetime import date
+from urllib.parse import unquote
from .common import InfoExtractor
-from ..utils import merge_dicts
+from ..compat import functools
+from ..utils import ExtractorError, make_archive_id, urljoin
+from ..utils.traversal import traverse_obj
-cla... | yt_dlp/extractor/pr0gramm.py | 26 | Python | 0.714 | suggestion | 182 | 51 | 51 | false | [ie/pr0gramm] Rewrite pr0gramm extractor | 8,151 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
# flake8: noqa: F401
from .tudou import(TudouIE,
)
from .youtube import ( # Youtube is moved to the top to improve performance
YoutubeIE,
YoutubeClipIE,
YoutubeFavouritesIE,
YoutubeNotificationsIE,
YoutubeHistoryIE,
YoutubeTabIE,
YoutubeLivestreamEmbedIE,
YoutubePlaylistIE,
Y... | file this alphabetically below
and you can just do
```py
from .tudou import TudouIE
``` | # flake8: noqa: F401
from .youtube import ( # Youtube is moved to the top to improve performance
YoutubeIE,
YoutubeClipIE,
YoutubeFavouritesIE,
YoutubeNotificationsIE,
YoutubeHistoryIE,
YoutubeTabIE,
YoutubeLivestreamEmbedIE,
YoutubePlaylistIE,
YoutubeRecommendedIE,
YoutubeSear... | @@ -1,4 +1,8 @@
# flake8: noqa: F401
+from .tudou import(TudouIE,
+
+
+ ) | yt_dlp/extractor/_extractors.py | 5 | Python | 0.571 | suggestion | 93 | 30 | 30 | false | [youku] Fix extractor youku to support tudou.com | 8,160 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | a213c |
'thumbnail': r're:^https?://.*',
'uploader': '波哥游戏解说',
'uploader_id': '156688084',
'uploader_url': 'https://www.youku.com/profile/index/?uid=UNjI2NzUyMzM2',
'tags': list,
},
}, {
'url': 'https://v.youku.com/v_show/id_XNTE1MzczOTg4MA==.html'... | ```suggestion
'id': 'XNjAxNjI2OTU3Ng',
'ext': 'mp4',
```
Make the above change, and then locally run this command from the project root directory:
`python test/test_download.py TestDownload.test_Youku_4`
it will fail and output the rest of the info_dict you need to add to the test. Add it ... | 'thumbnail': r're:^https?://.*',
'uploader': '波哥游戏解说',
'uploader_id': '156688084',
'uploader_url': 'https://www.youku.com/profile/index/?uid=UNjI2NzUyMzM2',
'tags': list,
},
}, {
'url': 'https://v.youku.com/v_show/id_XNTE1MzczOTg4MA==.html'... | @@ -87,6 +87,14 @@ class YoukuIE(InfoExtractor):
'uploader_url': 'https://www.youku.com/profile/index/?uid=UNjU2MzY1MzM1Ng==',
'tags': list,
},
+ }, {
+ 'url': 'https://play.tudou.com/v_show/id_XNjAxNjI2OTU3Ng.html?',
+ 'info_dict': {
+ 'id': 'XNjAxNjI2OTU3... | yt_dlp/extractor/youku.py | 26 | Python | 0.857 | bug | 330 | 51 | 51 | false | [youku] Fix extractor youku to support tudou.com | 8,160 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | a213c |
def _format_message_link(self, message, hash):
assert message or hash, 'Improperly defined commit message or override'
message = message if message else hash[:HASH_LENGTH]
return f'[{message}]({self.repo_url}/commit/{hash})' if hash else message
def _format_issues(self, issues):
... | ```suggestion
(?:(?P<sub_details>`?[\w.-]+`?): )?
```
This allows us to only use `\w`, `-` and `.`, but i think we should do that anyways. |
def _format_message_link(self, message, hash):
assert message or hash, 'Improperly defined commit message or override'
message = message if message else hash[:HASH_LENGTH]
return f'[{message}]({self.repo_url}/commit/{hash})' if hash else message
def _format_issues(self, issues):
... | @@ -260,7 +260,7 @@ class CommitRange:
AUTHOR_INDICATOR_RE = re.compile(r'Authored by:? ', re.IGNORECASE)
MESSAGE_RE = re.compile(r'''
(?:\[(?P<prefix>[^\]]+)\]\ )?
- (?:(?P<sub_details>`?[^:`]+`?): )?
+ (?:(?P<sub_details>`?[^\n:`]+`?): )? | devscripts/make_changelog.py | 26 | Python | 0.786 | suggestion | 149 | 51 | 51 | false | [cleanup] Misc | 8,182 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | bashonly |
subtitles = {}
src_vtt = stream.get('captions', {}).get('src-vtt')
if src_vtt:
subtitles['en'] = [{
'url': src_vtt,
'ext': 'vtt',
}]
is_live = video_params.get('livestream') == '1'
return {
'id': video_id,
... | use `default` to ensure it is always non-fatal (e.g. if `title` is `None`)
```suggestion
'episode': self._search_regex(
r'^(?:Series\s+\d+)?\s*(?:Ep\s+\d+)?\s*(.*)$', title, 'episode', default='') or None,
``` | subtitles = {}
src_vtt = stream.get('captions', {}).get('src-vtt')
if src_vtt:
subtitles['en'] = [{
'url': src_vtt,
'ext': 'vtt',
}]
is_live = video_params.get('livestream') == '1'
return {
'id': video_id,
... | @@ -254,6 +338,8 @@ def tokenize_url(url, token):
'episode_number': int_or_none(self._search_regex(
r'\bEp\s+(\d+)\b', title, 'episode number', default=None)),
'episode_id': house_number,
+ 'episode': self._search_regex(
+ r'^(?:Series\s+\d+)?\s*(?:Ep... | yt_dlp/extractor/abc.py | 26 | Python | 0.857 | suggestion | 241 | 51 | 51 | false | [ie/abc:iview] Extract episode name from title | 8,201 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | xofe |
'series': 'Utopia',
'description': 'md5:0cfb2c183c1b952d1548fd65c8a95c00',
'upload_date': '20230726',
'uploader_id': 'abc1',
'series_id': 'CO1211V',
'episode_id': 'CO1211V001S00',
'season_number': 1,
'season': 'Season 1',
... | while you're editing this extractor's tests, can you please replace the double quotes (in lines 213&214) with single quotes? | 'series': 'Utopia',
'description': 'md5:0cfb2c183c1b952d1548fd65c8a95c00',
'upload_date': '20230726',
'uploader_id': 'abc1',
'series_id': 'CO1211V',
'episode_id': 'CO1211V001S00',
'season_number': 1,
'season': 'Season 1',
... | @@ -191,8 +215,68 @@ class ABCIViewIE(InfoExtractor):
'description': 'md5:52cc744ad35045baf6aded2ce7287f67', | yt_dlp/extractor/abc.py | 26 | Python | 0.429 | refactor | 125 | 51 | 51 | false | [ie/abc:iview] Extract episode name from title | 8,201 | yt-dlp/yt-dlp | 132,642 | Python | gamer191 | xofe |
stream_claim_id = item.get('claim_id')
if not (stream_claim_name and stream_claim_id):
continue
yield {
**self._parse_stream(item, url),
'_type': 'url',
'id': stream_claim_id,
'url': self._permanent_url(... | I would inline this function and use `traverse_obj`:
```suggestion
claim_ids = traverse_obj(
self._call_api_proxy('claim_search', playlist_id, {
'claim_ids': [playlist_id],
'no_totals': True,
'page': 1,
'p... | # Upcoming videos may still give VideoURL
if not live_data.get('Live'):
final_url = None
self.raise_no_formats('This stream is not live', True, claim_id)
else:
raise UnsupportedError(url)
if determine_ext(final_url) == 'm3u8':
... | @@ -342,11 +348,27 @@ def _fetch_page(self, claim_id, url, params, page):
'url': self._permanent_url(url, stream_claim_name, stream_claim_id),
}
+ def _fetch_playlist_items(self, claim_id):
+ page_params = {
+ 'claim_ids': [claim_id],
+ 'no_totals': True,
... | yt_dlp/extractor/lbry.py | 26 | Python | 0.857 | suggestion | 570 | 51 | 51 | false | [WIP] [ie/lbry] playlist support, fix #5982 | 8,213 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | drzraf |
'url': 'https://odysee.com/$/playlist/ffef782f27486f0ac138bde8777f72ebdd0548c2',
'info_dict': {
"id": "7f614a383d0663da1ade80d2962e91e94d1d91b6",
"title": "Théâtre Classique",
"description": "Théâtre Classique",
"_type": "playlist",
}
}, {
... | Since you touched the line, you could adapt it to f-strings:
```suggestion
'claim_search', claim_ids, page_params, f'page {page}')
``` | urlh = self._request_webpage(
direct_url, display_id, 'Checking for original quality', headers=headers, fatal=False)
if urlh and urlhandle_detect_ext(urlh) != 'm3u8':
formats.append({
'url': direct_url,
'format_id': 'origina... | @@ -317,18 +325,16 @@ class LBRYChannelIE(LBRYBaseIE):
}]
_PAGE_SIZE = 50
- def _fetch_page(self, claim_id, url, params, page):
+ def _fetch_page(self, claim_ids, url, params, page):
page += 1
page_params = {
- 'channel_ids': [claim_id],
- 'claim_type': 'stream'... | yt_dlp/extractor/lbry.py | 26 | Python | 0.786 | suggestion | 149 | 51 | 51 | false | [WIP] [ie/lbry] playlist support, fix #5982 | 8,213 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | drzraf |
result = self._call_api_proxy(
'claim_search', claim_ids, page_params, 'page %d' % page)
for item in (result.get('items') or []):
stream_claim_name = item.get('name')
stream_claim_id = item.get('claim_id')
if not (stream_claim_name and stream_claim_id):
... | ```suggestion
playlist_id = self._match_valid_url(url).group('id2')
if playlist_id:
``` | 'https://api.odysee.live/livestream/is_live', claim_id,
query={'channel_claim_id': claim_id},
note='Downloading livestream JSON metadata')['data']
final_url = live_data.get('VideoURL')
# Upcoming videos may still give VideoURL
if not li... | @@ -342,11 +348,27 @@ def _fetch_page(self, claim_id, url, params, page):
'url': self._permanent_url(url, stream_claim_name, stream_claim_id),
}
+ def _fetch_playlist_items(self, claim_id):
+ page_params = {
+ 'claim_ids': [claim_id],
+ 'no_totals': True,
... | yt_dlp/extractor/lbry.py | 26 | Python | 0.714 | suggestion | 106 | 51 | 51 | false | [WIP] [ie/lbry] playlist support, fix #5982 | 8,213 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | drzraf |
'title': ('value', 'title', {str}),
'thumbnail': ('value', 'thumbnail', 'url', {url_or_none}),
'description': ('value', 'description', {str}),
'license': ('value', 'license', {str}),
'timestamp': ('timestamp', {int_or_none}),
'release_timestamp': (... | ```suggestion
'page_size': self._PAGE_SIZE,
**params,
}
```
but whatever really | 'title': ('value', 'title', {str}),
'thumbnail': ('value', 'thumbnail', 'url', {url_or_none}),
'description': ('value', 'description', {str}),
'license': ('value', 'license', {str}),
'timestamp': ('timestamp', {int_or_none}),
'release_timestamp': (... | @@ -77,10 +78,72 @@ def _parse_stream(self, stream, url):
return info
+ def _fetch_page(self, display_id, url, params, page):
+ page += 1
+ page_params = {
+ 'no_totals': True,
+ 'page': page,
+ 'page_size': self._PAGE_SIZE,
+ }
+ page_params.... | yt_dlp/extractor/lbry.py | 26 | Python | 0.714 | suggestion | 116 | 51 | 51 | false | [WIP] [ie/lbry] playlist support, fix #5982 | 8,213 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | drzraf |
channel_name = traverse_obj(stream, ('signing_channel', 'name', {str}))
if channel_name and info.get('channel_id'):
info['channel_url'] = self._permanent_url(url, channel_name, info['channel_id'])
return info
def _fetch_page(self, display_id, url, params, page):
page +... | We dont get any readability or chars from a temp variable here so id probably inline
```suggestion
yield {
**self._parse_stream(item, url),
'_type': 'url',
'id': item['claim_id'],
'url': self._permanent_url(url, item['name'], item['claim_... |
channel_name = traverse_obj(stream, ('signing_channel', 'name', {str}))
if channel_name and info.get('channel_id'):
info['channel_url'] = self._permanent_url(url, channel_name, info['channel_id'])
return info
def _fetch_page(self, display_id, url, params, page):
page +... | @@ -77,10 +78,72 @@ def _parse_stream(self, stream, url):
return info
+ def _fetch_page(self, display_id, url, params, page):
+ page += 1
+ page_params = {
+ 'no_totals': True,
+ 'page': page,
+ 'page_size': self._PAGE_SIZE,
+ }
+ page_params.... | yt_dlp/extractor/lbry.py | 26 | Python | 0.929 | suggestion | 346 | 51 | 51 | false | [WIP] [ie/lbry] playlist support, fix #5982 | 8,213 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | drzraf |
}
duration = qs.get('duration', [None])[0]
if duration:
params['duration'] = {
'long': '>=1200',
'short': '<=240',
}[duration]
language = qs.get('language', ['all'])[0]
if language != 'all':
languages = [language... | Here we would use the inline then
```suggestion
_VALID_URL = LBRYBaseIE._BASE_URL_REGEX + rf'''(?x)
``` | if duration:
params['duration'] = {
'long': '>=1200',
'short': '<=240',
}[duration]
language = qs.get('language', ['all'])[0]
if language != 'all':
languages = [language]
if language == 'en':
language... | @@ -77,10 +78,72 @@ def _parse_stream(self, stream, url):
return info
+ def _fetch_page(self, display_id, url, params, page):
+ page += 1
+ page_params = {
+ 'no_totals': True,
+ 'page': page,
+ 'page_size': self._PAGE_SIZE,
+ }
+ page_params.... | yt_dlp/extractor/lbry.py | 26 | Python | 0.786 | suggestion | 110 | 51 | 51 | false | [WIP] [ie/lbry] playlist support, fix #5982 | 8,213 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | drzraf |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class ElTreceTVIE(InfoExtractor):
IE_DESC = 'El Trece TV (Argentina)'
_VALID_URL = r'https?://(?:www\.)?eltrecetv.com.ar/(?:[\w\-]+)/capitulos/temporada-(?:\d+)/(?P<id>[\w\-]+)/?'
_TESTS = [
{
'u... | yt-dlp is python3, you don't need these | from .common import InfoExtractor
class ElTreceTVIE(InfoExtractor):
IE_DESC = 'El Trece TV (Argentina)'
_VALID_URL = r'https?://(?:www\.)?eltrecetv\.com\.ar/[\w-]+/capitulos/temporada-\d+/(?P<id>[\w-]+)'
_TESTS = [
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-... | @@ -0,0 +1,61 @@
+# coding: utf-8
+from __future__ import unicode_literals | yt_dlp/extractor/eltrecetv.py | 2 | Python | 0.071 | suggestion | 39 | 27 | 27 | false | [eltrecetv] Add new extractor | 8,216 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | elivinsky |
}
},
{
'url': 'https://www.eltrecetv.com.ar/argentina-tierra-de-amor-y-venganza/capitulos/temporada-2023/atav-2-capitulo-121-del-250923/',
'only_matching': True,
},
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-2023... | these come from an embedded json blob (`Fusion.globalContent`)
it might be better to match the whole json with `_search_json`, then traverse it to get the details you need
that way you can be more resilient to eg the vod provider changing | },
{
'url': 'https://www.eltrecetv.com.ar/pasaplatos/capitulos/temporada-2023/pasaplatos-el-restaurante-del-250923/',
'only_matching': True,
},
{
'url': 'https://www.eltrecetv.com.ar/el-galpon/capitulos/temporada-2023/programa-del-160923-invitado-raul-... | @@ -0,0 +1,61 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class ElTreceTVIE(InfoExtractor):
+ IE_DESC = 'El Trece TV (Argentina)'
+ _VALID_URL = r'https?://(?:www\.)?eltrecetv.com.ar/(?:[\w\-]+)/capitulos/temporada-(?:\d+)/(?P<id>[\w\-]+)/?'
+ _TESTS =... | yt_dlp/extractor/eltrecetv.py | 26 | Python | 0.643 | suggestion | 240 | 34 | 35 | false | [eltrecetv] Add new extractor | 8,216 | yt-dlp/yt-dlp | 132,642 | Python | garret1317 | elivinsky |
from .common import InfoExtractor
class ElTreceTVIE(InfoExtractor):
IE_DESC = 'El Trece TV (Argentina)'
_VALID_URL = r'https?://(?:www\.)?eltrecetv.com.ar/(?:[\w\-]+)/capitulos/temporada-(?:\d+)/(?P<id>[\w\-]+)/?'
_TESTS = [
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?eltrecetv\.com\.ar/[\w-]+/capitulos/temporada-\d+/(?P<id>[\w-]+)'
``` | from .common import InfoExtractor
class ElTreceTVIE(InfoExtractor):
IE_DESC = 'El Trece TV (Argentina)'
_VALID_URL = r'https?://(?:www\.)?eltrecetv\.com\.ar/[\w-]+/capitulos/temporada-\d+/(?P<id>[\w-]+)'
_TESTS = [
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-... | @@ -0,0 +1,83 @@
+from .common import InfoExtractor
+
+
+class ElTreceTVIE(InfoExtractor):
+ IE_DESC = 'El Trece TV (Argentina)'
+ _VALID_URL = r'https?://(?:www\.)?eltrecetv.com.ar/(?:[\w\-]+)/capitulos/temporada-(?:\d+)/(?P<id>[\w\-]+)/?' | yt_dlp/extractor/eltrecetv.py | 6 | Python | 0.714 | suggestion | 123 | 31 | 31 | false | [eltrecetv] Add new extractor | 8,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elivinsky |
}
},
{
'url': 'https://www.eltrecetv.com.ar/argentina-tierra-de-amor-y-venganza/capitulos/temporada-2023/atav-2-capitulo-121-del-250923/',
'only_matching': True,
},
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-2023... | Avoid chaining `.get()`s
Use `traverse_obj()` for non-fatal traversal.
But here it should be fatal if these keys don't exist:
```suggestion
config = self._search_json(
r'Fusion\.globalContent\s*=', webpage, 'content', slug)['promo_items']['basic']['embed']['config']
``` | 'only_matching': True,
}
]
def _real_extract(self, url):
slug = self._match_id(url)
webpage = self._download_webpage(url, slug)
config = self._search_json(
r'Fusion.globalContent\s*=', webpage, 'content', slug)['promo_items']['basic']['embed']['config']
... | @@ -0,0 +1,83 @@
+from .common import InfoExtractor
+
+
+class ElTreceTVIE(InfoExtractor):
+ IE_DESC = 'El Trece TV (Argentina)'
+ _VALID_URL = r'https?://(?:www\.)?eltrecetv.com.ar/(?:[\w\-]+)/capitulos/temporada-(?:\d+)/(?P<id>[\w\-]+)/?'
+ _TESTS = [
+ {
+ 'url': 'https://www.eltrecetv.com... | yt_dlp/extractor/eltrecetv.py | 26 | Python | 0.857 | suggestion | 296 | 49 | 28 | false | [eltrecetv] Add new extractor | 8,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elivinsky |
{
'url': 'https://www.eltrecetv.com.ar/argentina-tierra-de-amor-y-venganza/capitulos/temporada-2023/atav-2-capitulo-121-del-250923/',
'only_matching': True,
},
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-2023/programa-del-250923/',
... | inline in return
```suggestion
``` | ]
def _real_extract(self, url):
slug = self._match_id(url)
webpage = self._download_webpage(url, slug)
config = self._search_json(
r'Fusion.globalContent\s*=', webpage, 'content', slug)['promo_items']['basic']['embed']['config']
video_url = config['m3u8']
vid... | @@ -0,0 +1,83 @@
+from .common import InfoExtractor
+
+
+class ElTreceTVIE(InfoExtractor):
+ IE_DESC = 'El Trece TV (Argentina)'
+ _VALID_URL = r'https?://(?:www\.)?eltrecetv.com.ar/(?:[\w\-]+)/capitulos/temporada-(?:\d+)/(?P<id>[\w\-]+)/?'
+ _TESTS = [
+ {
+ 'url': 'https://www.eltrecetv.com... | yt_dlp/extractor/eltrecetv.py | 26 | Python | 0.429 | suggestion | 36 | 47 | 26 | false | [eltrecetv] Add new extractor | 8,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elivinsky |
def _real_extract(self, url):
slug = self._match_id(url)
webpage = self._download_webpage(url, slug)
json_all = self._search_json(r'Fusion.globalContent\s*=', webpage, 'content', slug)
config = json_all.get('promo_items').get('basic').get('embed').get('config')
title = conf... | ```suggestion
'title': config.get('title'),
'thumbnail': config.get('thumbnail'),
``` | from .common import InfoExtractor
class ElTreceTVIE(InfoExtractor):
IE_DESC = 'El Trece TV (Argentina)'
_VALID_URL = r'https?://(?:www\.)?eltrecetv\.com\.ar/[\w-]+/capitulos/temporada-\d+/(?P<id>[\w-]+)'
_TESTS = [
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-... | @@ -0,0 +1,83 @@
+from .common import InfoExtractor
+
+
+class ElTreceTVIE(InfoExtractor):
+ IE_DESC = 'El Trece TV (Argentina)'
+ _VALID_URL = r'https?://(?:www\.)?eltrecetv.com.ar/(?:[\w\-]+)/capitulos/temporada-(?:\d+)/(?P<id>[\w\-]+)/?'
+ _TESTS = [
+ {
+ 'url': 'https://www.eltrecetv.com... | yt_dlp/extractor/eltrecetv.py | 26 | Python | 0.714 | suggestion | 112 | 29 | 63 | false | [eltrecetv] Add new extractor | 8,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elivinsky |
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-2023/programa-del-250923/',
'only_matching': True,
},
{
'url': 'https://www.eltrecetv.com.ar/pasaplatos/capitulos/temporada-2023/pasaplatos-el-restaurante-del-250923/',
'only_ma... | - it makes more sense to extract the `video_id` from the stream URL instead the thumbnail; extraction shouldn't be fatal if there is no thumbnail, but it *should* be fatal if no stream URL
- then we can inline `thumbnail` in the return
- avoid redefining the `url` variable to keep things more readable
```suggestion
... | from .common import InfoExtractor
class ElTreceTVIE(InfoExtractor):
IE_DESC = 'El Trece TV (Argentina)'
_VALID_URL = r'https?://(?:www\.)?eltrecetv\.com\.ar/[\w-]+/capitulos/temporada-\d+/(?P<id>[\w-]+)'
_TESTS = [
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-... | @@ -0,0 +1,83 @@
+from .common import InfoExtractor
+
+
+class ElTreceTVIE(InfoExtractor):
+ IE_DESC = 'El Trece TV (Argentina)'
+ _VALID_URL = r'https?://(?:www\.)?eltrecetv.com.ar/(?:[\w\-]+)/capitulos/temporada-(?:\d+)/(?P<id>[\w\-]+)/?'
+ _TESTS = [
+ {
+ 'url': 'https://www.eltrecetv.com... | yt_dlp/extractor/eltrecetv.py | 26 | Python | 0.857 | refactor | 453 | 43 | 63 | false | [eltrecetv] Add new extractor | 8,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elivinsky |
'url': 'https://www.eltrecetv.com.ar/el-galpon/capitulos/temporada-2023/programa-del-160923-invitado-raul-lavie/',
'only_matching': True,
}
]
def _real_extract(self, url):
slug = self._match_id(url)
webpage = self._download_webpage(url, slug)
json_all = ... | We shouldn't discard/replace the m3u8 formats, especially since 1080p is only available as an m3u8 format; we should extract the direct http mp4 formats in addition to them.
Also, it's worth trying to extract subtitles here just in case
```suggestion
formats, subtitles = self._extract_m3u8_formats_and_subt... | from .common import InfoExtractor
class ElTreceTVIE(InfoExtractor):
IE_DESC = 'El Trece TV (Argentina)'
_VALID_URL = r'https?://(?:www\.)?eltrecetv\.com\.ar/[\w-]+/capitulos/temporada-\d+/(?P<id>[\w-]+)'
_TESTS = [
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-... | @@ -0,0 +1,83 @@
+from .common import InfoExtractor
+
+
+class ElTreceTVIE(InfoExtractor):
+ IE_DESC = 'El Trece TV (Argentina)'
+ _VALID_URL = r'https?://(?:www\.)?eltrecetv.com.ar/(?:[\w\-]+)/capitulos/temporada-(?:\d+)/(?P<id>[\w\-]+)/?'
+ _TESTS = [
+ {
+ 'url': 'https://www.eltrecetv.com... | yt_dlp/extractor/eltrecetv.py | 26 | Python | 0.857 | refactor | 685 | 34 | 63 | false | [eltrecetv] Add new extractor | 8,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elivinsky |
'thumbnail': 'https://thumbs.vodgc.net/804C6158638F598B4903394E9707B6EB129.jpg?194429',
}
},
{
'url': 'https://www.eltrecetv.com.ar/argentina-tierra-de-amor-y-venganza/capitulos/temporada-2023/atav-2-capitulo-121-del-250923/',
'only_matching': True,
... | ```suggestion
'formats': formats,
'subtitles': subtitles,
``` | 'url': 'https://www.eltrecetv.com.ar/el-galpon/capitulos/temporada-2023/programa-del-160923-invitado-raul-lavie/',
'only_matching': True,
}
]
def _real_extract(self, url):
slug = self._match_id(url)
webpage = self._download_webpage(url, slug)
config = sel... | @@ -0,0 +1,83 @@
+from .common import InfoExtractor
+
+
+class ElTreceTVIE(InfoExtractor):
+ IE_DESC = 'El Trece TV (Argentina)'
+ _VALID_URL = r'https?://(?:www\.)?eltrecetv.com.ar/(?:[\w\-]+)/capitulos/temporada-(?:\d+)/(?P<id>[\w\-]+)/?'
+ _TESTS = [
+ {
+ 'url': 'https://www.eltrecetv.com... | yt_dlp/extractor/eltrecetv.py | 26 | Python | 0.571 | suggestion | 88 | 50 | 29 | false | [eltrecetv] Add new extractor | 8,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elivinsky |
'url': 'https://www.eltrecetv.com.ar/argentina-tierra-de-amor-y-venganza/capitulos/temporada-2023/atav-2-capitulo-121-del-250923/',
'only_matching': True,
},
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-2023/programa-del-250923/',
... | ```suggestion
config = self._search_json(
r'Fusion.globalContent\s*=', webpage, 'content', slug)['promo_items']['basic']['embed']['config']
video_url = config['m3u8']
video_id = self._search_regex(r'/(\w+)\.m3u8', video_url, 'video id', default=slug)
``` | 'url': 'https://www.eltrecetv.com.ar/argentina-tierra-de-amor-y-venganza/capitulos/temporada-2023/atav-2-capitulo-121-del-250923/',
'only_matching': True,
},
{
'url': 'https://www.eltrecetv.com.ar/ahora-caigo/capitulos/temporada-2023/programa-del-250923/',
... | @@ -0,0 +1,64 @@
+from .common import InfoExtractor
+
+
+class ElTreceTVIE(InfoExtractor):
+ IE_DESC = 'El Trece TV (Argentina)'
+ _VALID_URL = r'https?://(?:www\.)?eltrecetv\.com\.ar/[\w-]+/capitulos/temporada-\d+/(?P<id>[\w-]+)'
+ _TESTS = [
+ {
+ 'url': 'https://www.eltrecetv.com.ar/ahora-... | yt_dlp/extractor/eltrecetv.py | 26 | Python | 0.786 | suggestion | 295 | 43 | 41 | false | [eltrecetv] Add new extractor | 8,216 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | elivinsky |
canonical_url = url
domain = traverse_obj(webpage_info, ('domainInfo', 'customDomain'))
if domain is not None:
canonical_url = urllib.parse.urlparse(url)._replace(netloc=domain).geturl()
post_type = webpage_info['post']['type']
formats, subtitles = [], {}
if... | extractors shouldn't set `original_url`
```suggestion
``` |
canonical_url = url
domain = traverse_obj(webpage_info, ('domainInfo', 'customDomain', {str}))
if domain:
canonical_url = urllib.parse.urlparse(url)._replace(netloc=domain).geturl()
post_type = webpage_info['post']['type']
formats, subtitles = [], {}
if post... | @@ -99,4 +104,6 @@ def _real_extract(self, url):
'thumbnail': traverse_obj(webpage_info, ('post', 'cover_image')),
'uploader': traverse_obj(webpage_info, ('pub', 'name')),
'uploader_id': str_or_none(traverse_obj(webpage_info, ('post', 'publication_id'))),
+ 'webpage_url... | yt_dlp/extractor/substack.py | 26 | Python | 0.643 | refactor | 59 | 28 | 27 | false | [extractor/substack] Return canonical URLs | 8,219 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | handlerug |
for video_format in ('hls', 'mp4'):
video_url = urllib.parse.urljoin(url, f'/api/v1/video/upload/{video_id}/src?type={video_format}')
if video_format == 'hls':
fmts, subs = self._extract_m3u8_formats_and_subtitles(video_url, video_id, 'mp4', fatal=False)
... | ```suggestion
domain = traverse_obj(webpage_info, ('domainInfo', 'customDomain', {str}))
if domain:
``` | for video_format in ('hls', 'mp4'):
video_url = urllib.parse.urljoin(url, f'/api/v1/video/upload/{video_id}/src?type={video_format}')
if video_format == 'hls':
fmts, subs = self._extract_m3u8_formats_and_subtitles(video_url, video_id, 'mp4', fatal=False)
... | @@ -81,12 +81,17 @@ def _real_extract(self, url):
r'window\._preloads\s*=\s*JSON\.parse\(', webpage, 'json string',
display_id, transform_source=js_to_json, contains_pattern=r'"{(?s:.+)}"'), display_id)
+ canonical_url = url
+ domain = traverse_obj(webpage_info, ('domainInfo', ... | yt_dlp/extractor/substack.py | 26 | Python | 0.714 | suggestion | 122 | 50 | 49 | false | [extractor/substack] Return canonical URLs | 8,219 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | handlerug |
if not prog:
raise ExtractorError('Cannot identify radio program to download!')
assert ft, to
return prog, station_program, ft, ft_str, to_str
def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token, area_id, query):
m3u8_playlist_data = self._down... | If `lsid` just needs to be "random enough" and not particularly secure, we could do this:
```suggestion
'lsid': ''.join(random.choices('0123456789abcdef', k=32)),
```
The `secrets` module isn't used elsewhere in the codebase so we'd be cutting build costs with `random` instead | if not prog:
raise ExtractorError('Cannot identify radio program to download!')
assert ft, to
return prog, station_program, ft, ft_str, to_str
def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token, area_id, query):
m3u8_playlist_data = self._down... | @@ -101,33 +116,34 @@ def _find_program(self, video_id, station, cursor):
def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token, area_id, query):
m3u8_playlist_data = self._download_xml(
- f'https://radiko.jp/v3/station/stream/pc_html5/{station}.xml', video_id,
+ ... | yt_dlp/extractor/radiko.py | 26 | Python | 0.857 | security | 297 | 51 | 51 | false | Various radiko enhancements | 8,221 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
ft = unified_timestamp(ft_str, False)
to = unified_timestamp(to_str, False)
if ft <= cursor and cursor < to:
prog = p
break
if not prog:
raise ExtractorError('Cannot identify radio program to download!')
assert ft, to
... | ```suggestion
found.add(pcu)
``` | ft = unified_timestamp(ft_str, False)
to = unified_timestamp(to_str, False)
if ft <= cursor and cursor < to:
prog = p
break
if not prog:
raise ExtractorError('Cannot identify radio program to download!')
assert ft, to
... | @@ -101,33 +116,34 @@ def _find_program(self, video_id, station, cursor):
def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token, area_id, query):
m3u8_playlist_data = self._download_xml(
- f'https://radiko.jp/v3/station/stream/pc_html5/{station}.xml', video_id,
+ ... | yt_dlp/extractor/radiko.py | 26 | Python | 0.429 | suggestion | 46 | 51 | 51 | false | Various radiko enhancements | 8,221 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
ko = int(auth1_header['X-Radiko-KeyOffset'])
raw_partial_key = self._extract_full_key()[ko:ko + kl]
partial_key = base64.b64encode(raw_partial_key).decode()
area_id = self._download_webpage(
'https://radiko.jp/v2/api/auth2', None, 'Authenticating',
headers={
... | last line got long so I have to nitpick again
```suggestion
response = self._download_webpage(
'https://radiko.jp/v2/api/auth_check', None, 'Checking cached token', expected_status=401,
headers={'X-Radiko-AuthToken': cachedata[0], 'X-Radiko-AreaId': cachedata[1]})
``` | ko = int(auth1_header['X-Radiko-KeyOffset'])
raw_partial_key = self._extract_full_key()[ko:ko + kl]
partial_key = base64.b64encode(raw_partial_key).decode()
area_id = self._download_webpage(
'https://radiko.jp/v2/api/auth2', None, 'Authenticating',
headers={
... | @@ -58,10 +60,23 @@ def _auth_client(self):
'x-radiko-partialkey': partial_key,
}).split(',')[0]
+ if area_id == 'OUT':
+ self.raise_geo_restricted(countries=['JP'])
+
auth_data = (auth_token, area_id)
self.cache.store('radiko', 'auth_data', auth_data)... | yt_dlp/extractor/radiko.py | 26 | Python | 0.786 | security | 317 | 51 | 51 | false | Various radiko enhancements | 8,221 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
full_key = b'bcd151073c03b352e1ef2fd66c32209da9ca0afa'
self._FULL_KEY = full_key
return full_key
def _find_program(self, video_id, station, cursor):
station_program = self._download_xml(
'https://radiko.jp/v3/program/station/weekly/%s.xml' % station, video_id,
... | > actually yes do skip https://github.com/yt-dlp/yt-dlp/commit/e9117f0bab990ad43c1a94b3c388bc7d10437b6b
> pc_html5 api does actually return the not-live streams, its just a matter of prioritising them over the live ones
Do you mean we want to revert this? | full_key = b'bcd151073c03b352e1ef2fd66c32209da9ca0afa'
self._FULL_KEY = full_key
return full_key
def _find_program(self, video_id, station, cursor):
station_program = self._download_xml(
'https://radiko.jp/v3/program/station/weekly/%s.xml' % station, video_id,
... | @@ -101,33 +116,34 @@ def _find_program(self, video_id, station, cursor):
def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token, area_id, query):
m3u8_playlist_data = self._download_xml(
- f'https://radiko.jp/v3/station/stream/pc_html5/{station}.xml', video_id,
+ ... | yt_dlp/extractor/radiko.py | 26 | Python | 0.429 | question | 259 | 51 | 51 | false | Various radiko enhancements | 8,221 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
return formats
class RadikoIE(RadikoBaseIE):
_VALID_URL = r'https?://(?:www\.)?radiko\.jp/#!/ts/(?P<station>[A-Z0-9-]+)/(?P<id>\d+)'
_TESTS = [{
# QRR (文化放送) station provides <desc>
'url': 'https://radiko.jp/#!/ts/QRR/20210425101300',
'only_matching': True,
}, {
# ... | ```suggestion
auth_token, area_id = self._auth_client()
return {
``` |
class RadikoIE(RadikoBaseIE):
_VALID_URL = r'https?://(?:www\.)?radiko\.jp/#!/ts/(?P<station>[A-Z0-9-]+)/(?P<id>\d+)'
_TESTS = [{
# QRR (文化放送) station provides <desc>
'url': 'https://radiko.jp/#!/ts/QRR/20210425101300',
'only_matching': True,
}, {
# FMT (TOKYO FM) station ... | @@ -166,31 +182,26 @@ def _real_extract(self, url):
vid_int = unified_timestamp(video_id, False)
prog, station_program, ft, radio_begin, radio_end = self._find_program(video_id, station, vid_int)
- auth_cache = self.cache.load('radiko', 'auth_data')
- for attempt in range(2):
- ... | yt_dlp/extractor/radiko.py | 26 | Python | 0.571 | security | 89 | 51 | 51 | false | Various radiko enhancements | 8,221 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
'AD', 'AT', 'AX', 'BG', 'BL', 'CH', 'CY', 'CZ',
'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GF',
'GR', 'HR', 'HU', 'IE', 'IS', 'IT', 'KN', 'LI',
'LT', 'LU', 'LV', 'MC', 'MF', 'MQ', 'MT', 'NC',
'NL', 'NO', 'PF', 'PL', 'PM', 'PT', 'RE', 'RO',
'SE', 'S... | I don't think this works as intended. Right now, if we have two `fr` tracks and one of them is an accessible language track, all tracks will be renamed to `fr-acc`. I think you rather want something like this:
```suggestion
@staticmethod
def _fix_accessible_subs_locale(subs):
updated_subs = {}
... | )?
''')
# all obtained by exhaustive testing
_COUNTRIES_MAP = {
'DE_FR': (
'BL', 'DE', 'FR', 'GF', 'GP', 'MF', 'MQ', 'NC',
'PF', 'PM', 'RE', 'WF', 'YT',
),
# with both of the below 'BE' sometimes works, sometimes doesn't
'EUR_DE_FR': (
... | @@ -121,6 +122,24 @@ class ArteTVIE(ArteTVBaseIE):
),
}
+ def _contvert_accessible_subs_locale(self, subs):
+ """Gives a different locale code to accessible subttiles.
+
+ Some videos have multiple subtitles for the same language. A normal
+ subtitle and some accessible subtitles... | yt_dlp/extractor/arte.py | 26 | Python | 0.857 | suggestion | 605 | 51 | 51 | false | [ie/arte.tv] Extract accessible subtitles | 8,231 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | Nicals |
'Video is not available in this language edition of Arte or broadcast rights expired', expected=True)
formats, subtitles = [], {}
secondary_formats = []
for stream in config['data']['attributes']['streams']:
# official player contains code like `e.get("versions")[0].... | I think this line should be put below, where the `self._merge_subtitles` is, or even inlined there. That would have them be thematically linked | if geoblocking.get('restrictedArea'):
raise GeoRestrictedError(f'Video restricted to {geoblocking["code"]!r}',
countries=self._COUNTRIES_MAP.get(geoblocking['code'], ('DE', 'FR')))
if not traverse_obj(config, ('data', 'attributes', 'rights')):
... | @@ -165,6 +184,7 @@ def _real_extract(self, url):
if 'HLS' in stream['protocol']:
fmts, subs = self._extract_m3u8_formats_and_subtitles(
stream['url'], video_id=video_id, ext='mp4', m3u8_id=stream_version_code, fatal=False)
+ subs = self._contvert_access... | yt_dlp/extractor/arte.py | 26 | Python | 0.571 | suggestion | 143 | 51 | 51 | false | [ie/arte.tv] Extract accessible subtitles | 8,231 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | Nicals |
'uploader': 'ManyakisArt',
'duration': 5,
'age_limit': 18,
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video_url = self._search_regex(
r'href="(https?://xhamste... | ```suggestion
_VALID_URL = rf'https?://(?:[^/?#]+\.)?{XHamsterIE._DOMAINS}/(?:(?P<user>users)|creators)/(?P<id>[^/?#&]+)'
```
wouldn't hurt to fix this up in the other `_VALID_URL`s as well, imo | 'uploader': 'ManyakisArt',
'duration': 5,
'age_limit': 18,
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video_url = self._search_regex(
r'href="(https?://xhamste... | @@ -407,7 +407,7 @@ def _real_extract(self, url):
class XHamsterUserIE(InfoExtractor):
- _VALID_URL = r'https?://(?:.+?\.)?%s/users/(?P<id>[^/?#&]+)' % XHamsterIE._DOMAINS
+ _VALID_URL = rf'https?://(?:.+?\.)?{XHamsterIE._DOMAINS}/(?:(?P<user>users)|creators)/(?P<id>[^/?#&]+)' | yt_dlp/extractor/xhamster.py | 26 | Python | 0.857 | suggestion | 201 | 51 | 51 | false | [ie/xhamster:user] Support creator urls | 8,232 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | Grub4K |
def _parse_time_text(self, text):
if not text:
return
dt = self.extract_relative_time(text)
timestamp = None
if isinstance(dt, datetime.datetime):
timestamp = calendar.timegm(dt.timetuple())
if timestamp is None:
timestamp = (
... | Why is this the outer one? Shouldn't we have X retries overall, and each of those can use X incomplete data? | def _parse_time_text(self, text):
if not text:
return
dt = self.extract_relative_time(text)
timestamp = None
if isinstance(dt, datetime.datetime):
timestamp = calendar.timegm(dt.timetuple())
if timestamp is None:
timestamp = (
... | @@ -941,54 +941,57 @@ def _parse_time_text(self, text):
def _extract_response(self, item_id, query, note='Downloading API JSON', headers=None,
ytcfg=None, check_get_keys=None, ep='browse', fatal=True, api_hostname=None,
default_client='web'):
- for retry... | yt_dlp/extractor/youtube.py | 26 | Python | 0.429 | question | 108 | 51 | 51 | false | [ie/youtube] Raise a warning for `Incomplete Data` error instead by default | 8,238 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | coletdjnz |
if not isinstance(e.cause, network_exceptions):
return self._error_or_warning(e, fatal=fatal)
elif not isinstance(e.cause, HTTPError):
retry.error = e
continue
first_bytes = e.cause.respo... | I think this should be `break` to tick the outer `RetryManager`? | api_key=self._extract_api_key(ytcfg, default_client),
api_hostname=api_hostname, default_client=default_client)
except ExtractorError as e:
if not isinstance(e.cause, network_exceptions):
return self._error_or_warning(e, fatal=fatal... | @@ -941,54 +941,57 @@ def _parse_time_text(self, text):
def _extract_response(self, item_id, query, note='Downloading API JSON', headers=None,
ytcfg=None, check_get_keys=None, ep='browse', fatal=True, api_hostname=None,
default_client='web'):
- for retry... | yt_dlp/extractor/youtube.py | 26 | Python | 0.429 | question | 64 | 51 | 51 | false | [ie/youtube] Raise a warning for `Incomplete Data` error instead by default | 8,238 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | coletdjnz |
f'{self.IE_NAME} said: {err.get("code")} - {err.get("message")}', expected=True)
return response['result']
def _resolve_url(self, url, display_id, resource):
return self._call_api_proxy(
'resolve', display_id, {'urls': url}, resource)[url]
def _permanent_url(self, u... | Do not remove `channel` here; it makes no sense to do so.
If we want to add `uploader_id`, then let's do it here
```suggestion
'channel': ('signing_channel', 'value', 'title', {str}),
'channel_id': ('signing_channel', 'claim_id', {str}),
'uploader_id': ('signing_channel', 'name'... | raise ExtractorError(
f'{self.IE_NAME} said: {err.get("code")} - {err.get("message")}', expected=True)
return response['result']
def _resolve_url(self, url, display_id, resource):
return self._call_api_proxy(
'resolve', display_id, {'urls': url}, resource)[ur... | @@ -67,11 +67,12 @@ def _parse_stream(self, stream, url):
'release_timestamp': ('value', 'release_time', {int_or_none}),
'tags': ('value', 'tags', ..., {lambda x: x or None}),
'duration': ('value', stream_type, 'duration', {int_or_none}),
- 'channel': ('signing_channel'... | yt_dlp/extractor/lbry.py | 26 | Python | 0.857 | suggestion | 346 | 51 | 51 | false | [ie/lbry] Extract `uploader_id` | 8,244 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
def _permanent_url(self, url, claim_name, claim_id):
return urljoin(
url.replace('lbry://', 'https://lbry.tv/'),
'/%s:%s' % (claim_name, claim_id))
def _parse_stream(self, stream, url):
stream_type = traverse_obj(stream, ('value', 'stream_type', {str}))
info = ... | `channel_name` should not be changed to `stream['signing_channel']['value']['title']`, since it is a completely different value than what it was before, and since `channel_name` is used to construct the `channel_url`, which would then be incorrect.
We can simplify all of this by using the `uploader_id` value already... | 'resolve', display_id, {'urls': url}, resource)[url]
def _permanent_url(self, url, claim_name, claim_id):
return urljoin(
url.replace('lbry://', 'https://lbry.tv/'),
'/%s:%s' % (claim_name, claim_id))
def _parse_stream(self, stream, url):
stream_type = trave... | @@ -67,11 +67,12 @@ def _parse_stream(self, stream, url):
'release_timestamp': ('value', 'release_time', {int_or_none}),
'tags': ('value', 'tags', ..., {lambda x: x or None}),
'duration': ('value', stream_type, 'duration', {int_or_none}),
- 'channel': ('signing_channel'... | yt_dlp/extractor/lbry.py | 26 | Python | 0.857 | bug | 539 | 51 | 51 | false | [ie/lbry] Extract `uploader_id` | 8,244 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | drzraf |
'height': h,
'width': w,
'url': 'https://www3.nhk.or.jp' + img_path,
})
info = {
'id': episode_id + '-' + lang,
'title': '%s - %s' % (series, title) if series and title else title,
'description': get_clean_field('de... | traversal with `url_or_none` is a safer fallback mechanism
```suggestion
stream_url = traverse_obj(streams_json, (
'meta', 0, 'movie_url', ('mb_auto', 'auto_sp', 'auto_pc'), {url_or_none}), get_all=False)
formats, subs = self._extract_m3u8_formats_and_subtitles(stream_url, vo... | if stream_url:
return self._extract_m3u8_formats_and_subtitles(stream_url, vod_id)
raise ExtractorError('Unable to extract stream url')
def _extract_episode_info(self, url, episode=None):
fetch_episode = episode is None
lang, m_type, episode_id = NhkVodIE._match... | @@ -67,12 +76,23 @@ def get_clean_field(key):
}
if is_video:
vod_id = episode['vod_id']
+ api_url, api_token = self._get_vod_api(vod_id)
+ streams_json = self._download_json(api_url, vod_id, query={
+ 'token': api_token,
+ 'type': 'json'... | yt_dlp/extractor/nhk.py | 26 | Python | 0.857 | refactor | 330 | 51 | 51 | false | extract nhk world's new stream provider | 8,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
url_or_none,
urljoin,
)
class NhkBaseIE(InfoExtractor):
_API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkworld/%sod%slist/v7b/%s/%s/%s/all%s.json'
_BASE_URL_REGEX = r'https?://www3\.nhk\.or\.jp/nhkworld/(?P<lang>[a-z]{2})/ondemand'
_TYPE_REGEX = r'/(?P<type>video|audio)/'
def _call_api(self, m_id... | just to keep formatting consistent with rest of file
```suggestion
movie_player_js = self._download_webpage(
'https://movie-a.nhk.or.jp/world/player/js/movie-player.js', vod_id,
note='Downloading stream API information')
api_url = self._search_regex(
r'prod:[^;]... | url_or_none,
urljoin,
)
class NhkBaseIE(InfoExtractor):
_API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkworld/%sod%slist/v7b/%s/%s/%s/all%s.json'
_BASE_URL_REGEX = r'https?://www3\.nhk\.or\.jp/nhkworld/(?P<lang>[a-z]{2})/ondemand'
_TYPE_REGEX = r'/(?P<type>video|audio)/'
def _call_api(self, m_id... | @@ -28,6 +28,15 @@ def _call_api(self, m_id, lang, is_video, is_episode, is_clip):
m_id, lang, '/all' if is_video else ''),
m_id, query={'apikey': 'EJfK8jdS57GqlupFgAfAAwr573q01y6k'})['data']['episodes'] or []
+ def _get_vod_api(self, vod_id):
+ movie_player_js = self._download... | yt_dlp/extractor/nhk.py | 26 | Python | 0.786 | suggestion | 542 | 51 | 51 | false | extract nhk world's new stream provider | 8,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
episode_id, lang, is_video, True, episode_id[:4] == '9999')[0]
title = episode.get('sub_title_clean') or episode['sub_title']
def get_clean_field(key):
return episode.get(key + '_clean') or episode.get(key)
series = get_clean_field('title')
thumbnails = []
... | Should we still update the `id` here so that the video IDs stay consistent with what they were before the move away from piksel? | for refresh in (False, True):
api_info = self._get_api_info(refresh)
if not api_info:
continue
api_url = api_info.pop('url')
stream_url = traverse_obj(
self._download_json(
api_url, vod_id, 'Downloading stream u... | @@ -67,12 +76,23 @@ def get_clean_field(key):
}
if is_video:
vod_id = episode['vod_id']
+ api_url, api_token = self._get_vod_api(vod_id)
+ streams_json = self._download_json(api_url, vod_id, query={
+ 'token': api_token,
+ 'type': 'json'... | yt_dlp/extractor/nhk.py | 26 | Python | 0.571 | question | 128 | 51 | 51 | false | extract nhk world's new stream provider | 8,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
img_path = episode.get('image' + s)
if not img_path:
continue
thumbnails.append({
'id': '%dp' % h,
'height': h,
'width': w,
'url': 'https://www3.nhk.or.jp' + img_path,
})
info = {
... | seems equally mysterious with or without comment
```suggestion
'active_flg': 1,
``` | 'type': 'json',
'optional_id': vod_id,
'active_flg': 1,
}),
('meta', 0, 'movie_url', ('mb_auto', 'auto_sp', 'auto_pc'), {url_or_none}), get_all=False)
if stream_url:
return self._extra... | @@ -67,12 +76,23 @@ def get_clean_field(key):
}
if is_video:
vod_id = episode['vod_id']
+ api_url, api_token = self._get_vod_api(vod_id)
+ streams_json = self._download_json(api_url, vod_id, query={
+ 'token': api_token,
+ 'type': 'json'... | yt_dlp/extractor/nhk.py | 26 | Python | 0.714 | suggestion | 102 | 51 | 51 | false | extract nhk world's new stream provider | 8,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
)
class NhkBaseIE(InfoExtractor):
_API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkworld/%sod%slist/v7b/%s/%s/%s/all%s.json'
_BASE_URL_REGEX = r'https?://www3\.nhk\.or\.jp/nhkworld/(?P<lang>[a-z]{2})/ondemand'
_TYPE_REGEX = r'/(?P<type>video|audio)/'
def _call_api(self, m_id, lang, is_video, is_episode, ... | Since this si requesting "static" parameters, this should imo not be tied to `vod_id` and instead be using a video_id of `None`. Also perhaps it should be cached so we wouldnt download it more than once? How long before the api url and api token expire? | )
class NhkBaseIE(InfoExtractor):
_API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkworld/%sod%slist/v7b/%s/%s/%s/all%s.json'
_BASE_URL_REGEX = r'https?://www3\.nhk\.or\.jp/nhkworld/(?P<lang>[a-z]{2})/ondemand'
_TYPE_REGEX = r'/(?P<type>video|audio)/'
def _call_api(self, m_id, lang, is_video, is_episode, ... | @@ -28,6 +28,16 @@ def _call_api(self, m_id, lang, is_video, is_episode, is_clip):
m_id, lang, '/all' if is_video else ''),
m_id, query={'apikey': 'EJfK8jdS57GqlupFgAfAAwr573q01y6k'})['data']['episodes'] or []
+ def _get_vod_api(self, vod_id):
+ movie_player_js = self._download... | yt_dlp/extractor/nhk.py | 26 | Python | 0.643 | performance | 253 | 51 | 51 | false | extract nhk world's new stream provider | 8,249 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | garret1317 |
class NhkBaseIE(InfoExtractor):
_API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkworld/%sod%slist/v7b/%s/%s/%s/all%s.json'
_BASE_URL_REGEX = r'https?://www3\.nhk\.or\.jp/nhkworld/(?P<lang>[a-z]{2})/ondemand'
_TYPE_REGEX = r'/(?P<type>video|audio)/'
def _call_api(self, m_id, lang, is_video, is_episode, is... | ```suggestion
def _get_api_info(self, refresh=True):
if not refresh:
return self.cache.load('nhk', 'api_info')
self.cache.store('nhk', 'api_info', {})
movie_player_js = self._download_webpage(
'https://movie-a.nhk.or.jp/world/player/js/movie-player.js', None,
... |
class NhkBaseIE(InfoExtractor):
_API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkworld/%sod%slist/v7b/%s/%s/%s/all%s.json'
_BASE_URL_REGEX = r'https?://www3\.nhk\.or\.jp/nhkworld/(?P<lang>[a-z]{2})/ondemand'
_TYPE_REGEX = r'/(?P<type>video|audio)/'
def _call_api(self, m_id, lang, is_video, is_episode, is... | @@ -28,6 +28,31 @@ def _call_api(self, m_id, lang, is_video, is_episode, is_clip):
m_id, lang, '/all' if is_video else ''),
m_id, query={'apikey': 'EJfK8jdS57GqlupFgAfAAwr573q01y6k'})['data']['episodes'] or []
+ def _extract_vod_api(self):
+ movie_player_js = self._download_web... | yt_dlp/extractor/nhk.py | 26 | Python | 0.786 | performance | 786 | 51 | 51 | false | extract nhk world's new stream provider | 8,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
m_id, query={'apikey': 'EJfK8jdS57GqlupFgAfAAwr573q01y6k'})['data']['episodes'] or []
def _extract_vod_api(self):
movie_player_js = self._download_webpage(
'https://movie-a.nhk.or.jp/world/player/js/movie-player.js', None,
note='Downloading stream API information')
... | ```suggestion
def _extract_formats_and_subtitles(self, vod_id):
for refresh in (False, True):
api_info = self._get_api_info(refresh)
if not api_info:
continue
api_url = api_info.pop('url')
stream_url = traverse_obj(
se... | m_id, query={'apikey': 'EJfK8jdS57GqlupFgAfAAwr573q01y6k'})['data']['episodes'] or []
def _get_api_info(self, refresh=True):
if not refresh:
return self.cache.load('nhk', 'api_info')
self.cache.store('nhk', 'api_info', {})
movie_player_js = self._download_webpage(
... | @@ -28,6 +28,31 @@ def _call_api(self, m_id, lang, is_video, is_episode, is_clip):
m_id, lang, '/all' if is_video else ''),
m_id, query={'apikey': 'EJfK8jdS57GqlupFgAfAAwr573q01y6k'})['data']['episodes'] or []
+ def _extract_vod_api(self):
+ movie_player_js = self._download_web... | yt_dlp/extractor/nhk.py | 26 | Python | 1 | refactor | 914 | 51 | 51 | false | extract nhk world's new stream provider | 8,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
'id': '%dp' % h,
'height': h,
'width': w,
'url': 'https://www3.nhk.or.jp' + img_path,
})
info = {
'id': episode_id + '-' + lang,
'title': '%s - %s' % (series, title) if series and title else title,
'... | ```suggestion
formats, subs = self._extract_formats_and_subtitles(vod_id)
``` | title = episode.get('sub_title_clean') or episode['sub_title']
def get_clean_field(key):
return episode.get(key + '_clean') or episode.get(key)
series = get_clean_field('title')
thumbnails = []
for s, w, h in [('', 640, 360), ('_l', 1280, 720)]:
img_pat... | @@ -67,12 +92,23 @@ def get_clean_field(key):
}
if is_video:
vod_id = episode['vod_id']
+ api_url, api_token = self._load_vod_api()
+ streams_json = self._extract_stream_info(api_url, api_token, vod_id)
+ if streams_json.get('response_status') != '2000':
+... | yt_dlp/extractor/nhk.py | 26 | Python | 0.643 | refactor | 91 | 51 | 51 | false | extract nhk world's new stream provider | 8,249 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
})
var dash_path = '/dash?' + enc_params.join('&'); dash_path += '&vf=' + cmd5x(dash_path);
dash_paths[bid] = dash_path;
});
return JSON.stringify(dash_paths);
}));
saveAndExit();
'''
def _extract_vms_player_js(self, webpag... | Let's keep the original var name the same, and name the new var `replacement_map` for clarity
We can't rely on the JS var always being named `e` in the replacement map `end_pattern`, so let's change that to `\w+` and make the pattern a bit more specific elsewhere
I also think we should make replacement map extrac... | })
var dash_path = '/dash?' + enc_params.join('&'); dash_path += '&vf=' + cmd5x(dash_path);
dash_paths[bid] = dash_path;
});
return JSON.stringify(dash_paths);
}));
saveAndExit();
'''
def _extract_vms_player_js(self, webpag... | @@ -529,11 +530,25 @@ def _extract_vms_player_js(self, webpage, video_id):
webpack_js_url = self._proto_relative_url(self._search_regex(
r'<script src="((?:https?:)?//stc\.iqiyipic\.com/_next/static/chunks/webpack-\w+\.js)"', webpage, 'webpack URL'))
webpack_js = self._download_webpage(we... | yt_dlp/extractor/iqiyi.py | 26 | Python | 0.857 | refactor | 972 | 51 | 51 | false | [ie/iqiyi] Fix extractor | 8,260 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | tar-xz |
return player_js_cache
webpack_js_url = self._proto_relative_url(self._search_regex(
r'<script src="((?:https?:)?//stc\.iqiyipic\.com/_next/static/chunks/webpack-\w+\.js)"', webpage, 'webpack URL'))
webpack_js = self._download_webpage(webpack_js_url, video_id, note='Downloading w... | If the other suggestion is applied, then we can just do this, no?
```suggestion
for module_index in reversed(webpack_map):
real_module = replacement_map.get(module_index) or module_index
module_js = self._download_webpage(
f'https://stc.iqiyipic.com/_next/static/chu... | return player_js_cache
webpack_js_url = self._proto_relative_url(self._search_regex(
r'<script src="((?:https?:)?//stc\.iqiyipic\.com/_next/static/chunks/webpack-\w+\.js)"', webpage, 'webpack URL'))
webpack_js = self._download_webpage(webpack_js_url, video_id, note='Downloading w... | @@ -529,11 +530,25 @@ def _extract_vms_player_js(self, webpage, video_id):
webpack_js_url = self._proto_relative_url(self._search_regex(
r'<script src="((?:https?:)?//stc\.iqiyipic\.com/_next/static/chunks/webpack-\w+\.js)"', webpage, 'webpack URL'))
webpack_js = self._download_webpage(we... | yt_dlp/extractor/iqiyi.py | 26 | Python | 0.857 | suggestion | 375 | 51 | 51 | false | [ie/iqiyi] Fix extractor | 8,260 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | tar-xz |
return JSON.stringify(dash_paths);
}));
saveAndExit();
'''
def _extract_vms_player_js(self, webpage, video_id):
player_js_cache = self.cache.load('iq', 'player_js')
if player_js_cache:
return player_js_cache
webpack_js_url = self._proto_relative_u... | ```suggestion
real_module = replacement_map.get(module_index) or module_index
``` | return JSON.stringify(dash_paths);
}));
saveAndExit();
'''
def _extract_vms_player_js(self, webpage, video_id):
player_js_cache = self.cache.load('iq', 'player_js')
if player_js_cache:
return player_js_cache
webpack_js_url = self._proto_relative_u... | @@ -529,14 +530,22 @@ def _extract_vms_player_js(self, webpage, video_id):
webpack_js_url = self._proto_relative_url(self._search_regex(
r'<script src="((?:https?:)?//stc\.iqiyipic\.com/_next/static/chunks/webpack-\w+\.js)"', webpage, 'webpack URL'))
webpack_js = self._download_webpage(we... | yt_dlp/extractor/iqiyi.py | 26 | Python | 0.643 | suggestion | 95 | 51 | 51 | false | [ie/iqiyi] Fix extractor | 8,260 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | tar-xz |
enc_params.push('ut=' + ut);
})
var dash_path = '/dash?' + enc_params.join('&'); dash_path += '&vf=' + cmd5x(dash_path);
dash_paths[bid] = dash_path;
});
return JSON.stringify(dash_paths);
}));
saveAndExit();
... | ```suggestion
contains_pattern=r'{\s*(?:\d+\s*:\s*["\'][\w.-]+["\']\s*,?\s*)+}',
``` | enc_params.push('ut=' + ut);
})
var dash_path = '/dash?' + enc_params.join('&'); dash_path += '&vf=' + cmd5x(dash_path);
dash_paths[bid] = dash_path;
});
return JSON.stringify(dash_paths);
}));
saveAndExit();
... | @@ -529,14 +530,22 @@ def _extract_vms_player_js(self, webpage, video_id):
webpack_js_url = self._proto_relative_url(self._search_regex(
r'<script src="((?:https?:)?//stc\.iqiyipic\.com/_next/static/chunks/webpack-\w+\.js)"', webpage, 'webpack URL'))
webpack_js = self._download_webpage(we... | yt_dlp/extractor/iqiyi.py | 26 | Python | 0.571 | suggestion | 98 | 51 | 51 | false | [ie/iqiyi] Fix extractor | 8,260 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | tar-xz |
'modified_date': str,
'description': 'ExtraTerrestrial Tuesday!',
'uploader': 'clarissaisshy',
'uploader_id': '8113',
'uploader_url': 'https://erocast.me/clarissaisshy',
'thumbnail': 'https://erocast.s3.us-east-2.wasabisys.com/1220418/conversions/1... | ```suggestion
return {
'id': video_id,
'formats': self._extract_m3u8_formats(
data.get('file_url') or data['stream_url'], video_id, 'm4a', m3u8_id='hls'),
``` | 'modified_date': str,
'description': 'ExtraTerrestrial Tuesday!',
'uploader': 'clarissaisshy',
'uploader_id': '8113',
'uploader_url': 'https://erocast.me/clarissaisshy',
'thumbnail': 'https://erocast.s3.us-east-2.wasabisys.com/1220418/conversions/1... | @@ -0,0 +1,66 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class ErocastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?erocast\.me/track/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https... | yt_dlp/extractor/erocast.py | 26 | Python | 0.857 | refactor | 211 | 43 | 40 | false | Add erocast extractor. | 8,264 | yt-dlp/yt-dlp | 132,642 | Python | Grub4K | madewokherd |
'url': 'https://erocast.s3.us-east-2.wasabisys.com/1220419/track.m3u8',
'ext': 'm4a',
'age_limit': 18,
'release_timestamp': 1696178652,
'release_date': '20231001',
'modified_timestamp': int,
'modified_date': str,
'descriptio... | ```suggestion
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
data = self._search_json(
rf'<script>\s*var song_data_{video_id}\s*=', webpage, 'data', video_id, end_pattern=r'</script>')
``` | 'url': 'https://erocast.s3.us-east-2.wasabisys.com/1220419/track.m3u8',
'ext': 'm4a',
'age_limit': 18,
'release_timestamp': 1696178652,
'release_date': '20231001',
'modified_timestamp': int,
'modified_date': str,
'descriptio... | @@ -0,0 +1,65 @@
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ parse_iso8601,
+ str_or_none,
+ traverse_obj,
+ url_or_none,
+)
+
+
+class ErocastIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?erocast\.me/track/(?P<id>[0-9]+)'
+ _TESTS = [{
+ 'url': 'https... | yt_dlp/extractor/erocast.py | 26 | Python | 0.786 | suggestion | 261 | 48 | 46 | false | Add erocast extractor. | 8,264 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | madewokherd |
for video_data in self._send_query(
_QUERIES.get(query_id), {
'user': user_id,
'page': page_num,
'game': int_or_none(game),
}, ('data', 'videos', 'data'), f'{user_id} page {page_num}'):
yield _set_webpage_ur... | Since `Unsupported URL: %s` is printed, this should be the url:
```suggestion
raise UnsupportedError(url)
``` | import functools
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
int_or_none,
join_nonempty,
parse_qs,
urljoin,
)
from ..utils.traversal import traverse_obj
_FIELDS = '''
_id
clipImageSource
clipImageThumb
clipLink
cli... | @@ -0,0 +1,264 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.929 | suggestion | 124 | 35 | 254 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
'title': 'cherokee - Mobile Clips',
},
'playlist_mincount': 1
}]
def _get_page(self, user_id, game, query_id, page_num):
page_num += 1
for video_data in self._send_query(
_QUERIES.get(query_id), {
'user': user_id,
... | This is fatal right now in case either of them is renamed, while only `user_id` is required.
I would also suggest keeping the original id as the `display_id`. | for video_data in self._call_api(
query, {
'user': user_id,
'page': page_num,
'game': game,
}, ('data', 'videos', 'data'), display_id, f'Downloading page {page_num}'):
yield self._parse_video_data(video_data)... | @@ -0,0 +1,264 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.571 | suggestion | 159 | 42 | 31 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
'playlist_mincount': 15
}, {
'url': 'https://allstar.gg/u/62b8bdfc9021052f7905882d?view=Montages',
'info_dict': {
'id': '62b8bdfc9021052f7905882d',
'title': 'cherokee - Montages',
},
'playlist_mincount': 4
}, {
'url': 'https://allstar.gg/pr... | Setting the video_id to `f'{user_id} page {page_num}'`, seems wrong.
The video_id should stay `user_id`, while the current state can be outputted through the `note` argument of `self._download_json`. I would either generate the note based on the arguments given to `self._send_query` or just add an additional `note` ar... | 'info_dict': {
'id': '62b8bdfc9021052f7905882d-mobile',
'title': 'cherokee - Mobile Clips',
},
'playlist_mincount': 1
}]
_PAGE_SIZE = 10
def _get_page(self, user_id, display_id, game, query, page_num):
page_num += 1
for video_data in self._c... | @@ -0,0 +1,264 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.643 | bug | 327 | 51 | 43 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
'id': ('_id', {str_or_none}),
'display_id': ('shareId', {str_or_none}),
'title': ('clipTitle', {str_or_none}),
'url': ('clipLink', {_media_url_or_none}),
'thumbnail': ('clipImageThumb', {_media_url_or_none}),
'duration': ('clipLength', {int_or_none}),
'filesize': ... | Any specific reason for adding `webpage_url_basename` to the info dict? | 'timestamp': ('createdDate', {functools.partial(int_or_none, scale=1000)}),
'uploader': ('username', {str}),
'uploader_id': ('user', '_id', {str}),
'view_count': ('views', {int_or_none}),
})
if info.get('id') and info.get('url'):
basename = 'c... | @@ -0,0 +1,264 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.357 | question | 71 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
return urljoin('https://media.allstar.gg/', str_or_none(path))
def _profile_url_or_none(path):
return urljoin('https:/allstar.gg/u/', str_or_none(path))
def _parse_video_data(video_data):
return traverse_obj(video_data, {
'id': ('_id', {str_or_none}),
'display_id': ('shareId', {str_or_no... | Maybe this should become part of `_parse_video_data`? i.e., always setting `webpage_url`.
Would like to hear what others think regarding this one. |
info = traverse_obj(video_data, {
'id': ('_id', {str}),
'display_id': ('shareId', {str}),
'title': ('clipTitle', {str}),
'url': ('clipLink', {media_url_or_none}),
'thumbnails': (('clipImageThumb', 'clipImageSource'), {'url': {media_url_or_none}}),
... | @@ -0,0 +1,264 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.571 | suggestion | 147 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
%s %s
}
}''' % (_FIELDS, _EXTRA_FIELDS),
'montage': '''query ($id: String!) {
video: getMontage(clipIdentifier: $id) {
%s
}
}''' % _FIELDS,
'clips': '''query ($page: Int!, $user: String!, $game: Int) {
videos: clips(search: createdDate, page: $page... | I would rename to `_PAGE_SIZE` and move inside of `AllstarProfileIE` | }''' % (_FIELDS, _EXTRA_FIELDS),
'montage': '''query ($id: String!) {
video: getMontage(clipIdentifier: $id) {
%s
}
}''' % _FIELDS,
'Clips': '''query ($page: Int!, $user: String!, $game: Int) {
videos: clips(search: createdDate, page: $page, user: $user, mobile: false... | @@ -0,0 +1,264 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.429 | suggestion | 68 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
}
}''' % (_FIELDS, _EXTRA_FIELDS),
'montages': '''query ($page: Int!, $user: String!) {
videos: montages(search: createdDate, page: $page, user: $user) {
data { %s }
}
}''' % _FIELDS,
'mobile clips': '''query ($page: Int!, $user: String!) {
videos: clips(searc... | I would move `_media_url_or_none` and `_profile_url_or_none` inside of `_parse_video_data` and then `_parse_video_data` inside of `AllstarBaseIE` as a staticmethod. | 'Montages': '''query ($page: Int!, $user: String!) {
videos: montages(search: createdDate, page: $page, user: $user) {
data { %s }
}
}''' % _FIELDS,
'Mobile Clips': '''query ($page: Int!, $user: String!) {
videos: clips(search: createdDate, page: $page, user: $user, mobil... | @@ -0,0 +1,264 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.571 | suggestion | 164 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
'Clips': '''query ($page: Int!, $user: String!, $game: Int) {
videos: clips(search: createdDate, page: $page, user: $user, mobile: false, game: $game) {
data { %s %s }
}
}''' % (_FIELDS, _EXTRA_FIELDS),
'Montages': '''query ($page: Int!, $user: String!) {
videos: montages... | No need for `str_or_none` here. `urljoin` already checks for that.
```suggestion
return urljoin('https://media.allstar.gg/', path)
def _profile_url_or_none(path):
return urljoin('https:/allstar.gg/u/', path)
``` | data { %s %s }
}
}''' % (_FIELDS, _EXTRA_FIELDS),
'Montages': '''query ($page: Int!, $user: String!) {
videos: montages(search: createdDate, page: $page, user: $user) {
data { %s }
}
}''' % _FIELDS,
'Mobile Clips': '''query ($page: Int!, $user: String!) {
... | @@ -0,0 +1,259 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.786 | suggestion | 250 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
'url': 'md5:a3ee356022115db2b27c81321d195945',
'thumbnail': 'md5:f1a5e811864e173f180b738d956356f4',
'ext': 'mp4',
'timestamp': 1681810448040,
'uploader': 'cherokee',
'uploader_id': '62b8bdfc9021052f7905882d',
'view_count': int,
... | `group` is preferred over `groups`
```suggestion
query_id, video_id = self._match_valid_url(url).group('type', 'id')
``` | }
}, {
'url': 'https://allstar.gg/montage?montage=643e64089da7e9363e1fa66c',
'info_dict': {
'id': '643e64089da7e9363e1fa66c',
'display_id': 'APQLGM2IMXW',
'title': 'cherokee Rapid Fire Snipers Montage',
'url': 'md5:a3ee356022115db2b27c81321d195... | @@ -0,0 +1,259 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.929 | suggestion | 131 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
if video_url is None or video_id is None:
return info_dict
base_name = 'clip' if '/clips/' in video_url else 'montage'
info_dict['webpage_url'] = f'https://allstar.gg/{base_name}?{base_name}={video_id}'
info_dict['webpage_url_basename'] = base_name
return info_dict... | ```suggestion
profile_data = self._download_json(
urljoin('https://api.allstar.gg/v1/users/profile/', display_id), display_id)
``` | },
'playlist_mincount': 1
}]
_PAGE_SIZE = 10
def _get_page(self, user_id, display_id, game, query, page_num):
page_num += 1
for video_data in self._call_api(
query, {
'user': user_id,
'page': page_num,
... | @@ -0,0 +1,259 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.786 | suggestion | 153 | 46 | 40 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
def _get_page(self, user_id, display_id, game, query, page_num):
page_num += 1
for video_data in self._send_query(
query, {
'user': user_id,
'page': page_num,
'game': game,
}, ('data', 'videos', 'data'), dis... | No need to convert/check here since you do that in the next line already.
```suggestion
query_id = traverse_obj(url_query, ('view', 0), default='Clips')
``` | query, {
'user': user_id,
'page': page_num,
'game': game,
}, ('data', 'videos', 'data'), display_id, f'Downloading page {page_num}'):
yield self._parse_video_data(video_data)
def _real_extract(self, url):
... | @@ -0,0 +1,259 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.714 | suggestion | 167 | 36 | 30 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
}''' % (_FIELDS, _EXTRA_FIELDS),
}
class AllstarBaseIE(InfoExtractor):
@staticmethod
def _parse_video_data(video_data):
def _media_url_or_none(path):
return urljoin('https://media.allstar.gg/', str_or_none(path))
def _profile_url_or_none(path):
return urljoin('http... | If you just want to ensure that a value is of a certain type, you can use `str` and `int`, instead of `str_or_none`/`int_or_none`.
```suggestion
'id': ('_id', {str}),
'display_id': ('shareId', {str}),
'title': ('clipTitle', {str}),
'url': ('clipLink', {_media_url_or_... |
class AllstarBaseIE(InfoExtractor):
@staticmethod
def _parse_video_data(video_data):
def media_url_or_none(path):
return urljoin('https://media.allstar.gg/', path)
info = traverse_obj(video_data, {
'id': ('_id', {str}),
'display_id': ('shareId', {str}),
... | @@ -0,0 +1,259 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 1 | suggestion | 794 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
}
class AllstarBaseIE(InfoExtractor):
@staticmethod
def _parse_video_data(video_data):
def _media_url_or_none(path):
return urljoin('https://media.allstar.gg/', str_or_none(path))
def _profile_url_or_none(path):
return urljoin('https:/allstar.gg/u/', str_or_none(path))... | Categories should be an array. I also don't think `'730'` is a good category. Maybe just remove it?
```suggestion
``` |
class AllstarBaseIE(InfoExtractor):
@staticmethod
def _parse_video_data(video_data):
def media_url_or_none(path):
return urljoin('https://media.allstar.gg/', path)
info = traverse_obj(video_data, {
'id': ('_id', {str}),
'display_id': ('shareId', {str}),
... | @@ -0,0 +1,259 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.786 | suggestion | 119 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
if video_url is None or video_id is None:
return info_dict
base_name = 'clip' if '/clips/' in video_url else 'montage'
info_dict['webpage_url'] = f'https://allstar.gg/{base_name}?{base_name}={video_id}'
info_dict['webpage_url_basename'] = base_name
return info_dict
... | ```suggestion
user_id = traverse_obj(profile_data, ('data', ('_id'), {str}))
``` | 'playlist_mincount': 1
}]
_PAGE_SIZE = 10
def _get_page(self, user_id, display_id, game, query, page_num):
page_num += 1
for video_data in self._call_api(
query, {
'user': user_id,
'page': page_num,
'game'... | @@ -0,0 +1,259 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.643 | suggestion | 90 | 45 | 39 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
return info_dict
def _get_page(self, user_id, display_id, game, query, page_num):
page_num += 1
for video_data in self._send_query(
query, {
'user': user_id,
'page': page_num,
'game': game,
}, ('dat... | ```suggestion
username = traverse_obj(profile_data, ('data', 'profile', ('username'), {str}))
url_query = parse_qs(url)
game = traverse_obj(url_query, ('game', 0, {int}))
``` |
for video_data in self._call_api(
query, {
'user': user_id,
'page': page_num,
'game': game,
}, ('data', 'videos', 'data'), display_id, f'Downloading page {page_num}'):
yield self._parse_video_data(video_data... | @@ -0,0 +1,259 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.857 | suggestion | 202 | 38 | 32 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
yield self._set_webpage_url(self._parse_video_data(video_data))
def _real_extract(self, url):
display_id = self._match_id(url)
profile_data = self._download_json(
urljoin('https://api.allstar.gg/v1/users/profile/', display_id),
display_id)
user_id... | With the change from above of renaming `view` to `query_id`
```suggestion
user_id, f'{username or display_id} - {query_id}')
``` | import functools
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
int_or_none,
join_nonempty,
parse_qs,
urljoin,
)
from ..utils.traversal import traverse_obj
_FIELDS = '''
_id
clipImageSource
clipImageThumb
clipLink
cli... | @@ -0,0 +1,259 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ str_or_none,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.786 | suggestion | 143 | 27 | 254 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
'Clips': '''query ($page: Int!, $user: String!, $game: Int) {
videos: clips(search: createdDate, page: $page, user: $user, mobile: false, game: $game) {
data { %s %s }
}
}''' % (_FIELDS, _EXTRA_FIELDS),
'Montages': '''query ($page: Int!, $user: String!) {
videos: montages... | ```suggestion
return urljoin('https://allstar.gg/u/', path)
``` | }''' % _FIELDS,
'Clips': '''query ($page: Int!, $user: String!, $game: Int) {
videos: clips(search: createdDate, page: $page, user: $user, mobile: false, game: $game) {
data { %s %s }
}
}''' % (_FIELDS, _EXTRA_FIELDS),
'Montages': '''query ($page: Int!, $user: String!) {
... | @@ -0,0 +1,251 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ clipLink
+ clipTit... | yt_dlp/extractor/allstar.py | 26 | Python | 0.571 | suggestion | 77 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | S-Aarab |
}
class AllstarBaseIE(InfoExtractor):
@staticmethod
def _parse_video_data(video_data):
def _media_url_or_none(path):
return urljoin('https://media.allstar.gg/', path)
def _profile_url_or_none(path):
return urljoin('https://allstar.gg/u/', path)
return traverse... | - since this method is being used to return video info dicts by both the video extractor and the playlist extractor, we need to set the info dict's `extractor` and `extractor_key` to the video extractor
- similarly, `webpage_url` should be set in this method instead of separately in the playlist extractor
- `timestam... | }''' % (_FIELDS, _EXTRA_FIELDS),
}
class AllstarBaseIE(InfoExtractor):
@staticmethod
def _parse_video_data(video_data):
def media_url_or_none(path):
return urljoin('https://media.allstar.gg/', path)
info = traverse_obj(video_data, {
'id': ('_id', {str}),
... | @@ -0,0 +1,251 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ clipLink
+ clipTit... | yt_dlp/extractor/allstar.py | 26 | Python | 0.857 | refactor | 1,670 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | S-Aarab |
class AllstarBaseIE(InfoExtractor):
@staticmethod
def _parse_video_data(video_data):
def _media_url_or_none(path):
return urljoin('https://media.allstar.gg/', path)
def _profile_url_or_none(path):
return urljoin('https://allstar.gg/u/', path)
return traverse_ob... | `_call_api` is the conventional name for a method like this
`variables` and `path` shouldn't be optional
```suggestion
def _send_query(self, query, variables, path, video_id=None, note=None):
``` |
class AllstarBaseIE(InfoExtractor):
@staticmethod
def _parse_video_data(video_data):
def media_url_or_none(path):
return urljoin('https://media.allstar.gg/', path)
info = traverse_obj(video_data, {
'id': ('_id', {str}),
'display_id': ('shareId', {str}),
... | @@ -0,0 +1,251 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ clipLink
+ clipTit... | yt_dlp/extractor/allstar.py | 26 | Python | 0.857 | suggestion | 203 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | S-Aarab |
return urljoin('https://allstar.gg/u/', path)
return traverse_obj(video_data, {
'id': ('_id', {str}),
'display_id': ('shareId', {str}),
'title': ('clipTitle', {str}),
'url': ('clipLink', {_media_url_or_none}),
'thumbnail': ('clipImageThumb... | Should this always be expected? Can you give it an example of an error that we wouldn't want a bug report for? We probably do want a bug report in some cases, no? | info = traverse_obj(video_data, {
'id': ('_id', {str}),
'display_id': ('shareId', {str}),
'title': ('clipTitle', {str}),
'url': ('clipLink', {media_url_or_none}),
'thumbnails': (('clipImageThumb', 'clipImageSource'), {'url': {media_url_or_none}}),
... | @@ -0,0 +1,251 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ clipLink
+ clipTit... | yt_dlp/extractor/allstar.py | 26 | Python | 0.571 | bug | 162 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | S-Aarab |
}, {
'url': 'https://allstar.gg/profile?user=cherokee&view=Mobile Clips',
'info_dict': {
'id': '62b8bdfc9021052f7905882d',
'title': 'cherokee - Mobile Clips',
},
'playlist_mincount': 1
}]
_PAGE_SIZE = 10
@staticmethod
def _set_webpage_url(inf... | `webpage_url` should be handled in the baseclass method `_parse_video_data`. We shouldn't ever have to manually set `webpage_url_basename` in the extractor. See above suggestion
```suggestion
def _get_page(self, user_id, display_id, game, query, page_num):
``` | },
'playlist_mincount': 15
}, {
'url': 'https://allstar.gg/u/cherokee?game=730&view=Clips',
'info_dict': {
'id': '62b8bdfc9021052f7905882d-clips-730',
'title': 'cherokee - Clips - 730',
},
'playlist_mincount': 15
}, {
'url': 'https:... | @@ -0,0 +1,251 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ clipLink
+ clipTit... | yt_dlp/extractor/allstar.py | 26 | Python | 1 | refactor | 267 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | S-Aarab |
_PAGE_SIZE = 10
@staticmethod
def _set_webpage_url(info_dict):
video_id = info_dict.get('id')
video_url = info_dict.get('url')
if video_url is None or video_id is None:
return info_dict
base_name = 'clip' if '/clips/' in video_url else 'montage'
info_di... | ```suggestion
yield self._parse_video_data(video_data)
``` | }, {
'url': 'https://allstar.gg/u/62b8bdfc9021052f7905882d?view=Montages',
'info_dict': {
'id': '62b8bdfc9021052f7905882d-montages',
'title': 'cherokee - Montages',
},
'playlist_mincount': 4
}, {
'url': 'https://allstar.gg/profile?user=cherokee&vie... | @@ -0,0 +1,251 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ clipLink
+ clipTit... | yt_dlp/extractor/allstar.py | 26 | Python | 0.571 | suggestion | 72 | 50 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | S-Aarab |
base_name = 'clip' if '/clips/' in video_url else 'montage'
info_dict['webpage_url'] = f'https://allstar.gg/{base_name}?{base_name}={video_id}'
info_dict['webpage_url_basename'] = base_name
return info_dict
def _get_page(self, user_id, display_id, game, query, page_num):
p... | ```suggestion
user_id = traverse_obj(profile_data, ('data', ('_id'), {str}))
if not user_id:
raise ExtractorError('Unable to extract the user id')
``` | 'info_dict': {
'id': '62b8bdfc9021052f7905882d-mobile',
'title': 'cherokee - Mobile Clips',
},
'playlist_mincount': 1
}]
_PAGE_SIZE = 10
def _get_page(self, user_id, display_id, game, query, page_num):
page_num += 1
for video_data in self._c... | @@ -0,0 +1,251 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ clipLink
+ clipTit... | yt_dlp/extractor/allstar.py | 26 | Python | 0.929 | refactor | 182 | 41 | 43 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | S-Aarab |
'game': game,
}, ('data', 'videos', 'data'), display_id, f'Downloading page {page_num}'):
yield self._set_webpage_url(self._parse_video_data(video_data))
def _real_extract(self, url):
display_id = self._match_id(url)
profile_data = self._download_json... | only `user_id` for the playlist ID? I would think a user's Clips playlist should have a different ID than their Montages playlist, etc
```suggestion
user_id, f'{username or display_id} - {query_id}')
``` | 'user': user_id,
'page': page_num,
'game': game,
}, ('data', 'videos', 'data'), display_id, f'Downloading page {page_num}'):
yield self._parse_video_data(video_data)
def _real_extract(self, url):
display_id = self._matc... | @@ -0,0 +1,251 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ clipLink
+ clipTit... | yt_dlp/extractor/allstar.py | 26 | Python | 0.857 | suggestion | 218 | 27 | 29 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | S-Aarab |
page_num += 1
for video_data in self._send_query(
query, {
'user': user_id,
'page': page_num,
'game': game,
}, ('data', 'videos', 'data'), display_id, f'Downloading page {page_num}'):
yield self._set... | Since we are matching the URL, imo this is more appropriate
```suggestion
if query_id not in ('Clips', 'Montages', 'Mobile Clips'):
raise ExtractorError(f'Unsupported playlist URL type {query_id!r}')
``` |
def _get_page(self, user_id, display_id, game, query, page_num):
page_num += 1
for video_data in self._call_api(
query, {
'user': user_id,
'page': page_num,
'game': game,
}, ('data', 'videos', 'data'), disp... | @@ -0,0 +1,251 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ UnsupportedError,
+ int_or_none,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb
+ clipLink
+ clipTit... | yt_dlp/extractor/allstar.py | 26 | Python | 1 | refactor | 227 | 33 | 35 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | S-Aarab |
import functools
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
int_or_none,
join_nonempty,
parse_qs,
traverse_obj,
urljoin,
)
_FIELDS = '''
_id
clipImageThumb
clipLink
clipTitle
createdDate
shareId
user {... | when I was checking out the site's API, I noticed there is also a `clipImageSource` field. have you compared the resolution/quality between the two? | import functools
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
OnDemandPagedList,
int_or_none,
join_nonempty,
parse_qs,
urljoin,
)
from ..utils.traversal import traverse_obj
_FIELDS = '''
_id
clipImageSource
clipImageThumb
clipLink
cli... | @@ -0,0 +1,253 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ int_or_none,
+ join_nonempty,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageThumb | yt_dlp/extractor/allstar.py | 19 | Python | 0.5 | question | 148 | 44 | 44 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | S-Aarab |
data { %s }
}
}''' % _FIELDS,
'Mobile Clips': '''query ($page: Int!, $user: String!) {
videos: clips(search: createdDate, page: $page, user: $user, mobile: true) {
data { %s %s }
}
}''' % (_FIELDS, _EXTRA_FIELDS),
}
class AllstarBaseIE(InfoExtractor):
@s... | Here we want to branch to get both values (which will wrap the result in a list) and then return dicts for the transformation
```suggestion
'thumbnails': (('clipImageThumb', 'clipImageSource'), {'url': {media_url_or_none}}),
```
You may need to update the tests, then. Instead of using md5 for ... | data { %s }
}
}''' % _FIELDS,
'Mobile Clips': '''query ($page: Int!, $user: String!) {
videos: clips(search: createdDate, page: $page, user: $user, mobile: true) {
data { %s %s }
}
}''' % (_FIELDS, _EXTRA_FIELDS),
}
class AllstarBaseIE(InfoExtractor):
@s... | @@ -0,0 +1,256 @@
+import functools
+import json
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ OnDemandPagedList,
+ int_or_none,
+ join_nonempty,
+ parse_qs,
+ traverse_obj,
+ urljoin,
+)
+
+
+_FIELDS = '''
+ _id
+ clipImageSource
+ clipImageThumb
+ cli... | yt_dlp/extractor/allstar.py | 26 | Python | 0.857 | suggestion | 502 | 51 | 51 | false | [Allstar] Add extractor | 8,274 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | S-Aarab |
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)altcensored\.com/(?:watch\?v=|embed/)(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
"id": "youtube-k0srjLSkga8",
"ext": ... | Use f-strings
```suggestion
res = self.url_result(f'https://archive.org/details/youtube-{video_id}', ArchiveOrgIE)
``` | )
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watch\?v=|embed/)(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
'id': 'youtube-k0srjLSkga8',
'e... | @@ -0,0 +1,76 @@
+import re
+from itertools import groupby
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)altcensored\.com/(?:watch\?... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.786 | suggestion | 129 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
_TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
"id": "youtube-k0srjLSkga8",
"ext": "webm",
"title": "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
'display_id': 'k0srjLSkga8.webm',
... | You can provide additional metadata through the kwargs. To use them regardless of what `ArchiveOrgIE` reports set `url_transparent=True`.
As an example you could do:
```python
res = self.url_result(
f'https://archive.org/details/youtube-{video_id}', ArchiveOrgIE, url_transparent=True,
views=video_views, de... | class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watch\?v=|embed/)(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
'id': 'youtube-k0srjLSkga8',
'ext':... | @@ -0,0 +1,76 @@
+import re
+from itertools import groupby
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)altcensored\.com/(?:watch\?... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.857 | suggestion | 380 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
res = self.url_result('https://archive.org/details/youtube-%s' % video_id, ArchiveOrgIE)
# Extractor indirection doesn't allow merging info from the original extractor.
# Youtube view count or thumbnail extracted from altcensored can't be merge back
# into underlying archive.org info jso... | This does not work with channels that only have a single page. `int_or_none` from `..utils` should also be used instead of `int`.
```suggestion
page_count = int_or_none(self._html_search_regex(
r'<a[^>]+href="/channel/\w+/page/(\d+)">(?:\1)</a>', webpage, 'page count', default='1'))
```
Add a c... | }
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
return {
'_type': 'url_transparent',
'url': f'https://archive.org/details/youtube-{video_id}',
'ie_key': ArchiveOrgIE.ie_key(),
... | @@ -0,0 +1,76 @@
+import re
+from itertools import groupby
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)altcensored\.com/(?:watch\?... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.857 | suggestion | 371 | 42 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
class AltCensoredChannelIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)altcensored\.com/channel/(?P<id>[^/?#]+)'
_PAGE_SIZE = 24
_TESTS = [{
'url': 'https://www.altcensored.com/channel/UCFPTO55xxHqFqkzRZHu4kcw',
'info_dict': {
'title': 'Virginie Vota Channel (91 Censored Vid... | ```suggestion
page_num += 1
webpage = self._download_webpage(
f'https://altcensored.com/channel/{channel_id}/page/{page_num}',
channel_id, note=f'Downloading page {page_num}')
``` | return {
'_type': 'url_transparent',
'url': f'https://archive.org/details/youtube-{video_id}',
'ie_key': ArchiveOrgIE.ie_key(),
'view_count': str_to_int(self._html_search_regex(
r'YouTube Views:(?:\s| )*([\d,]+)', webpage, 'view count', defaul... | @@ -0,0 +1,76 @@
+import re
+from itertools import groupby
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)altcensored\.com/(?:watch\?... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.786 | suggestion | 240 | 35 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
'info_dict': {
'title': 'Virginie Vota Channel (91 Censored Videos)',
'id': 'UCFPTO55xxHqFqkzRZHu4kcw',
},
'playlist_count': 91
}]
def _real_extract(self, url):
channel_id = self._match_id(url)
webpage = self._download_webpage(url, channel_id, no... | ```suggestion
return [self.url_result(urljoin('https://www.altcensored.com', path), AltCensoredIE)
for path in orderedSet(items)]
``` | r'YouTube Views:(?:\s| )*([\d,]+)', webpage, 'view count', default=None)),
'categories': self._html_search_regex(
r'<a href="/category/\d+">\s*\n?\s*([^<]+)</a>',
webpage, 'category', default='').split() or None,
}
class AltCensoredChannelIE(Inf... | @@ -0,0 +1,76 @@
+import re
+from itertools import groupby
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)altcensored\.com/(?:watch\?... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.714 | suggestion | 168 | 30 | 50 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
},
'playlist_count': 91
}]
def _real_extract(self, url):
channel_id = self._match_id(url)
webpage = self._download_webpage(url, channel_id, note='Download channel info',
errnote='Unable to get channel info')
title = self._html_se... | I would write this inline
```suggestion
return self.playlist_result(
InAdvancePagedList(page_func, page_count, self._PAGE_SIZE),
playlist_id=channel_id, playlist_title=title)
``` | webpage, 'category', default='').split() or None,
}
class AltCensoredChannelIE(InfoExtractor):
IE_NAME = 'altcensored:channel'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/channel/(?!page|table)(?P<id>[^/?#]+)'
_PAGE_SIZE = 24
_TESTS = [{
'url': 'https://www.altce... | @@ -0,0 +1,76 @@
+import re
+from itertools import groupby
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)altcensored\.com/(?:watch\?... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.786 | suggestion | 215 | 27 | 47 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
"title": "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
'display_id': 'k0srjLSkga8.webm',
'release_date': '20180403',
'creator': 'Virginie Vota',
'release_year': 2018,
'upload_date': '20230318',
'uploader': 'ad... | We also need to exclude the list of all channels and the table view
```suggestion
_VALID_URL = r'https?://(?:www\.)altcensored\.com/channel/(?!page|table)(?P<id>[^/?#]+)'
``` | 'info_dict': {
'id': 'youtube-k0srjLSkga8',
'ext': 'webm',
'title': "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
'display_id': 'k0srjLSkga8.webm',
'release_date': '20180403',
'creator': 'Virginie Vota',
... | @@ -0,0 +1,76 @@
+import re
+from itertools import groupby
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)altcensored\.com/(?:watch\?... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.714 | suggestion | 181 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
video_id = self._match_id(url)
res = self.url_result('https://archive.org/details/youtube-%s' % video_id, ArchiveOrgIE)
# Extractor indirection doesn't allow merging info from the original extractor.
# Youtube view count or thumbnail extracted from altcensored can't be merge back
... | The title should not include this `Channel (3 Censored Videos)` additional stuff.
```suggestion
title = self._html_search_meta('altcen_title', webpage, 'title', fatal=False)
``` | 'categories': ['News & Politics'],
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
return {
'_type': 'url_transparent',
'url': f'https://archive.org/details/youtube-{video_id}'... | @@ -0,0 +1,76 @@
+import re
+from itertools import groupby
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)altcensored\.com/(?:watch\?... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.786 | suggestion | 189 | 43 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
import re
from .common import InfoExtractor
from .archiveorg import ArchiveOrgIE
from ..utils import (
int_or_none,
orderedSet,
urljoin,
InAdvancePagedList,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watch\?v=|embed/)(?P... | Use single quotes here
```suggestion
'id': 'youtube-k0srjLSkga8',
'ext': 'webm',
'title': "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
``` | import re
from .archiveorg import ArchiveOrgIE
from .common import InfoExtractor
from ..utils import (
InAdvancePagedList,
int_or_none,
orderedSet,
str_to_int,
urljoin,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watc... | @@ -0,0 +1,92 @@
+import re
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ int_or_none,
+ orderedSet,
+ urljoin,
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)?altcenso... | yt_dlp/extractor/altcensored.py | 21 | Python | 0.857 | suggestion | 207 | 46 | 46 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
'creator': 'Virginie Vota',
'release_year': 2018,
'upload_date': '20230318',
'uploader': 'admin@altcensored.com',
'description': 'md5:0b38a8fc04103579d5c1db10a247dc30',
'timestamp': 1679161343,
'track': 'k0srjLSkga8',
'durat... | We can directly return res instead of creating a single use variable. We should also use the proper variable names for the info dict.
```suggestion
return self.url_result(f'https://archive.org/details/youtube-{video_id}', ArchiveOrgIE, url_transparent=True,
view_count=yt_views,... | 'release_date': '20180403',
'creator': 'Virginie Vota',
'release_year': 2018,
'upload_date': '20230318',
'uploader': 'admin@altcensored.com',
'description': 'md5:0b38a8fc04103579d5c1db10a247dc30',
'timestamp': 1679161343,
't... | @@ -0,0 +1,92 @@
+import re
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ int_or_none,
+ orderedSet,
+ urljoin,
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)?altcenso... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.857 | suggestion | 348 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
"title": "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
'display_id': 'k0srjLSkga8.webm',
'release_date': '20180403',
'creator': 'Virginie Vota',
'release_year': 2018,
'upload_date': '20230318',
'uploader': 'ad... | I don't think the comments are necessary here, and I would slightly tweak the data extraction
```suggestion
webpage = self._download_webpage(url, video_id)
yt_views = str_to_int(self._html_search_regex(r'YouTube Views:(?:\s| )*([\d,]+)', webpage, 'view count', default=''))
category = se... | 'ext': 'webm',
'title': "QUELLES SONT LES CONSÉQUENCES DE L'HYPERSEXUALISATION DE LA SOCIÉTÉ ?",
'display_id': 'k0srjLSkga8.webm',
'release_date': '20180403',
'creator': 'Virginie Vota',
'release_year': 2018,
'upload_date': '20230318',
... | @@ -0,0 +1,92 @@
+import re
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ int_or_none,
+ orderedSet,
+ urljoin,
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(?:www\.)?altcenso... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.857 | refactor | 504 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
InAdvancePagedList,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watch\?v=|embed/)(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
'id': 'youtube-k0sr... | ```suggestion
'view_count': 30402,
'categories': ['News & Politics'],
``` | urljoin,
)
class AltCensoredIE(InfoExtractor):
IE_NAME = 'altcensored'
_VALID_URL = r'https?://(?:www\.)?altcensored\.com/(?:watch\?v=|embed/)(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://www.altcensored.com/watch?v=k0srjLSkga8',
'info_dict': {
'id': 'youtube-k0srjLSkga8',
... | @@ -0,0 +1,89 @@
+import re
+
+from .common import InfoExtractor
+from .archiveorg import ArchiveOrgIE
+from ..utils import (
+ int_or_none,
+ str_to_int,
+ orderedSet,
+ urljoin,
+ InAdvancePagedList,
+)
+
+
+class AltCensoredIE(InfoExtractor):
+ IE_NAME = 'altcensored'
+ _VALID_URL = r'https?://(... | yt_dlp/extractor/altcensored.py | 26 | Python | 0.714 | suggestion | 100 | 51 | 51 | false | [ie/altcensored] Add extractor | 8,291 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | drzraf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.