before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, traverse_obj
class BooyahBaseIE(InfoExtractor):
_BOOYAH_SESSION_KEY = None
def _real_initialize(self):
if not BooyahBaseIE._BOOYAH_SESSION_KEY:
initial_request = self._request_webpage(
'https:/... | ```suggestion
def _get_comments(self, video_id):
```
Use `__post_extractor` for comments. See BannedVideoIE for example | from .common import InfoExtractor
from ..utils import int_or_none, str_or_none, traverse_obj
class BooyahBaseIE(InfoExtractor):
_BOOYAH_SESSION_KEY = None
def _real_initialize(self):
BooyahBaseIE._BOOYAH_SESSION_KEY = self._request_webpage(
'https://booyah.live/api/v3/auths/sessions', Non... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, traverse_obj
+
+
+class BooyahBaseIE(InfoExtractor):
+ _BOOYAH_SESSION_KEY = None
+
+ def _real_initialize(self):
+ if not BooyahBaseIE._BOOYAH_SESSION_KEY:
+ initial_request = self._request_webpag... | yt_dlp/extractor/booyah.py | 14 | Python | 0.786 | refactor | 126 | 39 | 39 | false | [extractor/booyah] Add extractor | 4,834 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'timestamp': 1655490556,
'modified_timestamp': 1655490556,
'modified_date': '20220617',
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self._download_json(
f'https://booyah.live/api/v3/playbacks/{video_id}', ... | ```suggestion
formats.extend(({
'url': video_data.get('stream_url'),
'ext': 'mp4',
'height': video_data.get('resolution'),
}, {
'url': video_data.get('download_url'),
'ext': 'mp4',
'format_not... | 'modified_date': '20220617',
}
}]
def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self._download_json(
f'https://booyah.live/api/v3/playbacks/{video_id}', video_id,
headers={'Booyah-Session-key': self._BOOYAH_SESSION_KEY})
... | @@ -0,0 +1,90 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, str_or_none, traverse_obj
+
+
+class BooyahBaseIE(InfoExtractor):
+ _BOOYAH_SESSION_KEY = None
+
+ def _real_initialize(self):
+ if not BooyahBaseIE._BOOYAH_SESSION_KEY:
+ initial_request = self._request_webpag... | yt_dlp/extractor/booyah.py | 26 | Python | 0.857 | suggestion | 453 | 45 | 42 | false | [extractor/booyah] Add extractor | 4,834 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
def _paged_entries(self, ep, item_id, query, fields):
page = int_or_none(query.get('page', (None,))[0])
page_fetcher = functools.partial(
self._fetch_page, ep, item_id, self._prepare_api_query(query, fields))
return page_fetcher(page) if page else OnDemandPagedList(page_fetcher,... | ```suggestion
'view_count': int,
```
If you edit tests when there is an issue in the extractor, what's the point of tests? | if 'authorization' not in self._API_HEADERS:
self._fetch_oauth_token(video_id)
assert 'authorization' in self._API_HEADERS
headers = dict(self._API_HEADERS)
headers['x-customheader'] = f'https://www.redgifs.com/watch/{video_id}'
data = self._download_json(
... | @@ -98,10 +103,12 @@ class RedGifsIE(RedGifsBaseInfoExtractor):
'upload_date': '20211107',
'uploader': 'ignored52',
'duration': 16,
- 'view_count': int,
+ 'view_count': None, | yt_dlp/extractor/redgifs.py | 26 | Python | 0.786 | refactor | 137 | 51 | 51 | false | [redgifs] Fix extractor | 4,892 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jhwgh1968 |
'info_dict': {
'id': 'squeakyhelplesswisent',
'ext': 'mp4',
'title': 'Hotwife Legs Thick',
'timestamp': 1636287915,
'upload_date': '20211107',
'uploader': 'ignored52',
'duration': 16,
'view_count': int,
'... | ```suggestion
'tags': list,
``` | def _paged_entries(self, ep, item_id, query, fields):
page = int_or_none(query.get('page', (None,))[0])
page_fetcher = functools.partial(
self._fetch_page, ep, item_id, self._prepare_api_query(query, fields))
return page_fetcher(page) if page else OnDemandPagedList(page_fetcher, ... | @@ -98,10 +103,12 @@ class RedGifsIE(RedGifsBaseInfoExtractor):
'upload_date': '20211107',
'uploader': 'ignored52',
'duration': 16,
- 'view_count': int,
+ 'view_count': None,
'like_count': int,
'categories': list,
'age_l... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.429 | suggestion | 45 | 51 | 51 | false | [redgifs] Fix extractor | 4,892 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jhwgh1968 |
if 'error' in data:
raise ExtractorError(f'RedGifs said: {data["error"]}', expected=True, video_id=video_id)
return data
def _fetch_page(self, ep, video_id, query, page):
query['page'] = page + 1
data = self._call_api(
ep, video_id, query=query, note=f'Downlo... | * You sure all of these are needed?
* I think this should be a class var.
* Also follow code guidelines:
```suggestion
headers = {
'authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIxODIzYzMxZjdkMy03NDVhLTY1ODktMDAwNS1kOGU4ZmUwYTQ0YzIiLCJleHAiOjE2NjM2NzczMjEsInN1YiI6ImNs... | 'formats': formats,
}
def _fetch_oauth_token(self, video_id):
# These pages contain the OAuth token that is necessary to make API calls.
index_page = self._download_webpage(f'https://www.redgifs.com/watch/{video_id}', video_id)
index_js_uri = self._html_search_regex(
... | @@ -58,8 +58,13 @@ def _parse_gif_data(self, gif_data):
}
def _call_api(self, ep, video_id, *args, **kwargs):
+ headers = {'authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIxODIzYzMxZjdkMy03NDVhLTY1ODktMDAwNS1kOGU4ZmUwYTQ0YzIiLCJleHAiOjE2NjM2NzczMjEsInN1YiI6ImNsaWVudFwvMTgy... | yt_dlp/extractor/redgifs.py | 26 | Python | 1 | security | 706 | 51 | 51 | false | [redgifs] Fix extractor | 4,892 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jhwgh1968 |
import functools
from .common import InfoExtractor
from ..compat import compat_parse_qs
from ..utils import (
ExtractorError,
int_or_none,
qualities,
try_get,
OnDemandPagedList,
)
class RedGifsBaseInfoExtractor(InfoExtractor):
_FORMATS = {
'gif': 250,
'sd': 480,
'hd': ... | ```suggestion
_API_HEADERS = {
'referer': 'https://www.redgifs.com/',
'origin': 'https://www.redgifs.com',
'content-type': 'application/json',
}
``` | import functools
from .common import InfoExtractor
from ..compat import compat_parse_qs
from ..utils import (
ExtractorError,
int_or_none,
qualities,
try_get,
OnDemandPagedList,
)
class RedGifsBaseInfoExtractor(InfoExtractor):
_FORMATS = {
'gif': 250,
'sd': 480,
'hd': ... | @@ -18,6 +18,10 @@ class RedGifsBaseInfoExtractor(InfoExtractor):
'hd': None,
}
+ _API_HEADERS = {'referer': 'https://www.redgifs.com/',
+ 'origin': 'https://www.redgifs.com',
+ 'content-type': 'application/json'} | yt_dlp/extractor/redgifs.py | 23 | Python | 0.857 | suggestion | 186 | 48 | 48 | false | [redgifs] Fix extractor | 4,892 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jhwgh1968 |
'uploader': gif_data.get('userName'),
'duration': int_or_none(gif_data.get('duration')),
'view_count': int_or_none(gif_data.get('views')),
'like_count': int_or_none(gif_data.get('likes')),
'categories': gif_data.get('tags') or [],
'tags': gif_data.... | ```suggestion
index_page = self._download_webpage(f'https://www.redgifs.com/watch/{video_id}', video_id)
index_js_uri = self._html_search_regex(
r'href="?(/assets/js/index[.a-z0-9]*.js)"?\W',index_page, 'index_js_uri')
index_js = self._download_webpage(f'https://www.redgifs.com/{... | 'title': ' '.join(gif_data.get('tags') or []) or 'RedGifs',
'timestamp': int_or_none(gif_data.get('createDate')),
'uploader': gif_data.get('userName'),
'duration': int_or_none(gif_data.get('duration')),
'view_count': int_or_none(gif_data.get('views')),
... | @@ -57,9 +61,32 @@ def _parse_gif_data(self, gif_data):
'formats': formats,
}
+ def _fetch_oauth_token(self, video_id):
+ # These pages contain the OAuth token that is necessary to make API calls.
+ index_page = self._download_webpage(f'https://www.redgifs.com/watch/{video_id}',... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.857 | security | 862 | 51 | 51 | false | [redgifs] Fix extractor | 4,892 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jhwgh1968 |
'height': height,
'quality': quality(format_id),
})
self._sort_formats(formats)
return {
'id': video_id,
'webpage_url': f'https://redgifs.com/watch/{video_id}',
'ie_key': RedGifsIE.ie_key(),
'extractor': 'RedGif... | why `"?`. Isn't quotes mandatory? | 'format_id': format_id,
'width': height * aspect_ratio if aspect_ratio else None,
'height': height,
'quality': quality(format_id),
})
self._sort_formats(formats)
return {
'id': video_id,
'webpage_url': f... | @@ -57,9 +61,32 @@ def _parse_gif_data(self, gif_data):
'formats': formats,
}
+ def _fetch_oauth_token(self, video_id):
+ # These pages contain the OAuth token that is necessary to make API calls.
+ index_page = self._download_webpage(f'https://www.redgifs.com/watch/{video_id}',... | yt_dlp/extractor/redgifs.py | 26 | Python | 0.214 | question | 33 | 51 | 51 | false | [redgifs] Fix extractor | 4,892 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jhwgh1968 |
'info_dict': {
'id': '220704093',
'ext': 'mp4',
'description': 'md5:9b2257341b6f375cdcf90106146d5ffb',
'thumbnail': 'https://cdnv.detik.com/videoservice/AdminTV/2022/07/04/5d6187e402ec4a91877755a5886ff5b6-20220704161859-0s.jpg?w=650&q=80',
'title': 'Mu... | ```suggestion
video_id = (self._search_regex(r'identifier\s*:\s*\'([^\']+)', webpage, 'identifier', default=False)
``` | from .common import InfoExtractor
from ..utils import int_or_none, merge_dicts, try_call, url_basename
class DetikEmbedIE(InfoExtractor):
_VALID_URL = False
_WEBPAGE_TESTS = [{
# cnn embed
'url': 'https://www.cnnindonesia.com/embed/video/846189',
'info_dict': {
'id': '84618... | @@ -120,3 +120,66 @@ def _real_extract(self, url):
'subtitles': subtitles,
'tags': str_or_none(self._html_search_meta(['keywords', 'keyword', 'dtk:keywords'], webpage), '').split(','),
})
+
+
+class DetikEmbedIE(InfoExtractor):
+ _VALID_URL = False
+ _WEBPAGE_TESTS = [{
+ ... | yt_dlp/extractor/detik.py | 26 | Python | 0.714 | suggestion | 128 | 45 | 163 | false | [extractor/detik] Generalize detik extractor | 4,899 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'description': 'md5:9b2257341b6f375cdcf90106146d5ffb',
'thumbnail': 'https://cdnv.detik.com/videoservice/AdminTV/2022/07/04/5d6187e402ec4a91877755a5886ff5b6-20220704161859-0s.jpg?w=650&q=80',
'title': 'Mulai Rp 10 Jutaan! Ini Skema Kredit Mitsubishi Pajero Sport',
'timest... | ```suggestion
r'videoUrl["\']?\s*:?\s*["\']?([^"\']+)', webpage, 'videoUrl')
``` | from .common import InfoExtractor
from ..utils import int_or_none, merge_dicts, try_call, url_basename
class DetikEmbedIE(InfoExtractor):
_VALID_URL = False
_WEBPAGE_TESTS = [{
# cnn embed
'url': 'https://www.cnnindonesia.com/embed/video/846189',
'info_dict': {
'id': '84618... | @@ -120,3 +120,66 @@ def _real_extract(self, url):
'subtitles': subtitles,
'tags': str_or_none(self._html_search_meta(['keywords', 'keyword', 'dtk:keywords'], webpage), '').split(','),
})
+
+
+class DetikEmbedIE(InfoExtractor):
+ _VALID_URL = False
+ _WEBPAGE_TESTS = [{
+ ... | yt_dlp/extractor/detik.py | 26 | Python | 0.571 | suggestion | 94 | 42 | 163 | false | [extractor/detik] Generalize detik extractor | 4,899 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'id': '366649',
'ext': 'mp4',
'title': 'Saling Dorong Aparat dan Pendemo di Aksi Tolak Kenaikan BBM',
'description': 'md5:7a6580876c8381c454679e028620bea7',
'age_limit': 0,
'tags': 'count:17',
}
}]
def _extract_from_webpage(self, u... | ```suggestion
'subtitle': subtitles,
``` | from .common import InfoExtractor
from ..utils import int_or_none, merge_dicts, try_call, url_basename
class DetikEmbedIE(InfoExtractor):
_VALID_URL = False
_WEBPAGE_TESTS = [{
# cnn embed
'url': 'https://www.cnnindonesia.com/embed/video/846189',
'info_dict': {
'id': '84618... | @@ -120,3 +120,66 @@ def _real_extract(self, url):
'subtitles': subtitles,
'tags': str_or_none(self._html_search_meta(['keywords', 'keyword', 'dtk:keywords'], webpage), '').split(','),
})
+
+
+class DetikEmbedIE(InfoExtractor):
+ _VALID_URL = False
+ _WEBPAGE_TESTS = [{
+ ... | yt_dlp/extractor/detik.py | 26 | Python | 0.571 | suggestion | 58 | 30 | 163 | false | [extractor/detik] Generalize detik extractor | 4,899 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'ext': 'mp4',
'title': 'Saling Dorong Aparat dan Pendemo di Aksi Tolak Kenaikan BBM',
'description': 'md5:7a6580876c8381c454679e028620bea7',
'age_limit': 0,
'tags': 'count:17',
}
}]
def _extract_from_webpage(self, url, webpage):
video_... | Not a necessary change, but it is easier to wrap in try_call imo
```suggestion
'tags': try_call(lambda: self._html_search_meta(
['keywords', 'keyword', 'dtk:keywords'], webpage).split(',')),
``` | from .common import InfoExtractor
from ..utils import int_or_none, merge_dicts, try_call, url_basename
class DetikEmbedIE(InfoExtractor):
_VALID_URL = False
_WEBPAGE_TESTS = [{
# cnn embed
'url': 'https://www.cnnindonesia.com/embed/video/846189',
'info_dict': {
'id': '84618... | @@ -120,3 +120,66 @@ def _real_extract(self, url):
'subtitles': subtitles,
'tags': str_or_none(self._html_search_meta(['keywords', 'keyword', 'dtk:keywords'], webpage), '').split(','),
})
+
+
+class DetikEmbedIE(InfoExtractor):
+ _VALID_URL = False
+ _WEBPAGE_TESTS = [{
+ ... | yt_dlp/extractor/detik.py | 26 | Python | 0.857 | suggestion | 234 | 29 | 163 | false | [extractor/detik] Generalize detik extractor | 4,899 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'description': 'md5:9b2257341b6f375cdcf90106146d5ffb',
'thumbnail': 'https://cdnv.detik.com/videoservice/AdminTV/2022/07/04/5d6187e402ec4a91877755a5886ff5b6-20220704161859-0s.jpg?w=650&q=80',
'title': 'Mulai Rp 10 Jutaan! Ini Skema Kredit Mitsubishi Pajero Sport',
'timest... | Remember that _extract_from_webpage runs on every generic page. So this is too broad | from .common import InfoExtractor
from ..utils import int_or_none, merge_dicts, try_call, url_basename
class DetikEmbedIE(InfoExtractor):
_VALID_URL = False
_WEBPAGE_TESTS = [{
# cnn embed
'url': 'https://www.cnnindonesia.com/embed/video/846189',
'info_dict': {
'id': '84618... | @@ -120,3 +120,66 @@ def _real_extract(self, url):
'subtitles': subtitles,
'tags': str_or_none(self._html_search_meta(['keywords', 'keyword', 'dtk:keywords'], webpage), '').split(','),
})
+
+
+class DetikEmbedIE(InfoExtractor):
+ _VALID_URL = False
+ _WEBPAGE_TESTS = [{
+ ... | yt_dlp/extractor/detik.py | 26 | Python | 0.286 | refactor | 84 | 42 | 163 | false | [extractor/detik] Generalize detik extractor | 4,899 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
player_type, video_data = self._search_regex(
r'<script\s*[^>]+src="https?://(aws)?cdn\.detik\.net\.id/(?P<type>flowplayer|detikVideo)[^>]+>\s*(?P<video_data>{[^}]+})',
webpage, 'playerjs', group=('type', 'video_data'), default=(None, ''))
json_ld_data = self._search_json_ld(web... | Does anyone know why in the test, it always complaining `duration` (when `duration` metadata uncommented). Is it bug from test runner or is it my mistake ?
<details>
<summary> log from test </summary>
```shell
(python_proj2) [REDACTED]>python test/test_download.py TestDownload.test_DetikEmbed_all
[debug] Loade... | 'ext': 'mp4',
'title': 'Puluhan Pejabat Rusia Tuntut Putin Mundur',
'tags': ['putin'],
'age_limit': 0,
'thumbnail': 'https://awsimages.detik.net.id/visual/2022/09/13/cnbc-indonesia-tv-3_169.png?w=600&q=80',
'description': 'md5:8b9111e37555fcd95fe54... | @@ -1,122 +1,128 @@
from .common import InfoExtractor
-from ..utils import merge_dicts, str_or_none
+from ..utils import int_or_none, merge_dicts, try_call, url_basename
-class Detik20IE(InfoExtractor):
- IE_NAME = '20.detik.com'
- _VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-... | yt_dlp/extractor/detik.py | 26 | Python | 1 | bug | 6,622 | 42 | 51 | false | [extractor/detik] Generalize detik extractor | 4,899 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | HobbyistDev |
'upload_date': '20220911',
'duration': 76.0,
'timestamp': 1662869995,
'description': 'md5:ece7b003b3ee7d81c6a5cfede7d5397d',
'thumbnail': r're:https://akcdn\.detik\.net\.id/visual/2022/09/11/thumbnail-video-1_169\.jpeg',
'title': 'VIDEO: Momen Char... | It's better to directly return a dict when there are so many fields imo
```suggestion
return merge_dicts(json_ld_data, {
'_type': 'url_transparent',
'url': embed_url,
'video_id': video_id,
'upload_date': upload_date,
tags=try_call(lambda: self._... | 'duration': 76.0,
'timestamp': 1662869995,
'description': 'md5:ece7b003b3ee7d81c6a5cfede7d5397d',
'thumbnail': r're:https://akcdn\.detik\.net\.id/visual/2022/09/11/thumbnail-video-1_169\.jpeg',
'title': 'VIDEO: Momen Charles Disambut Meriah usai Dilantik jadi ... | @@ -141,3 +141,56 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, url_basename(url))
cnn_url = self._html_search_regex(r"video:\s*'([^']+)'", webpage, 'cnn url')
return self.url_result('http://cnn.com/video/?/video/' + cnn_url, CNNIE.ie_key())
+
+
+class CNNIndonesiaIE(... | yt_dlp/extractor/cnn.py | 26 | Python | 1 | suggestion | 387 | 27 | 29 | false | [extractor/detik] Generalize detik extractor | 4,899 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'url': 'https://www.cnnindonesia.com/internasional/20220911104341-139-846189/video-momen-charles-disambut-meriah-usai-dilantik-jadi-raja-inggris',
'info_dict': {
'id': '846189',
'ext': 'mp4',
'upload_date': '20220911',
'duration': 76.0,
'timest... | ```suggestion
json_ld_list_ = list(self._yield_json_ld(html, video_id))
json_ld_data = self._json_ld(json_ld_list_, display_id)
embed_url = next(
json_ld.get('embedUrl') for json_ld in json_ld_list if json_ld.get('@type') == 'VideoObject')
``` | 'info_dict': {
'id': '846189',
'ext': 'mp4',
'upload_date': '20220911',
'duration': 76.0,
'timestamp': 1662869995,
'description': 'md5:ece7b003b3ee7d81c6a5cfede7d5397d',
'thumbnail': r're:https://akcdn\.detik\.net\.id/visual/202... | @@ -141,3 +141,56 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, url_basename(url))
cnn_url = self._html_search_regex(r"video:\s*'([^']+)'", webpage, 'cnn url')
return self.url_result('http://cnn.com/video/?/video/' + cnn_url, CNNIE.ie_key())
+
+
+class CNNIndonesiaIE(... | yt_dlp/extractor/cnn.py | 26 | Python | 0.929 | suggestion | 284 | 31 | 33 | false | [extractor/detik] Generalize detik extractor | 4,899 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'ext': 'mp4',
'upload_date': '20220911',
'duration': 76.0,
'timestamp': 1662869995,
'description': 'md5:ece7b003b3ee7d81c6a5cfede7d5397d',
'thumbnail': r're:https://akcdn\.detik\.net\.id/visual/2022/09/11/thumbnail-video-1_169\.jpeg',
'... | Note that video_id is not passed through transparently. Only return it if you are sure this id is same as the final id | 'upload_date': '20220911',
'duration': 76.0,
'timestamp': 1662869995,
'description': 'md5:ece7b003b3ee7d81c6a5cfede7d5397d',
'thumbnail': r're:https://akcdn\.detik\.net\.id/visual/2022/09/11/thumbnail-video-1_169\.jpeg',
'title': 'VIDEO: Momen Char... | @@ -141,3 +141,56 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, url_basename(url))
cnn_url = self._html_search_regex(r"video:\s*'([^']+)'", webpage, 'cnn url')
return self.url_result('http://cnn.com/video/?/video/' + cnn_url, CNNIE.ie_key())
+
+
+class CNNIndonesiaIE(... | yt_dlp/extractor/cnn.py | 26 | Python | 0.357 | suggestion | 118 | 28 | 30 | false | [extractor/detik] Generalize detik extractor | 4,899 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'age_limit': 0,
'thumbnail': 'https://cdnv.detik.com/videoservice/AdminTV/2022/09/14/f15cae71d7b640c58e75b254ecbb1ce1-20220914071613-0s.jpg?w=400&q=80',
'display_id': 'pakar-bicara-soal-tim-khusus-jokowi-dan-mereka-yang-pro-ke-bjorka',
'upload_date': '20220914',
... | ```suggestion
video_json_data = self._parse_json(video_data.replace('\'', '"'), display_id)
``` | 'age_limit': 0,
'thumbnail': 'https://cdnv.detik.com/videoservice/AdminTV/2022/09/14/f15cae71d7b640c58e75b254ecbb1ce1-20220914071613-0s.jpg?w=400&q=80',
'display_id': 'pakar-bicara-soal-tim-khusus-jokowi-dan-mereka-yang-pro-ke-bjorka',
'upload_date': '20220914',
... | @@ -1,122 +1,162 @@
from .common import InfoExtractor
-from ..utils import merge_dicts, str_or_none
+from ..utils import int_or_none, merge_dicts, try_call, url_basename
-class Detik20IE(InfoExtractor):
- IE_NAME = '20.detik.com'
- _VALID_URL = r'https?://20\.detik\.com/((?!program)[\w-]+)/[\d-]+/(?P<id>[\w-... | yt_dlp/extractor/detik.py | 26 | Python | 0.786 | suggestion | 109 | 51 | 51 | false | [extractor/detik] Generalize detik extractor | 4,899 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
from yt_dlp.extractor.common import InfoExtractor
from yt_dlp.utils import ExtractorError, mimetype2ext, traverse_obj
class BerufeTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[a-z\-/]+/film;filmId=(?P<id>[a-zA-Z\d\-_]+)'
_TESTS = [{
'url': 'https://web.arbeit... | ```suggestion
from .common import InfoExtractor
from ..utils import ExtractorError, mimetype2ext, traverse_obj
``` | from .common import InfoExtractor
from ..utils import float_or_none, mimetype2ext, traverse_obj
class BerufeTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[^?#]+/film;filmId=(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://web.arbeitsagentur.de/berufetv/studienberuf... | @@ -0,0 +1,79 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import ExtractorError, mimetype2ext, traverse_obj | yt_dlp/extractor/berufetv.py | 2 | Python | 0.929 | refactor | 117 | 27 | 27 | false | [BerufeTV] Add extractor | 4,921 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Fabi019 |
from yt_dlp.extractor.common import InfoExtractor
from yt_dlp.utils import ExtractorError, mimetype2ext, traverse_obj
class BerufeTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[a-z\-/]+/film;filmId=(?P<id>[a-zA-Z\d\-_]+)'
_TESTS = [{
'url': 'https://web.arbeit... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[^?#]+/film;filmId=(?P<id>[\w-]+)'
``` | from .common import InfoExtractor
from ..utils import float_or_none, mimetype2ext, traverse_obj
class BerufeTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[^?#]+/film;filmId=(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://web.arbeitsagentur.de/berufetv/studienberuf... | @@ -0,0 +1,79 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import ExtractorError, mimetype2ext, traverse_obj
+
+
+class BerufeTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[a-z\-/]+/film;filmId=(?P<id>[a-zA-Z\d\-_]+)' | yt_dlp/extractor/berufetv.py | 6 | Python | 0.714 | suggestion | 125 | 31 | 31 | false | [BerufeTV] Add extractor | 4,921 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Fabi019 |
_TESTS = [{
'url': 'https://web.arbeitsagentur.de/berufetv/studienberufe/wirtschaftswissenschaften/wirtschaftswissenschaften-volkswirtschaft/film;filmId=DvKC3DUpMKvUZ_6fEnfg3u',
'md5': '041b6432ec8e6838f84a5c30f31cc795',
'info_dict': {
'id': 'DvKC3DUpMKvUZ_6fEnfg3u',
... | ```suggestion
meta = traverse_obj(
movie_metadata, ('metadaten', lambda _, i: video_id == i['miId']), default={})
``` | _TESTS = [{
'url': 'https://web.arbeitsagentur.de/berufetv/studienberufe/wirtschaftswissenschaften/wirtschaftswissenschaften-volkswirtschaft/film;filmId=DvKC3DUpMKvUZ_6fEnfg3u',
'md5': '041b6432ec8e6838f84a5c30f31cc795',
'info_dict': {
'id': 'DvKC3DUpMKvUZ_6fEnfg3u',
... | @@ -0,0 +1,79 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import ExtractorError, mimetype2ext, traverse_obj
+
+
+class BerufeTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[a-z\-/]+/film;filmId=(?P<id>[a-zA-Z\d\-_]+)'
+ _TESTS = [{
+ '... | yt_dlp/extractor/berufetv.py | 26 | Python | 0.714 | suggestion | 140 | 51 | 51 | false | [BerufeTV] Add extractor | 4,921 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Fabi019 |
def _real_extract(self, url):
video_id = self._match_id(url)
movie_metadata = self._download_json(
'https://rest.arbeitsagentur.de/infosysbub/berufetv/pc/v1/film-metadata',
video_id, 'Downloading JSON metadata',
headers={'X-API-Key': '79089773-4892-4386-86e6-e85... | is this error expected?
```suggestion
video_sources = traverse_obj(video, ['videoSources', 'html'])
if not video_sources:
raise ExtractorError('Failed to obtain video source list', expected=True)
formats = []
subtitles = {}
for key, source in video_source... |
def _real_extract(self, url):
video_id = self._match_id(url)
movie_metadata = self._download_json(
'https://rest.arbeitsagentur.de/infosysbub/berufetv/pc/v1/film-metadata',
video_id, 'Downloading JSON metadata',
headers={'X-API-Key': '79089773-4892-4386-86e6-e85... | @@ -0,0 +1,79 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import ExtractorError, mimetype2ext, traverse_obj
+
+
+class BerufeTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[a-z\-/]+/film;filmId=(?P<id>[a-zA-Z\d\-_]+)'
+ _TESTS = [{
+ '... | yt_dlp/extractor/berufetv.py | 26 | Python | 1 | bug | 479 | 51 | 51 | false | [BerufeTV] Add extractor | 4,921 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Fabi019 |
movie_metadata = self._download_json(
'https://rest.arbeitsagentur.de/infosysbub/berufetv/pc/v1/film-metadata',
video_id, 'Downloading JSON metadata',
headers={'X-API-Key': '79089773-4892-4386-86e6-e8503669f426'}, fatal=False)
meta = next(
item for item ... | ```suggestion
fmts, subs = self._extract_m3u8_formats_and_subtitles(source[0]['source'], video_id)
``` |
movie_metadata = self._download_json(
'https://rest.arbeitsagentur.de/infosysbub/berufetv/pc/v1/film-metadata',
video_id, 'Downloading JSON metadata',
headers={'X-API-Key': '79089773-4892-4386-86e6-e8503669f426'}, fatal=False)
meta = traverse_obj(
movie_... | @@ -0,0 +1,79 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import ExtractorError, mimetype2ext, traverse_obj
+
+
+class BerufeTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[a-z\-/]+/film;filmId=(?P<id>[a-zA-Z\d\-_]+)'
+ _TESTS = [{
+ '... | yt_dlp/extractor/berufetv.py | 26 | Python | 0.786 | refactor | 120 | 51 | 48 | false | [BerufeTV] Add extractor | 4,921 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Fabi019 |
formats = []
subtitles = {}
for key, source in video_sources.items():
if key == 'auto':
m3u8_url = source[0]['source']
fmts, subs = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id)
formats += fmts
subtitles... | ```suggestion
for track in video.get('videoTracks') or []:
if track.get('type') != 'SUBTITLES':
continue
subtitles.setdefault(track['language'], []).append({
'url': track['source'],
'name': track.get('label'),
'ext': ... | formats += fmts
subtitles = subs
else:
formats.append({
'url': source[0]['source'],
'ext': mimetype2ext(source[0]['mimeType']),
'format_id': key,
})
for track in video.get('vi... | @@ -0,0 +1,79 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import ExtractorError, mimetype2ext, traverse_obj
+
+
+class BerufeTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[a-z\-/]+/film;filmId=(?P<id>[a-zA-Z\d\-_]+)'
+ _TESTS = [{
+ '... | yt_dlp/extractor/berufetv.py | 26 | Python | 0.929 | suggestion | 346 | 39 | 30 | false | [BerufeTV] Add extractor | 4,921 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Fabi019 |
for key, source in video_sources.items():
if key == 'auto':
m3u8_url = source[0]['source']
fmts, subs = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id)
formats += fmts
subtitles = subs
else:
form... | ```suggestion
'title': meta.get('titel') or traverse_obj(video, ('videoMetaData', 'title')),
``` | 'url': source[0]['source'],
'ext': mimetype2ext(source[0]['mimeType']),
'format_id': key,
})
for track in video.get('videoTracks') or []:
if track.get('type') != 'SUBTITLES':
continue
subtitles.s... | @@ -0,0 +1,79 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import ExtractorError, mimetype2ext, traverse_obj
+
+
+class BerufeTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[a-z\-/]+/film;filmId=(?P<id>[a-zA-Z\d\-_]+)'
+ _TESTS = [{
+ '... | yt_dlp/extractor/berufetv.py | 26 | Python | 0.714 | suggestion | 110 | 35 | 26 | false | [BerufeTV] Add extractor | 4,921 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Fabi019 |
formats += fmts
subtitles = subs
else:
formats.append({
'url': source[0]['source'],
'ext': mimetype2ext(source[0]['mimeType']),
'format_id': key,
})
video_tracks = video.get('... | ```suggestion
'categories': [meta['kategorie']] if meta.get('kategorie') else None,
``` | from .common import InfoExtractor
from ..utils import float_or_none, mimetype2ext, traverse_obj
class BerufeTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[^?#]+/film;filmId=(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://web.arbeitsagentur.de/berufetv/studienberuf... | @@ -0,0 +1,79 @@
+from yt_dlp.extractor.common import InfoExtractor
+from yt_dlp.utils import ExtractorError, mimetype2ext, traverse_obj
+
+
+class BerufeTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[a-z\-/]+/film;filmId=(?P<id>[a-zA-Z\d\-_]+)'
+ _TESTS = [{
+ '... | yt_dlp/extractor/berufetv.py | 26 | Python | 0.714 | suggestion | 101 | 31 | 71 | false | [BerufeTV] Add extractor | 4,921 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Fabi019 |
_TESTS = [{
'url': 'https://web.arbeitsagentur.de/berufetv/studienberufe/wirtschaftswissenschaften/wirtschaftswissenschaften-volkswirtschaft/film;filmId=DvKC3DUpMKvUZ_6fEnfg3u',
'md5': '041b6432ec8e6838f84a5c30f31cc795',
'info_dict': {
'id': 'DvKC3DUpMKvUZ_6fEnfg3u',
... | ```suggestion
meta = traverse_obj(
movie_metadata, ('metadaten', lambda _, i: video_id == i['miId']),
get_all=False, default={})
``` | _TESTS = [{
'url': 'https://web.arbeitsagentur.de/berufetv/studienberufe/wirtschaftswissenschaften/wirtschaftswissenschaften-volkswirtschaft/film;filmId=DvKC3DUpMKvUZ_6fEnfg3u',
'md5': '041b6432ec8e6838f84a5c30f31cc795',
'info_dict': {
'id': 'DvKC3DUpMKvUZ_6fEnfg3u',
... | @@ -0,0 +1,70 @@
+from .common import InfoExtractor
+from ..utils import float_or_none, mimetype2ext, traverse_obj
+
+
+class BerufeTVIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[^?#]+/film;filmId=(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'https://web.arbeitsagentur... | yt_dlp/extractor/berufetv.py | 26 | Python | 0.714 | suggestion | 168 | 51 | 51 | false | [BerufeTV] Add extractor | 4,921 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Fabi019 |
_TESTS = [{
'url': ':ythistory',
'only_matching': True,
}]
class YoutubeStoriesIE(InfoExtractor):
IE_DESC = 'YouTube channel stories; "ytstories:" prefix'
IE_NAME = 'youtube:stories'
_VALID_URL = r'ytstories:UC(?P<id>[A-Za-z0-9_-]{21}[AQgw])$'
_TESTS = [{
'url': 'ytstor... | I would have restricted it to just the id, but if you want to support URL, might as well support all patterns
```suggestion
_VALID_URL = f'(?x)^ytshortsap:{YoutubeIE._VALID_URL[5:]}'
``` | _TESTS = [{
'url': ':ythistory',
'only_matching': True,
}]
class YoutubeStoriesIE(InfoExtractor):
IE_DESC = 'YouTube channel stories; "ytstories:" prefix'
IE_NAME = 'youtube:stories'
_VALID_URL = r'ytstories:UC(?P<id>[A-Za-z0-9_-]{21}[AQgw])$'
_TESTS = [{
'url': 'ytstor... | @@ -6307,6 +6317,33 @@ def _real_extract(self, url):
ie=YoutubeTabIE, video_id=playlist_id)
+class YoutubeShortsAudioPivotIE(InfoExtractor):
+ IE_DESC = 'YouTube Shorts audio pivot; "ytshortsap:" prefix'
+ IE_NAME = 'youtube:shorts:audiopivot'
+ _VALID_URL = f'(?x)^ytshortsap:{YoutubeIE._VALID... | yt_dlp/extractor/youtube.py | 26 | Python | 0.714 | suggestion | 193 | 51 | 51 | false | [extractor/youtube] Add support for extracting shorts audio pivot feed | 4,932 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
class YoutubeShortsAudioPivotIE(InfoExtractor):
IE_DESC = 'YouTube Shorts audio pivot; "ytshortsap:" prefix'
IE_NAME = 'youtube:shorts:audiopivot'
_VALID_URL = f'(?x)^ytshortsap:{YoutubeIE._VALID_URL[5:]}' # TODO: might be better to just restrict this to id and /shorts/
_TESTS = [{
'url': 'yts... | ```suggestion
ie=YoutubeTabIE)
``` |
class YoutubeShortsAudioPivotIE(InfoExtractor):
IE_DESC = 'YouTube Shorts audio pivot (Shorts using audio of a given video); "ytshortsap:" prefix'
IE_NAME = 'youtube:shorts:pivot:audio'
_VALID_URL = f'(?x)^ytshortsap:{YoutubeIE._VALID_URL[5:]}'
_TESTS = [{
'url': 'ytshortsap:https://www.youtube... | @@ -6307,6 +6317,33 @@ def _real_extract(self, url):
ie=YoutubeTabIE, video_id=playlist_id)
+class YoutubeShortsAudioPivotIE(InfoExtractor):
+ IE_DESC = 'YouTube Shorts audio pivot; "ytshortsap:" prefix'
+ IE_NAME = 'youtube:shorts:audiopivot'
+ _VALID_URL = f'(?x)^ytshortsap:{YoutubeIE._VALID... | yt_dlp/extractor/youtube.py | 26 | Python | 0.429 | suggestion | 48 | 51 | 51 | false | [extractor/youtube] Add support for extracting shorts audio pivot feed | 4,932 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
if shelf_url:
# Skipping links to another channels, note that checking for
# endpoint.commandMetadata.webCommandMetadata.webPageTypwebPageType == WEB_PAGE_TYPE_CHANNEL
# will not work
if skip_channels and '/channels?' in shelf_url:
return
... | ```suggestion
rich_grid_renderer, ('content', ('videoRenderer', 'reelItemRenderer')), get_all=False) or {}
``` | if shelf_url:
# Skipping links to another channels, note that checking for
# endpoint.commandMetadata.webCommandMetadata.webPageTypwebPageType == WEB_PAGE_TYPE_CHANNEL
# will not work
if skip_channels and '/channels?' in shelf_url:
return
... | @@ -4327,8 +4327,8 @@ def _playlist_entries(self, video_list_renderer):
yield self._extract_video(renderer)
def _rich_entries(self, rich_grid_renderer):
- renderer = try_get(
- rich_grid_renderer, lambda x: x['content']['videoRenderer'], dict) or {}
+ renderer = traverse_obj... | yt_dlp/extractor/youtube.py | 26 | Python | 0.714 | suggestion | 124 | 51 | 51 | false | [extractor/youtube] Add support for extracting shorts audio pivot feed | 4,932 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
_TESTS = [{
'url': ':ythistory',
'only_matching': True,
}]
class YoutubeStoriesIE(InfoExtractor):
IE_DESC = 'YouTube channel stories; "ytstories:" prefix'
IE_NAME = 'youtube:stories'
_VALID_URL = r'ytstories:UC(?P<id>[A-Za-z0-9_-]{21}[AQgw])$'
_TESTS = [{
'url': 'ytstor... | ```suggestion
_VALID_URL = f'(?x)ytshortsap:{YoutubeIE._VALID_URL[5:]}'
``` | _TESTS = [{
'url': ':ythistory',
'only_matching': True,
}]
class YoutubeStoriesIE(InfoExtractor):
IE_DESC = 'YouTube channel stories; "ytstories:" prefix'
IE_NAME = 'youtube:stories'
_VALID_URL = r'ytstories:UC(?P<id>[A-Za-z0-9_-]{21}[AQgw])$'
_TESTS = [{
'url': 'ytstor... | @@ -6307,6 +6317,33 @@ def _real_extract(self, url):
ie=YoutubeTabIE, video_id=playlist_id)
+class YoutubeShortsAudioPivotIE(InfoExtractor):
+ IE_DESC = 'YouTube Shorts audio pivot; "ytshortsap:" prefix'
+ IE_NAME = 'youtube:shorts:audiopivot'
+ _VALID_URL = f'(?x)^ytshortsap:{YoutubeIE._VALID... | yt_dlp/extractor/youtube.py | 26 | Python | 0.571 | suggestion | 81 | 51 | 51 | false | [extractor/youtube] Add support for extracting shorts audio pivot feed | 4,932 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
validate_outtmpl(opts.sponsorblock_chapter_title, 'SponsorBlock chapter title')
for k, tmpl in opts.progress_template.items():
k = f'{k[:-6]} console title' if '-title' in k else f'{k} progress'
validate_outtmpl(tmpl, f'{k} template')
outtmpl_default = opts.outtmpl.get('default')
if out... | Since it got this complicated, better to use a regex imo | validate_outtmpl(opts.sponsorblock_chapter_title, 'SponsorBlock chapter title')
for k, tmpl in opts.progress_template.items():
k = f'{k[:-6]} console title' if '-title' in k else f'{k} progress'
validate_outtmpl(tmpl, f'{k} template')
outtmpl_default = opts.outtmpl.get('default')
if out... | @@ -329,8 +329,13 @@ def parse_chapters(name, value):
for regex in value or []:
if regex.startswith('*'):
for range in regex[1:].split(','):
- dur = tuple(map(parse_duration, range.strip().split('-')))
- if len(dur) == 2 and all(t is not None ... | yt_dlp/__init__.py | 26 | Python | 0.286 | suggestion | 56 | 51 | 51 | false | Allow open ranges for chapters | 4,940 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
requested_ranges = self.params.get('download_ranges')
if requested_ranges:
requested_ranges = tuple(requested_ranges(info_dict, self))
best_format, downloaded_formats = formats_to_download[-1], []
if download:
if best_format:
def to_screen(*msg):
... | Wouldn't this be much simpler if we parse empty range to `0` and `float('inf')`? That would also simplify the above printing | requested_ranges = self.params.get('download_ranges')
if requested_ranges:
requested_ranges = tuple(requested_ranges(info_dict, self))
best_format, downloaded_formats = formats_to_download[-1], []
if download:
if best_format:
def to_screen(*msg):
... | @@ -2720,8 +2721,8 @@ def to_screen(*msg):
offset, duration = info_dict.get('section_start') or 0, info_dict.get('duration') or float('inf')
if chapter or offset:
new_info.update({
- 'section_start': offset + chapter.get('start_time', 0),
- ... | yt_dlp/YoutubeDL.py | 26 | Python | 0.571 | refactor | 124 | 51 | 51 | false | Allow open ranges for chapters | 4,940 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
format_id_list.append('preview')
abr = f.get('abr')
if abr:
f['abr'] = int(abr)
if protocol == 'hls':
protocol = 'm3u8' if ext == 'aac' else 'm3u8_native'
else:
protocol = 'http'
f.update({
... | ```suggestion
stream = None if extract_flat else self._download_json(
format_url, track_id, query=query, fatal=False, headers=self._HEADERS)
``` | format_id_list.append('preview')
abr = f.get('abr')
if abr:
f['abr'] = int(abr)
if protocol == 'hls':
protocol = 'm3u8' if ext == 'aac' else 'm3u8_native'
else:
protocol = 'http'
f.update({
... | @@ -179,6 +194,158 @@ def sign(self, user, pw, clid):
return out
+ def _extract_info_dict(self, info, full_title=None, secret_token=None, extract_flat=False):
+ track_id = compat_str(info['id'])
+ title = info['title']
+
+ format_urls = set()
+ formats = []
+ query = {... | yt_dlp/extractor/soundcloud.py | 26 | Python | 0.786 | refactor | 175 | 51 | 51 | false | [soundcloud] Enriched search results | 4,965 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | SuperSonicHub1 |
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
import re
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
'url': 'https://www.mxplayer.in/mov... | Don't delete tests, if these urls are not longer available you can add
```python
{
....,
'skip': 'No longer available',
}
``` | from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
int_or_none,
traverse_obj,
try_get,
)
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
'... | @@ -1,178 +1,99 @@
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
+import re
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
- 'url':... | yt_dlp/extractor/mxplayer.py | 9 | Python | 0.714 | suggestion | 135 | 34 | 34 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
'id': '5e5305c28f1409847cdc4520b6ad77cf',
'display_id': 'game-of-power-online',
'title': 'Game Of Power',
'duration': 1845,
'ext': 'mp4',
'description': 'Cops arrest Ashraf assuming a prostitute. But she gets away with her new identity, Leela Paswa... | Inline these values, avoid declaring variables that you only use once | },
'params': {
'format': 'bv',
'skip_download': True,
},
}, {
'url': 'https://www.mxplayer.in/movie/watch-knock-knock-hindi-dubbed-movie-online-b9fa28df3bfb8758874735bbd7d2655a?watch=true',
'info_dict': {
'id': 'b9fa28df3bfb8758874735bbd7d2... | @@ -1,178 +1,99 @@
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
+import re
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
- 'url':... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.286 | suggestion | 69 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
'description': 'Cops arrest Ashraf assuming a prostitute. But she gets away with her new identity, Leela Paswan. Maqsood dumps Nana Mhatre and appoints Shaqeel Ansari as a new Bombay chief. For society, he is a sophisticated businessman. The rift between the new chief minister, Yashwant Patil and Shaqeel An... | Inline these values at the return | }, {
'url': 'https://www.mxplayer.in/movie/watch-knock-knock-hindi-dubbed-movie-online-b9fa28df3bfb8758874735bbd7d2655a?watch=true',
'info_dict': {
'id': 'b9fa28df3bfb8758874735bbd7d2655a',
'display_id': 'episode-1-online',
'ext': 'mp4',
'title': 'Knoc... | @@ -1,178 +1,99 @@
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
+import re
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
- 'url':... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.071 | suggestion | 33 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
'format': 'bv',
'skip_download': True,
},
}]
def _real_extract(self, url):
video_type, display_id, video_id = self._match_valid_url(url).groups()
if 'show' in video_type:
video_type = 'episode'
API_URL = f'https://api.mxplay.com/v1/web/detai... | Use traverse_obj
```python
series = traverse_obj(data_json, ('container', 'container', 'title'))
season = traverse_obj(data_json, ('container', 'title'))
``` | 'duration': 5970,
},
'params': {
'format': 'bv',
'skip_download': True,
},
'skip': 'No longer available',
}, {
'url': 'https://www.mxplayer.in/show/watch-shaitaan/season-1/the-infamous-taxi-gang-of-meerut-online-45055d5bcff169ad48f2ad7552a8... | @@ -1,178 +1,99 @@
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
+import re
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
- 'url':... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.786 | suggestion | 163 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
if 'show' in video_type:
video_type = 'episode'
API_URL = f'https://api.mxplay.com/v1/web/detail/video?type={video_type}&id={video_id}'
STREAM_URL = 'https://llvod.mxplay.com/{}'
data_json = self._download_json(API_URL, display_id)
title = data_json['title']
... | Could we rename it to 'stream_type? and also, please use paranthesis
```python
for stream_type in ('dash', 'hls'):
``` | 'url': 'https://www.mxplayer.in/show/watch-shaitaan/season-1/the-infamous-taxi-gang-of-meerut-online-45055d5bcff169ad48f2ad7552a83d6c',
'info_dict': {
'id': '45055d5bcff169ad48f2ad7552a83d6c',
'ext': 'mp4',
'title': 'The infamous taxi gang of Meerut',
'des... | @@ -1,178 +1,99 @@
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
+import re
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
- 'url':... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.929 | suggestion | 123 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
duration = data_json.get('duration')
formats = []
subtitles = {}
description = data_json.get('description')
series, season, season_number, episode_number = None, None, None, None
if video_type == 'episode':
series = data_json.get('container').get('container')... | You can avoid the assignation if you use
```python
self._merge_subtitles(subs, target=subtitles)
``` | 'season': 'Season 1',
'series': 'Shaitaan',
'episode': 'Episode 1'
},
'params': {
'format': 'best',
'skip_download': True,
},
'skip': 'No longer available.'
}, {
'url': 'https://www.mxplayer.in/show/watch-aashram/cha... | @@ -1,178 +1,99 @@
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
+import re
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
- 'url':... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.786 | suggestion | 105 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
STREAM_URL = 'https://llvod.mxplay.com/{}'
data_json = self._download_json(API_URL, display_id)
title = data_json['title']
duration = data_json.get('duration')
formats = []
subtitles = {}
description = data_json.get('description')
series, season, season_... | Nitpick: can we use `fmts` instead of `frmt`, the former is far more common | 'title': 'The infamous taxi gang of Meerut',
'description': 'md5:033a0a7e3fd147be4fb7e07a01a3dc28',
'season_number': 1,
'episode_number': 1,
'duration': 2332,
'season': 'Season 1',
'series': 'Shaitaan',
'episode': 'Episode 1... | @@ -1,178 +1,99 @@
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
+import re
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
- 'url':... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.429 | suggestion | 75 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
video_type, display_id, video_id = self._match_valid_url(url).groups()
if 'show' in video_type:
video_type = 'episode'
API_URL = f'https://api.mxplay.com/v1/web/detail/video?type={video_type}&id={video_id}'
STREAM_URL = 'https://llvod.mxplay.com/{}'
data_json = sel... | I think you could use `self._search_regex()` | 'skip': 'No longer available',
}, {
'url': 'https://www.mxplayer.in/show/watch-shaitaan/season-1/the-infamous-taxi-gang-of-meerut-online-45055d5bcff169ad48f2ad7552a83d6c',
'info_dict': {
'id': '45055d5bcff169ad48f2ad7552a83d6c',
'ext': 'mp4',
'title': 'The... | @@ -1,178 +1,99 @@
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
+import re
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
- 'url':... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.286 | suggestion | 44 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
},
'params': {
'format': 'bv',
'skip_download': True,
},
}]
def _real_extract(self, url):
video_type, display_id, video_id = self._match_valid_url(url).groups()
if 'show' in video_type:
video_type = 'episode'
data_json = self... | Make it non-fatal and use int_or_none()
```python
season_number = int_or_none(self._search_regex(r'Season (\d+)', season, 'Season Number', fatal=False))
``` | def _real_extract(self, url):
video_type, display_id, video_id = self._match_valid_url(url).group('type', 'display_id', 'id')
if 'show' in video_type:
video_type = 'episode'
data_json = self._download_json(
f'https://api.mxplay.com/v1/web/detail/video?type={video_typ... | @@ -106,73 +108,99 @@ class MxplayerIE(InfoExtractor):
'id': '0452f0d80226c398d63ce7e3ea40fa2d',
'ext': 'mp4',
'title': 'The Attacks of 26/11',
- 'description': 'md5:689bacd29e97b3f31eaf519eb14127e5',
- 'season_number': 0,
- 'episode_number': 0,
+ ... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.786 | suggestion | 161 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
},
'params': {
'format': 'bv',
'skip_download': True,
},
}]
def _real_extract(self, url):
video_type, display_id, video_id = self._match_valid_url(url).groups()
if 'show' in video_type:
video_type = 'episode'
data_json = self... | By the way, can this be inline? If the values don't exist, we'll get None by default | def _real_extract(self, url):
video_type, display_id, video_id = self._match_valid_url(url).group('type', 'display_id', 'id')
if 'show' in video_type:
video_type = 'episode'
data_json = self._download_json(
f'https://api.mxplay.com/v1/web/detail/video?type={video_typ... | @@ -106,73 +108,99 @@ class MxplayerIE(InfoExtractor):
'id': '0452f0d80226c398d63ce7e3ea40fa2d',
'ext': 'mp4',
'title': 'The Attacks of 26/11',
- 'description': 'md5:689bacd29e97b3f31eaf519eb14127e5',
- 'season_number': 0,
- 'episode_number': 0,
+ ... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.214 | suggestion | 84 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
'display_id': 'game-of-power-online',
'title': 'Game Of Power',
'duration': 1845,
'ext': 'mp4',
'description': 'Cops arrest Ashraf assuming a prostitute. But she gets away with her new identity, Leela Paswan. Maqsood dumps Nana Mhatre and appoints Shaqeel Ansa... | Avoid trailing parentheses
```python
data_json = self._download_json(
f'https://api.mxplay.com/v1/web/detail/video?type={video_type}&id={video_id}', display_id)
``` | 'season_number': 2,
'episode': 'Episode 2',
'episode_number': 2,
},
'params': {
'format': 'bv',
'skip_download': True,
},
}]
def _real_extract(self, url):
video_type, display_id, video_id = self._match_valid_url(url).gr... | @@ -106,73 +108,99 @@ class MxplayerIE(InfoExtractor):
'id': '0452f0d80226c398d63ce7e3ea40fa2d',
'ext': 'mp4',
'title': 'The Attacks of 26/11',
- 'description': 'md5:689bacd29e97b3f31eaf519eb14127e5',
- 'season_number': 0,
- 'episode_number': 0,
+ ... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.929 | suggestion | 183 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
'skip_download': True,
},
}]
def _real_extract(self, url):
video_type, display_id, video_id = self._match_valid_url(url).groups()
if 'show' in video_type:
video_type = 'episode'
data_json = self._download_json(
f'https://api.mxplay.com/v1/we... | Use an f-string
```python
playlist_url = f'https://llvod.mxplay.com/{data_json["stream"][stream_type]["high"]}'
``` | video_type = 'episode'
data_json = self._download_json(
f'https://api.mxplay.com/v1/web/detail/video?type={video_type}&id={video_id}', display_id)
streams = traverse_obj(data_json, ('stream', {'m3u8': ('hls', 'high'), 'mpd': ('dash', 'high')}))
formats, dash_subs = self... | @@ -106,73 +108,99 @@ class MxplayerIE(InfoExtractor):
'id': '0452f0d80226c398d63ce7e3ea40fa2d',
'ext': 'mp4',
'title': 'The Attacks of 26/11',
- 'description': 'md5:689bacd29e97b3f31eaf519eb14127e5',
- 'season_number': 0,
- 'episode_number': 0,
+ ... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.929 | suggestion | 120 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import try_get
from ..utils import traverse_obj
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
'url': 'http... | Why did you change some descriptions from md5 to readable text? 🤔 | from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
int_or_none,
traverse_obj,
try_get,
)
class MxplayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
_TESTS = [{
'... | @@ -9,15 +10,15 @@ class MxplayerIE(InfoExtractor):
'url': 'https://www.mxplayer.in/show/watch-my-girlfriend-is-an-alien-hindi-dubbed/season-1/episode-1-online-9d2013d31d5835bb8400e3b3c5e7bb72',
'info_dict': {
'id': '9d2013d31d5835bb8400e3b3c5e7bb72',
+ 'display_id': 'episode-1... | yt_dlp/extractor/mxplayer.py | 16 | Python | 0.286 | question | 66 | 41 | 41 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
'id': '9d2013d31d5835bb8400e3b3c5e7bb72',
'display_id': 'episode-1-online',
'ext': 'mp4',
'title': 'Episode 1',
'description': "Watch Season 1, Episode 1 of the show My Girlfriend Is an Alien (Hindi Dubbed).'",
'season_number': 1,
'epis... | If the value is None, you don't need to add that key to the test. I think... mmm | _TESTS = [{
'url': 'https://www.mxplayer.in/show/watch-my-girlfriend-is-an-alien-hindi-dubbed/season-1/episode-1-online-9d2013d31d5835bb8400e3b3c5e7bb72',
'info_dict': {
'id': '9d2013d31d5835bb8400e3b3c5e7bb72',
'display_id': 'episode-1-online',
'ext': 'mp4',
... | @@ -28,53 +29,54 @@ class MxplayerIE(InfoExtractor):
'url': 'https://www.mxplayer.in/movie/watch-knock-knock-hindi-dubbed-movie-online-b9fa28df3bfb8758874735bbd7d2655a?watch=true',
'info_dict': {
'id': 'b9fa28df3bfb8758874735bbd7d2655a',
+ 'display_id': 'episode-1-online',
... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.214 | suggestion | 80 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | elyse0 | itachi-19 |
subtitles = self._merge_subtitles(subtitles, subs)
self._sort_formats(formats)
return {
'id': video_id,
'display_id': display_id,
'title': data_json.get('name') or display_id,
'description': data_json.get('description'),
'season... | Title shouldn't fatal
```suggestion
'title': data_json.get('title'),
``` | formats, dash_subs = self._extract_mpd_formats_and_subtitles(
f'https://llvod.mxplay.com/{streams["mpd"]}', display_id, fatal=False)
hls_frmts, hls_subs = self._extract_m3u8_formats_and_subtitles(
f'https://llvod.mxplay.com/{streams["m3u8"]}', display_id, fatal=False)
fo... | @@ -106,73 +106,93 @@ class MxplayerIE(InfoExtractor):
'id': '0452f0d80226c398d63ce7e3ea40fa2d',
'ext': 'mp4',
'title': 'The Attacks of 26/11',
- 'description': 'md5:689bacd29e97b3f31eaf519eb14127e5',
- 'season_number': 0,
- 'episode_number': 0,
+ ... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.643 | suggestion | 87 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | itachi-19 |
headers = {
'X-Av-Code': '23',
'X-Country': 'IN',
'X-Platform': 'android',
'X-App-Version': '1370001318',
'X-Resolution': '3840x2160',
}
data_json = self._download_json(f'{API_URL}{type}/{video_id}', display_id, headers=headers)['profil... | use `group` instead `groups`
```suggestion
video_type, display_id, video_id = self._match_valid_url(url).group('type', 'display_id', 'id')
``` | 'format': 'bv',
'skip_download': True,
},
}, {
'url': 'https://www.mxplayer.in/show/watch-ek-thi-begum-hindi/season-2/game-of-power-online-5e5305c28f1409847cdc4520b6ad77cf',
'info_dict': {
'id': '5e5305c28f1409847cdc4520b6ad77cf',
'display_id':... | @@ -106,73 +106,93 @@ class MxplayerIE(InfoExtractor):
'id': '0452f0d80226c398d63ce7e3ea40fa2d',
'ext': 'mp4',
'title': 'The Attacks of 26/11',
- 'description': 'md5:689bacd29e97b3f31eaf519eb14127e5',
- 'season_number': 0,
- 'episode_number': 0,
+ ... | yt_dlp/extractor/mxplayer.py | 26 | Python | 0.929 | suggestion | 153 | 51 | 51 | false | [Mxplayer] Fix extractor | 4,966 | yt-dlp/yt-dlp | 132,642 | Python | HobbyistDev | itachi-19 |
from .youtube import YoutubeBaseInfoExtractor, YoutubeIE
from ..compat import compat_HTTPError, compat_urllib_parse_unquote
from ..utils import (
KNOWN_EXTENSIONS,
ExtractorError,
HEADRequest,
bug_reports_message,
clean_html,
dict_get,
extract_attributes,
get_element_by_id,
int_or_no... | I noticed you do this often. I suggest setting up `isort` | from .youtube import YoutubeBaseInfoExtractor, YoutubeIE
from ..compat import compat_HTTPError, compat_urllib_parse_unquote
from ..utils import (
KNOWN_EXTENSIONS,
ExtractorError,
HEADRequest,
bug_reports_message,
clean_html,
dict_get,
extract_attributes,
get_element_by_id,
int_or_no... | @@ -28,7 +28,7 @@
unified_strdate,
unified_timestamp,
url_or_none,
- urlhandle_detect_ext,
+ urlhandle_detect_ext, js_to_json, remove_end, | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.357 | suggestion | 57 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
capture_dates.extend(modern_captures + all_captures)
# Fallbacks if any of the above fail
capture_dates.extend([self._OLDEST_CAPTURE_DATE, self._NEWEST_CAPTURE_DATE])
return orderedSet(filter(None, capture_dates))
def _real_extract(self, url):
video_id, url_date, url_da... | RetryManager fixed, but I don't like how the video being not archived triggers the retry. Do we have to retry on 404? | # Fallbacks if any of the above fail
capture_dates.extend([self._OLDEST_CAPTURE_DATE, self._NEWEST_CAPTURE_DATE])
return orderedSet(filter(None, capture_dates))
def _real_extract(self, url):
video_id, url_date, url_date_2 = self._match_valid_url(url).group('id', 'date', 'date2')
... | @@ -698,18 +891,21 @@ def _real_extract(self, url):
url_date = url_date or url_date_2
urlh = None
- try:
- urlh = self._request_webpage(
- HEADRequest('https://web.archive.org/web/2oe_/http://wayback-fakeurl.archive.org/yt/%s' % video_id),
- video_id, ... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.357 | question | 117 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
elif not isinstance(res, list) or len(res) != 0:
self.report_warning('Error while parsing CDX API response' + bug_reports_message())
def _extract_webpage_title(self, webpage):
page_title = self._html_extract_title(webpage, default='')
# YouTube video pages appear to always have ... | ```suggestion
r'(?:yt.playerConfig|ytplayer.config|swfConfig)\s*=',
``` | elif not isinstance(res, list) or len(res) != 0:
self.report_warning('Error while parsing CDX API response' + bug_reports_message())
def _extract_webpage_title(self, webpage):
page_title = self._html_extract_title(webpage, default='')
# YouTube video pages appear to always have ... | @@ -574,6 +714,27 @@ def _extract_metadata(self, video_id, webpage):
initial_data = self._search_json(
self._YT_INITIAL_DATA_RE, webpage, 'initial data', video_id, default={})
+ ytcfg = {}
+ for j in re.findall(r'yt\.setConfig\(\s*(?P<json>{\s*(?s:.+?)\s*})\s*\);', webpage): # ~Ju... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.571 | suggestion | 89 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
traverse_obj(player_config, ('args', 'player_response')) or '{}', video_id, fatal=False)
initial_data_video = traverse_obj(
initial_data, ('contents', 'twoColumnWatchNextResults', 'results', 'results', 'contents', ..., 'videoPrimaryInfoRenderer'),
expected_type=dict, get... | comment should be needed if u improve below var name
```suggestion
``` | traverse_obj(player_config, ('args', 'player_response')) or '{}', video_id, fatal=False)
initial_data_video = traverse_obj(
initial_data, ('contents', 'twoColumnWatchNextResults', 'results', 'results', 'contents', ..., 'videoPrimaryInfoRenderer'),
expected_type=dict, get... | @@ -588,48 +749,80 @@ def _extract_metadata(self, video_id, webpage):
video_details.get('title')
or YoutubeBaseInfoExtractor._get_text(microformats, 'title')
or YoutubeBaseInfoExtractor._get_text(initial_data_video, 'title')
+ or traverse_obj(player_config, ('args', 'ti... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.643 | suggestion | 72 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
initial_data_video = traverse_obj(
initial_data, ('contents', 'twoColumnWatchNextResults', 'results', 'results', 'contents', ..., 'videoPrimaryInfoRenderer'),
expected_type=dict, get_all=False, default={})
video_details = traverse_obj(
player_response, 'videoDetails... | ```suggestion
_CHANNEL_URL_HREF_RE = r'href="[^"]*(?P<url>https?://www\.youtube\.com/(?:user|channel)/[^"]+)"'
``` |
initial_data_video = traverse_obj(
initial_data, ('contents', 'twoColumnWatchNextResults', 'results', 'results', 'contents', ..., 'videoPrimaryInfoRenderer'),
expected_type=dict, get_all=False, default={})
video_details = traverse_obj(
player_response, 'videoDetails... | @@ -588,48 +749,80 @@ def _extract_metadata(self, video_id, webpage):
video_details.get('title')
or YoutubeBaseInfoExtractor._get_text(microformats, 'title')
or YoutubeBaseInfoExtractor._get_text(initial_data_video, 'title')
+ or traverse_obj(player_config, ('args', 'ti... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.786 | suggestion | 124 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
# Uploader refers to the /user/ id ONLY
uploader_id = (
id_from_url(owner_profile_url, 'user')
or id_from_url(upch_url, 'user')
or ytcfg.get('VIDEO_USERNAME'))
uploader_url = f'https://www.youtube.com/user/{uploader_id}' if uploader_id else None
# TO... | ```suggestion
or video_details.get('author'))
``` | # Uploader refers to the /user/ id ONLY
uploader_id = (
id_from_url(owner_profile_url, 'user')
or id_from_url(uploader_or_channel_url, 'user')
or ytcfg.get('VIDEO_USERNAME'))
uploader_url = f'https://www.youtube.com/user/{uploader_id}' if uploader_id else None... | @@ -588,48 +749,80 @@ def _extract_metadata(self, video_id, webpage):
video_details.get('title')
or YoutubeBaseInfoExtractor._get_text(microformats, 'title')
or YoutubeBaseInfoExtractor._get_text(initial_data_video, 'title')
+ or traverse_obj(player_config, ('args', 'ti... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.571 | security | 63 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
[r'(?s)<div\s*class=\"yt-user-info\".*?<a[^>]*[^>]*>\s*(.*?)\s*<\/a', # March 2016
r'(?s)<a[^>]*yt-user-name[^>]*>\s*(.*?)\s*<\/a'], # july 2013
get_element_by_id('watch7-user-header', webpage), 'uploader', default=None)
or self._html_search_regex(
... | ```suggestion
or traverse_obj(player_config, ('args', ('length_seconds', 'l')), get_all=False)
``` | r'(?s)<a[^>]*yt-user-name[^>]*>\s*(.*?)\s*</a'], # july 2013
get_element_by_id('watch7-user-header', webpage), 'uploader', default=None)
or self._html_search_regex(
r'<button\s*href="/user/[^>]*>\s*<span[^>]*>\s*(.+?)\s*<', # April 2012
get_... | @@ -588,48 +749,80 @@ def _extract_metadata(self, video_id, webpage):
video_details.get('title')
or YoutubeBaseInfoExtractor._get_text(microformats, 'title')
or YoutubeBaseInfoExtractor._get_text(initial_data_video, 'title')
+ or traverse_obj(player_config, ('args', 'ti... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.714 | suggestion | 112 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
or self._search_regex(
r'data-channel-external-id=(["\'])(?P<id>(?:(?!\1).)+)\1', # @b45a9e6
webpage, 'channel id', default=None, group='id')
or id_from_url(owner_profile_url, 'channel')
or id_from_url(upch_url, 'channel')
or traverse_obj(... | ```suggestion
[r'(?s)id="eow-date.*?>\s*(.*?)\s*</span>',
r'(?:id="watch-uploader-info".*?>.*?|["\']simpleText["\']\s*:\s*["\'])(?:Published|Uploaded|Streamed live|Started) on (.+?)[<"\']', # @7998520
r'class\s*=\s*"(?:watch-video-date|watch-video-added post-date)"[... | webpage, 'channel id', default=None, group='id')
or id_from_url(owner_profile_url, 'channel')
or id_from_url(uploader_or_channel_url, 'channel')
or traverse_obj(player_config, ('args', 'ucid')))
channel_url = f'https://www.youtube.com/channel/{channel_id}' if... | @@ -588,48 +749,80 @@ def _extract_metadata(self, video_id, webpage):
video_details.get('title')
or YoutubeBaseInfoExtractor._get_text(microformats, 'title')
or YoutubeBaseInfoExtractor._get_text(initial_data_video, 'title')
+ or traverse_obj(player_config, ('args', 'ti... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.786 | suggestion | 388 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
capture_dates.append(all_captures[0])
if 'captures' in self._configuration_arg('check_all'):
capture_dates.extend(modern_captures + all_captures)
# Fallbacks if any of the above fail
capture_dates.extend([self._OLDEST_CAPTURE_DATE, self._NEWEST_CAPTURE_DATE])
re... | ```suggestion
# HTTP Error 404 is expected if the video is not saved.
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 404:
self.raise_no_formats(
'The requested video is not archived, indexed, or there is an issue with web.arch... | if 'captures' in self._configuration_arg('check_all'):
capture_dates.extend(modern_captures + all_captures)
# Fallbacks if any of the above fail
capture_dates.extend([self._OLDEST_CAPTURE_DATE, self._NEWEST_CAPTURE_DATE])
return orderedSet(filter(None, capture_dates))
d... | @@ -698,18 +891,21 @@ def _real_extract(self, url):
url_date = url_date or url_date_2
urlh = None
- try:
- urlh = self._request_webpage(
- HEADRequest('https://web.archive.org/web/2oe_/http://wayback-fakeurl.archive.org/yt/%s' % video_id),
- video_id, ... | yt_dlp/extractor/archiveorg.py | 26 | Python | 1 | suggestion | 466 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
elif not isinstance(res, list) or len(res) != 0:
self.report_warning('Error while parsing CDX API response' + bug_reports_message())
def _extract_webpage_title(self, webpage):
page_title = self._html_extract_title(webpage, default='')
# YouTube video pages appear to always have ... | ```suggestion
r'(?:yt\.playerConfig|ytplayer\.config|swfConfig)\s*=',
``` | elif not isinstance(res, list) or len(res) != 0:
self.report_warning('Error while parsing CDX API response' + bug_reports_message())
def _extract_webpage_title(self, webpage):
page_title = self._html_extract_title(webpage, default='')
# YouTube video pages appear to always have ... | @@ -574,6 +714,27 @@ def _extract_metadata(self, video_id, webpage):
initial_data = self._search_json(
self._YT_INITIAL_DATA_RE, webpage, 'initial data', video_id, default={})
+ ytcfg = {}
+ for j in re.findall(r'yt\.setConfig\(\s*(?P<json>{\s*(?s:.+?)\s*})\s*\);', webpage): # ~Ju... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.571 | suggestion | 91 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
# YouTube video pages appear to always have either 'YouTube -' as prefix or '- YouTube' as suffix.
return self._html_search_regex(
r'(?:YouTube\s*-\s*(.*)$)|(?:(.*)\s*-\s*YouTube$)',
page_title, 'title', default='')
def _extract_metadata(self, video_id, webpage):
sea... | ```suggestion
swf_args = self._search_json(r'swfArgs\s*=', webpage, 'swf config', video_id, default={})
``` | # YouTube video pages appear to always have either 'YouTube -' as prefix or '- YouTube' as suffix.
return self._html_search_regex(
r'(?:YouTube\s*-\s*(.*)$)|(?:(.*)\s*-\s*YouTube$)',
page_title, 'title', default='')
def _extract_metadata(self, video_id, webpage):
sea... | @@ -574,6 +714,27 @@ def _extract_metadata(self, video_id, webpage):
initial_data = self._search_json(
self._YT_INITIAL_DATA_RE, webpage, 'initial data', video_id, default={})
+ ytcfg = {}
+ for j in re.findall(r'yt\.setConfig\(\s*(?P<json>{\s*(?s:.+?)\s*})\s*\);', webpage): # ~Ju... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.714 | suggestion | 117 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
webpage, 'uploader or channel url', default=None)
owner_profile_url = url_or_none(microformats.get('ownerProfileUrl')) # @a6211d2
# Uploader refers to the /user/ id ONLY
uploader_id = (
id_from_url(owner_profile_url, 'user')
or id_from_url(upch_url, 'user')... | ```suggestion
self._search_regex(
[r'<a\s*id="watch-username".*">\s*<strong[^>]?>([^<]+)</strong>',
r'var\s*watchUsername\s*=\s*\'(.+)\';', # ~May 2009
r'<div\s*\bid=\"watch-channel-stats"[^>]*>\s*<a[^>]*>\s*(.+?)\s*</a', # ~May 2009
... |
owner_profile_url = url_or_none(microformats.get('ownerProfileUrl')) # @a6211d2
# Uploader refers to the /user/ id ONLY
uploader_id = (
id_from_url(owner_profile_url, 'user')
or id_from_url(uploader_or_channel_url, 'user')
or ytcfg.get('VIDEO_USERNAME'))
... | @@ -588,48 +749,79 @@ def _extract_metadata(self, video_id, webpage):
video_details.get('title')
or YoutubeBaseInfoExtractor._get_text(microformats, 'title')
or YoutubeBaseInfoExtractor._get_text(initial_data_video, 'title')
+ or traverse_obj(player_config, ('args', 'ti... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.857 | suggestion | 988 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
def id_from_url(url, type_):
return self._search_regex(
rf'(?:{type_})/([^/#&?]+)', url or '', f'{type_} id', default=None)
# XXX: would the get_elements_by_... functions be better suited here?
# Uploader ID and URL
_CHANNEL_URL_HREF_RE = r'href="[^"]*(?P<ur... | u sure it should be greedy?
```suggestion
[r'<a\s*id="watch-username".*?">\s*<strong[^>]?>([^<]+)</strong>',
``` |
def id_from_url(url, type_):
return self._search_regex(
rf'(?:{type_})/([^/#&?]+)', url or '', f'{type_} id', default=None)
# XXX: would the get_elements_by_... functions be better suited here?
_CHANNEL_URL_HREF_RE = r'href="[^"]*(?P<url>https?://www\.youtube\.com/(... | @@ -588,48 +749,79 @@ def _extract_metadata(self, video_id, webpage):
video_details.get('title')
or YoutubeBaseInfoExtractor._get_text(microformats, 'title')
or YoutubeBaseInfoExtractor._get_text(initial_data_video, 'title')
+ or traverse_obj(player_config, ('args', 'ti... | yt_dlp/extractor/archiveorg.py | 26 | Python | 0.786 | suggestion | 131 | 51 | 51 | false | [extractor/ytarchive] Improve metadata extraction | 4,968 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
with contextlib.suppress(IndexError):
yield obj.group(key)
return
if not isinstance(key, str):
return
yield next((v for k, v in obj.groupdict().items() if casefold(k) == key), None)
else:
if is_user_in... | ```suggestion
payload_data = json.loads(base64.urlsafe_b64decode(f'{payload_b64}==='))
```
should work afair |
# create a JSON Web Signature (jws) with HS256 algorithm
# the resulting format is in JWS Compact Serialization
# implemented following JWT https://www.rfc-editor.org/rfc/rfc7519.html
# implemented following JWS https://www.rfc-editor.org/rfc/rfc7515.html
def jwt_encode_hs256(payload_data, key, headers={}):
heade... | @@ -5424,6 +5424,7 @@ def jwt_encode_hs256(payload_data, key, headers={}):
# can be extended in future to verify the signature and parse header and return the algorithm used if it's not HS256
def jwt_decode_hs256(jwt):
header_b64, payload_b64, signature_b64 = jwt.split('.')
+ payload_b64 += (4 - (len(payload_... | yt_dlp/utils.py | 26 | Python | 0.786 | suggestion | 115 | 51 | 51 | false | [extractors/podbayfm] Add extractor | 4,971 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | schnusch |
class TikTokBaseIE(InfoExtractor):
_APP_VERSIONS = [('26.1.3', '260103'), ('26.1.2', '260102'), ('26.1.1', '260101'), ('25.6.2', '250602')]
_WORKING_APP_VERSION = None
_APP_NAME = 'trill'
_AID = 1180
_API_HOSTNAME = 'api-h2.tiktokv.com'
_UPLOADER_URL_FORMAT = 'https://www.tiktok.com/@%s'
_... | ```suggestion
headers={'User-Agent': 'Mozilla/5.0'}, note='Setting up session', fatal=False)
```
typo? |
class TikTokBaseIE(InfoExtractor):
_APP_VERSIONS = [('26.1.3', '260103'), ('26.1.2', '260102'), ('26.1.1', '260101'), ('25.6.2', '250602')]
_WORKING_APP_VERSION = None
_APP_NAME = 'trill'
_AID = 1180
_API_HOSTNAME = 'api-h2.tiktokv.com'
_UPLOADER_URL_FORMAT = 'https://www.tiktok.com/@%s'
_... | @@ -46,7 +46,8 @@ def _get_sigi_state(self, webpage, display_id):
def _real_initialize(self):
if self._session_initialized:
return
- self._request_webpage(HEADRequest('https://www.tiktok.com'), None, note='Setting up session', fatal=False)
+ self._request_webpage(HEADRequest('ht... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.786 | question | 135 | 51 | 51 | false | [extractor/tiktok] Fix TikTokIE | 4,984 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
'uploader_url': 'https://www.tiktok.com/@MS4wLjABAAAAbhBwQC-R1iKoix6jDFsF-vBdfx2ABoDjaZrM9fX6arU3w71q3cOWgWuTXn1soZ7d',
'track': 'Boka Dance',
'artist': 'md5:29f238c49bc0c176cb3cef1a9cea9fa6',
'timestamp': 1626121503,
'duration': 18,
'thumbnail': r... | This appears to be a bug in the code. Adding a `or None` where this extraction is happening should fix it | 'uploader_url': 'https://www.tiktok.com/@MS4wLjABAAAAbhBwQC-R1iKoix6jDFsF-vBdfx2ABoDjaZrM9fX6arU3w71q3cOWgWuTXn1soZ7d',
'track': 'Boka Dance',
'artist': 'md5:29f238c49bc0c176cb3cef1a9cea9fa6',
'timestamp': 1626121503,
'duration': 18,
'thumbnail': r... | @@ -467,6 +460,7 @@ class TikTokIE(TikTokBaseIE):
'uploader_id': '7036055384943690754',
'uploader_url': 'https://www.tiktok.com/@MS4wLjABAAAATh8Vewkn0LYM7Fo03iec3qKdeCUOcBIouRk1mkiag6h3o_pQu_dUXvZ2EZlGST7_',
'track': 'Promoted Music',
+ 'artist': '', | yt_dlp/extractor/tiktok.py | 26 | Python | 0.714 | bug | 105 | 51 | 51 | false | [extractor/tiktok] Fix TikTokIE | 4,984 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | bashonly |
params = actions[0]
params.update({i: a for i, a in enumerate(actions[1:], start=1)})
data = self._download_json(
(service_url or self._SERVICE_URL) + self._SERVICE_BASE,
video_id, data=json.dumps(params).encode('utf-8'),
headers={
'Content-Ty... | ```suggestion
assert player_type in ('html5', 'kwidget')
if player_type == 'kwidget':
```
just for self-doc | def _kaltura_api_call(self, video_id, actions, service_url=None, *args, **kwargs):
params = actions[0]
params.update({i: a for i, a in enumerate(actions[1:], start=1)})
data = self._download_json(
(service_url or self._SERVICE_URL) + self._SERVICE_BASE,
video_id, dat... | @@ -187,7 +262,14 @@ def _kaltura_api_call(self, video_id, actions, service_url=None, *args, **kwargs
return data
- def _get_video_info(self, video_id, partner_id, service_url=None):
+ def _get_video_info(self, video_id, partner_id, service_url=None, player_type='html5'):
+ if player_type == '... | yt_dlp/extractor/kaltura.py | 26 | Python | 0.857 | suggestion | 127 | 51 | 51 | false | [kaltura] Add support for playlists to Kaltura downloader | 4,986 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jwoglom |
(service_url or self._SERVICE_URL) + self._SERVICE_BASE,
video_id, data=json.dumps(params).encode('utf-8'),
headers={
'Content-Type': 'application/json',
'Accept-Encoding': 'gzip, deflate, br',
}, *args, **kwargs)
for idx, status i... | ```suggestion
widget_id = partner_id if '_' in partner_id else f'_{partner_id}'
``` | data = self._download_json(
(service_url or self._SERVICE_URL) + self._SERVICE_BASE,
video_id, data=json.dumps(params).encode('utf-8'),
headers={
'Content-Type': 'application/json',
'Accept-Encoding': 'gzip, deflate, br',
}, *args, ... | @@ -187,7 +262,14 @@ def _kaltura_api_call(self, video_id, actions, service_url=None, *args, **kwargs
return data
- def _get_video_info(self, video_id, partner_id, service_url=None):
+ def _get_video_info(self, video_id, partner_id, service_url=None, player_type='html5'):
+ if player_type == '... | yt_dlp/extractor/kaltura.py | 26 | Python | 0.571 | suggestion | 93 | 51 | 51 | false | [kaltura] Add support for playlists to Kaltura downloader | 4,986 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jwoglom |
'ks': '{1:result:ks}',
'responseProfile': {
'type': 1,
'fields': 'createdAt,dataUrl,duration,name,plays,thumbnailUrl,userId',
},
},
# flavor_assets
{
'action': 'getbyentryid',
... | same as above.
Also maybe this makes sese as a function? | 'service': 'baseentry',
'ks': '{1:result:ks}',
'responseProfile': {
'type': 1,
'fields': 'createdAt,dataUrl,duration,name,plays,thumbnailUrl,userId',
},
},
# flavor_assets
{
... | @@ -226,7 +311,70 @@ def _get_video_info(self, video_id, partner_id, service_url=None):
},
]
return self._kaltura_api_call(
- video_id, actions, service_url, note='Downloading video info JSON')
+ video_id, actions, service_url, note='Downloading video info JSON (Kalt... | yt_dlp/extractor/kaltura.py | 26 | Python | 0.214 | question | 59 | 51 | 51 | false | [kaltura] Add support for playlists to Kaltura downloader | 4,986 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jwoglom |
'ks': '{1:result:ks}',
},
# captions
{
'action': 'list',
'filter:entryIdEqual': video_id,
'service': 'caption_captionasset',
'ks': '{1:result:ks}',
},
]
# second object (repres... | ```suggestion
player_type = 'kwidget' if 'html5lib/v2' in url else 'html5'
``` | 'ks': '{1:result:ks}',
},
# captions
{
'action': 'list',
'filter:entryIdEqual': video_id,
'service': 'caption_captionasset',
'ks': '{1:result:ks}',
},
]
# second object (repres... | @@ -235,8 +383,11 @@ def _real_extract(self, url):
partner_id, entry_id = mobj.group('partner_id', 'id')
ks = None
captions = None
+ player_type = 'html5'
+ if 'html5lib/v2' in url:
+ player_type = 'kwidget' | yt_dlp/extractor/kaltura.py | 26 | Python | 0.714 | suggestion | 88 | 51 | 51 | false | [kaltura] Add support for playlists to Kaltura downloader | 4,986 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jwoglom |
entry_id, partner_id, player_type=player_type)
except ExtractorError:
# Regular scenario failed but we already have everything
# extracted apart from captions and can process at least
# with this
pass... | why not just return the URLs and let the single-video extractor handle the rest? | except ExtractorError:
# Regular scenario failed but we already have everything
# extracted apart from captions and can process at least
# with this
pass
elif 'uiconf_id' in params and 'flashvars[playlistAPI.kpl0... | @@ -272,16 +426,39 @@ def _real_extract(self, url):
# regular approach since we now know the entry_id
try:
_, info, flavor_assets, captions = self._get_video_info(
- entry_id, partner_id)
+ entry_id, partner_id, player_... | yt_dlp/extractor/kaltura.py | 26 | Python | 0.429 | refactor | 80 | 51 | 51 | false | [kaltura] Add support for playlists to Kaltura downloader | 4,986 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | jwoglom |
def _parse_ism_formats_and_subtitles(self, ism_doc, ism_url, ism_id=None):
"""
Parse formats from ISM manifest.
References:
1. [MS-SSTR]: Smooth Streaming Protocol,
https://msdn.microsoft.com/en-us/library/ff469518.aspx
"""
if ism_doc.get('IsLive') == 'T... | ```suggestion
KNOWN_TAGS = {'255': 'AACL', '65534': 'EC-3'}
fourcc = track.get('FourCC') or KNOWN_TAGS.get(track.get('AudioTag'))
``` |
def _parse_ism_formats_and_subtitles(self, ism_doc, ism_url, ism_id=None):
"""
Parse formats from ISM manifest.
References:
1. [MS-SSTR]: Smooth Streaming Protocol,
https://msdn.microsoft.com/en-us/library/ff469518.aspx
"""
if ism_doc.get('IsLive') == 'T... | @@ -3116,9 +3116,9 @@ def _parse_ism_formats_and_subtitles(self, ism_doc, ism_url, ism_id=None):
stream_name = stream.get('Name')
stream_language = stream.get('Language', 'und')
for track in stream.findall('QualityLevel'):
- fourcc = track.get('FourCC') or ('AACL' i... | yt_dlp/extractor/common.py | 26 | Python | 0.714 | suggestion | 168 | 51 | 51 | false | [downloader/ism] added support for ec-3 codec (fix #296) | 5,004 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | nixxo |
'info_dict': {
'id': '3789738',
'ext': 'mp4',
'season_number': 1,
'series': '"Kaptan Pengu ve Arkadaşları"',
'season': 'Season 1',
'title': 'Kaptan Pengu ve Arkadaşları 1 Bölüm İzle TRT Çocuk',
'release_date': '20201209',
... | Neither of the tests use this code. Can you give an example? | 'ext': 'mp4',
'season_number': 1,
'series': '"Kaptan Pengu ve Arkadaşları"',
'season': 'Season 1',
'title': 'Kaptan Pengu ve Arkadaşları 1 Bölüm İzle TRT Çocuk',
'release_date': '20201209',
'release_timestamp': 1607513774,
}
... | @@ -0,0 +1,47 @@
+from urllib.parse import unquote
+
+from .common import InfoExtractor
+from ..utils import int_or_none, parse_iso8601, traverse_obj
+
+
+class TrtCocukVideoIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.trtcocuk\.net\.tr/video/(?P<id>[\w-]+)'
+ _TESTS = [{
+ 'url': 'https://www.trtcocu... | yt_dlp/extractor/trtcocuk.py | 26 | Python | 0.286 | question | 60 | 38 | 39 | false | [extractor/trtcocuk] Add extractor | 5,009 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | HobbyistDev |
'id': 'CD1002-21',
'ext': 'mp3',
'title': '21 Half-Time Show',
'thumbnail': 'https://pianoadventures.com/wp-content/plugins/media-library-assistant/images/crystal/audio.png',
'album': 'Piano Adventures Level 1 Lesson Book (2nd Edition)',
... | ```suggestion
for track in traverse_obj(playlist_json, ('tracks', ...), expected_type=dict):
```
I would have written the loop as
```py
entries = [{
...
} for track in traverse_obj(playlist_json, ('tracks', ...), expected_type=dict)]
``` | 'id': 'CD1002-21',
'ext': 'mp3',
'title': '21 Half-Time Show',
'thumbnail': 'https://pianoadventures.com/wp-content/plugins/media-library-assistant/images/crystal/audio.png',
'album': 'Piano Adventures Level 1 Lesson Book (2nd Edition)',
... | @@ -0,0 +1,74 @@
+from .common import InfoExtractor
+from ..utils import (
+ get_elements_by_class,
+ int_or_none,
+ parse_duration,
+ traverse_obj,
+)
+
+
+# https://codex.wordpress.org/Playlist_Shortcode
+class WordpressPlaylistEmbedIE(InfoExtractor):
+ _VALID_URL = False
+ IE_NAME = 'wordpress:play... | yt_dlp/extractor/wordpress.py | 26 | Python | 0.929 | suggestion | 263 | 42 | 37 | false | [extractor/wordpress] Add generic playlist embed extractor | 5,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'params': {'skip_download': True}
}]
def _extract_from_webpage(self, url, webpage):
# class should always be "wp-playlist-script"
# See: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/media.php#L2930
for i, j in enumerate(get_elements_by_class('wp-playlist-script'... | Due to the recent improvements in `traverse_obj`, this is now possible.
```py
...,
**traverse_obj(track, {
'url': 'src',
'thumbnail': ('thumb', 'src'),
'album': ('meta', 'album'),
... | from .common import InfoExtractor
from ..utils import (
get_elements_by_class,
int_or_none,
parse_duration,
traverse_obj,
)
# https://codex.wordpress.org/Playlist_Shortcode
class WordpressPlaylistEmbedIE(InfoExtractor):
_VALID_URL = False
IE_NAME = 'wordpress:playlist'
_WEBPAGE_TESTS = [{
... | @@ -0,0 +1,74 @@
+from .common import InfoExtractor
+from ..utils import (
+ get_elements_by_class,
+ int_or_none,
+ parse_duration,
+ traverse_obj,
+)
+
+
+# https://codex.wordpress.org/Playlist_Shortcode
+class WordpressPlaylistEmbedIE(InfoExtractor):
+ _VALID_URL = False
+ IE_NAME = 'wordpress:play... | yt_dlp/extractor/wordpress.py | 26 | Python | 0.857 | suggestion | 624 | 30 | 70 | false | [extractor/wordpress] Add generic playlist embed extractor | 5,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
type_test = lambda val: try_call(expected_type, args=(val,))
else:
type_test = IDENTITY
is_sequence = lambda x: isinstance(x, collections.abc.Sequence) and not isinstance(x, str)
def _traverse_obj(start_obj, path):
has_branched, results = _traverse_path(start_obj, path)
if ... | ```suggestion
if is_user_input and key == ':':
``` |
def apply_key(key, obj):
if obj is None:
return
elif key is None:
yield obj
elif isinstance(key, (list, tuple)):
for branch in key:
_, result = apply_path(obj, branch)
yield from result
elif key is ...:
... | @@ -5284,107 +5285,174 @@ def load_plugins(name, suffix, namespace):
def traverse_obj(
- obj, *path_list, default=None, expected_type=None, get_all=True,
+ obj, *paths, default=None, expected_type=None, get_all=True,
casesense=True, is_user_input=False, traverse_string=False):
- ''' Trave... | yt_dlp/utils.py | 26 | Python | 0.643 | suggestion | 64 | 51 | 51 | false | [core] `traverse_obj`: Various fixes | 5,024 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
has_branched, results = _traverse_path(start_obj, path)
if results:
if get_all and has_branched:
return list(map(type_test, results))
else:
return type_test(results[0])
return None
def _traverse_path(start_obj, path):
path = tu... | I think this loop should be a function
```py
def get_key(objs, key):
for obj in objs:
...
yield result
objs = [v for v in get_key(objs, key) if v is not None]
``` |
elif isinstance(key, (list, tuple)):
for branch in key:
_, result = apply_path(obj, branch)
yield from result
elif key is ...:
if isinstance(obj, collections.abc.Mapping):
yield from obj.values()
elif is_sequence(obj):... | @@ -5284,107 +5285,174 @@ def load_plugins(name, suffix, namespace):
def traverse_obj(
- obj, *path_list, default=None, expected_type=None, get_all=True,
+ obj, *paths, default=None, expected_type=None, get_all=True,
casesense=True, is_user_input=False, traverse_string=False):
- ''' Trave... | yt_dlp/utils.py | 26 | Python | 0.786 | suggestion | 191 | 51 | 51 | false | [core] `traverse_obj`: Various fixes | 5,024 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
elif key is ...:
has_branched = True
if isinstance(obj, collections.abc.Mapping):
result_objs.extend(obj.values())
elif is_sequence(obj):
result_objs.extend(obj)
elif traverse... | ```suggestion
obj = [(k, _traverse_obj(obj, v)) for k, v in key.items()]
result_objs.append({k: v if v is not None else default for k, v in obj
if v is not None or default is not None})
```
or maybe
```suggestion
... | else slice(*map(int_or_none, key.split(':'))))
if not isinstance(key, (int, slice)):
return
if not is_sequence(obj):
if not traverse_string:
return
obj = str(obj)
with contextlib.suppress(In... | @@ -5284,107 +5285,174 @@ def load_plugins(name, suffix, namespace):
def traverse_obj(
- obj, *path_list, default=None, expected_type=None, get_all=True,
+ obj, *paths, default=None, expected_type=None, get_all=True,
casesense=True, is_user_input=False, traverse_string=False):
- ''' Trave... | yt_dlp/utils.py | 26 | Python | 0.786 | suggestion | 498 | 51 | 51 | false | [core] `traverse_obj`: Various fixes | 5,024 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
result_objs.extend(obj)
elif traverse_string:
result_objs.extend(str(obj))
elif callable(key):
has_branched = True
if is_sequence(obj):
iter_obj = enumerate(obj)
... | if we do this above:
```py
_casefold = IDENTITY if casesense else (lambda k: k.casefold() if isinstance(k, str) else k)
```
this simplifies to
```suggestion
result = next((v for k, v in obj.items() if _casefold(k) == key), None)
``` | if not traverse_string:
return
obj = str(obj)
with contextlib.suppress(IndexError):
yield obj[key]
def apply_path(start_obj, path):
objs = (start_obj,)
has_branched = False
for key in variadic(path):
... | @@ -5284,107 +5285,174 @@ def load_plugins(name, suffix, namespace):
def traverse_obj(
- obj, *path_list, default=None, expected_type=None, get_all=True,
+ obj, *paths, default=None, expected_type=None, get_all=True,
casesense=True, is_user_input=False, traverse_string=False):
- ''' Trave... | yt_dlp/utils.py | 26 | Python | 0.786 | suggestion | 261 | 51 | 51 | false | [core] `traverse_obj`: Various fixes | 5,024 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
result_objs.extend(str(obj))
elif callable(key):
has_branched = True
if is_sequence(obj):
iter_obj = enumerate(obj)
elif isinstance(obj, collections.abc.Mapping):
iter_obj... | since we filter out `None` below, do we need to check it here? If not, cant we just directly do
```py
result_objs.append(next(...))
``` | obj = str(obj)
with contextlib.suppress(IndexError):
yield obj[key]
def apply_path(start_obj, path):
objs = (start_obj,)
has_branched = False
for key in variadic(path):
if is_user_input and key == ':':
key = ...
... | @@ -5284,107 +5285,174 @@ def load_plugins(name, suffix, namespace):
def traverse_obj(
- obj, *path_list, default=None, expected_type=None, get_all=True,
+ obj, *paths, default=None, expected_type=None, get_all=True,
casesense=True, is_user_input=False, traverse_string=False):
- ''' Trave... | yt_dlp/utils.py | 26 | Python | 0.714 | suggestion | 158 | 51 | 51 | false | [core] `traverse_obj`: Various fixes | 5,024 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
return {
'_type': 'url_transparent',
'url': smuggle_url(kaltura_url, {'source_url': url}),
'ie_key': KalturaIE.ie_key(),
'title': title,
'description': description,
}
kaltura_url = KalturaIE._extract_url(web... | ```suggestion
self._search_regex(r'/videout/feed\.json\?([^\']+)', webpage, 'feed params', default=None) or '')
``` | 'url': smuggle_url(kaltura_url, {'source_url': url}),
'ie_key': KalturaIE.ie_key(),
'title': title,
'description': description,
}
kaltura_url = KalturaIE._extract_url(webpage)
if kaltura_url:
return _make_kaltura_re... | @@ -127,20 +166,22 @@ def _make_kaltura_result(kaltura_url):
yt_urls, video_id, title, ie=YoutubeIE.ie_key())
title = extract_title()
+ api_params = urllib.parse.parse_qs(
+ self._search_regex(r'\/videout\/feed\.json\?([^\']+)', webpage, 'feed params', default=None) or '') | yt_dlp/extractor/heise.py | 26 | Python | 0.714 | suggestion | 129 | 51 | 51 | false | [extractor/heise] Fix extractor | 5,029 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
from .common import InfoExtractor
from .kaltura import KalturaIE
from .youtube import YoutubeIE
from ..utils import (
NO_DEFAULT,
determine_ext,
int_or_none,
parse_iso8601,
smuggle_url,
xpath_text,
)
class HeiseIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?heise\.de/(?:[^/]+/)+[^/]+... | isnt this wrong?
```suggestion
``` | from .common import InfoExtractor
from .kaltura import KalturaIE
from .youtube import YoutubeIE
from ..utils import (
NO_DEFAULT,
determine_ext,
int_or_none,
parse_iso8601,
smuggle_url,
xpath_text,
)
class HeiseIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?heise\.de/(?:[^/]+/)+[^/]+... | @@ -23,6 +25,10 @@ class HeiseIE(InfoExtractor):
'timestamp': 1512734959,
'upload_date': '20171208',
'description': 'md5:c934cbfb326c669c2bcabcbe3d3fcd20',
+ 'uploader_id': '', | yt_dlp/extractor/heise.py | 26 | Python | 0.429 | bug | 36 | 51 | 51 | false | [extractor/heise] Fix extractor | 5,029 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
if '' in available_formats and 'all' not in requested_hardsubs:
full_format_langs = set(requested_hardsubs)
self.to_screen('To get all formats for the hardsub variants use "--extractor-args crunchyrollbeta:hardsub=all"')
else:
full_format_langs = set(map(str.lower, av... | Maybe this should give a warning? | if '' in available_formats and 'all' not in requested_hardsubs:
full_format_langs = set(requested_hardsubs)
self.to_screen(
'To get all formats of a hardsub language, use '
'"--extractor-args crunchyrollbeta:hardsub=<language_code or all>". '
... | @@ -807,30 +828,44 @@ def _real_extract(self, url):
hardsub_preference = qualities(requested_hardsubs[::-1])
requested_formats = self._configuration_arg('format') or ['adaptive_hls']
- formats = []
+ available_formats = {}
for stream_type, streams in get_streams('streams'):
... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.143 | question | 33 | 51 | 51 | false | [extractor/crunchyroll:beta] Provide hardsub formats where possible | 5,041 | yt-dlp/yt-dlp | 132,642 | Python | tejing1 | Grub4K |
if '' in available_formats and 'all' not in requested_hardsubs:
full_format_langs = set(requested_hardsubs)
self.to_screen('To get all formats for the hardsub variants use "--extractor-args crunchyrollbeta:hardsub=all"')
else:
full_format_langs = set(map(str.lower, av... | Not clear what this `if` is doing. I think it's *always* true, except possibly when the extractor arg is explicitly set to an empty string.
Also, shouldn't we set quality lower for the meta formats than others? Or does it not actually end up mattering? | if '' in available_formats and 'all' not in requested_hardsubs:
full_format_langs = set(requested_hardsubs)
self.to_screen(
'To get all formats of a hardsub language, use '
'"--extractor-args crunchyrollbeta:hardsub=<language_code or all>". '
... | @@ -807,30 +828,44 @@ def _real_extract(self, url):
hardsub_preference = qualities(requested_hardsubs[::-1])
requested_formats = self._configuration_arg('format') or ['adaptive_hls']
- formats = []
+ available_formats = {}
for stream_type, streams in get_streams('streams'):
... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.643 | refactor | 255 | 51 | 51 | false | [extractor/crunchyroll:beta] Provide hardsub formats where possible | 5,041 | yt-dlp/yt-dlp | 132,642 | Python | tejing1 | Grub4K |
if episode_response.get('is_premium_only') and not episode_response.get('playback'):
raise ExtractorError('This video is for premium members only.', expected=True)
stream_response = self._download_json(
f'{api_domain}{episode_response["__links__"]["streams"]["href"]}', display_i... | I don't want to make this message too long, but maybe some indication can be made that specific language codes are also valid values for the argument? Or just where to look up the full documentation? | if episode_response.get('is_premium_only') and not episode_response.get('playback'):
raise ExtractorError('This video is for premium members only.', expected=True)
stream_response = self._download_json(
f'{api_domain}{episode_response["__links__"]["streams"]["href"]}', display_i... | @@ -807,30 +828,44 @@ def _real_extract(self, url):
hardsub_preference = qualities(requested_hardsubs[::-1])
requested_formats = self._configuration_arg('format') or ['adaptive_hls']
- formats = []
+ available_formats = {}
for stream_type, streams in get_streams('streams'):
... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.357 | refactor | 199 | 51 | 51 | false | [extractor/crunchyroll:beta] Provide hardsub formats where possible | 5,041 | yt-dlp/yt-dlp | 132,642 | Python | tejing1 | Grub4K |
stream_response = self._download_json(
f'{api_domain}{episode_response["__links__"]["streams"]["href"]}', display_id,
note='Retrieving stream info', query=params)
get_streams = lambda name: (traverse_obj(stream_response, name) or {}).items()
requested_hardsubs = [('' if... | ```suggestion
if not self._configuration_arg('hardsub'):
self.to_screen(
'To get all formats of a hardsub language, use '
'"--extractor-args crunchyrollbeta:hardsub=<language_code or all>". '
'See https://github.com/yt-dlp/yt-d... |
stream_response = self._download_json(
f'{api_domain}{episode_response["__links__"]["streams"]["href"]}', display_id,
note='Retrieving stream info', query=params)
get_streams = lambda name: (traverse_obj(stream_response, name) or {}).items()
requested_hardsubs = [('' if... | @@ -807,30 +828,46 @@ def _real_extract(self, url):
hardsub_preference = qualities(requested_hardsubs[::-1])
requested_formats = self._configuration_arg('format') or ['adaptive_hls']
- formats = []
+ available_formats = {}
for stream_type, streams in get_streams('streams'):
... | yt_dlp/extractor/crunchyroll.py | 26 | Python | 0.857 | refactor | 413 | 51 | 51 | false | [extractor/crunchyroll:beta] Provide hardsub formats where possible | 5,041 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
'http://bangumi.bilibili.com/jsonp/seasoninfo/%s.ver' % bangumi_id,
bangumi_id, transform_source=strip_jsonp)['result']
entries = [{
'_type': 'url_transparent',
'url': smuggle_url(episode['webplay_url'], {'no_bangumi_tip': 1}),
'ie_key': BiliBiliIE.ie... | ```suggestion
lambda idx: get_entries(fetch_page(idx) if idx else first_page),
``` | 'http://bangumi.bilibili.com/jsonp/seasoninfo/%s.ver' % bangumi_id,
bangumi_id, transform_source=strip_jsonp)['result']
entries = [{
'_type': 'url_transparent',
'url': smuggle_url(episode['webplay_url'], {'no_bangumi_tip': 1}),
'ie_key': BiliBiliIE.ie... | @@ -508,11 +509,11 @@ def _real_extract(self, url):
class BilibiliSpaceBaseIE(InfoExtractor):
def _extract_playlist(self, fetch_page, get_metadata, get_entries):
- first_page = fetch_page(1)
+ first_page = fetch_page(0)
metadata = get_metadata(first_page)
paged_list = InAdvance... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.571 | suggestion | 96 | 51 | 51 | false | [Bilibili] fix BilibiliSpaceBaseIE with playlist-items | 5,043 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
_VALID_URL = r'https?://space\.bilibili\.com/(?P<id>\d+)(?P<video>/video)?/?(?:[?#]|$)'
_TESTS = [{
'url': 'https://space.bilibili.com/3985676/video',
'info_dict': {
'id': '3985676',
},
'playlist_mincount': 178,
}]
def _real_extract(self, url):
playli... | Dont print whole response. Put the relevent parts into the error message | _VALID_URL = r'https?://space\.bilibili\.com/(?P<id>\d+)(?P<video>/video)?/?(?:[?#]|$)'
_TESTS = [{
'url': 'https://space.bilibili.com/3985676/video',
'info_dict': {
'id': '3985676',
},
'playlist_mincount': 178,
}]
def _real_extract(self, url):
playli... | @@ -535,10 +536,19 @@ def _real_extract(self, url):
'To download audios, add a "/audio" to the URL')
def fetch_page(page_idx):
- return self._download_json(
- 'https://api.bilibili.com/x/space/arc/search', playlist_id,
- note=f'Downloading ... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.357 | suggestion | 72 | 51 | 51 | false | [Bilibili] fix BilibiliSpaceBaseIE with playlist-items | 5,043 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
'info_dict': {
'id': '3985676',
},
'playlist_mincount': 178,
}]
def _real_extract(self, url):
playlist_id, is_video_url = self._match_valid_url(url).group('id', 'video')
if not is_video_url:
self.to_screen('A channel URL was given. Only the channe... | ```suggestion
return response['data']
``` | 'info_dict': {
'id': '3985676',
},
'playlist_mincount': 178,
}]
def _real_extract(self, url):
playlist_id, is_video_url = self._match_valid_url(url).group('id', 'video')
if not is_video_url:
self.to_screen('A channel URL was given. Only the channe... | @@ -535,10 +536,19 @@ def _real_extract(self, url):
'To download audios, add a "/audio" to the URL')
def fetch_page(page_idx):
- return self._download_json(
- 'https://api.bilibili.com/x/space/arc/search', playlist_id,
- note=f'Downloading ... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.571 | suggestion | 55 | 51 | 51 | false | [Bilibili] fix BilibiliSpaceBaseIE with playlist-items | 5,043 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
_VALID_URL = r'https?://space\.bilibili\.com/(?P<id>\d+)(?P<video>/video)?/?(?:[?#]|$)'
_TESTS = [{
'url': 'https://space.bilibili.com/3985676/video',
'info_dict': {
'id': '3985676',
},
'playlist_mincount': 178,
}]
def _real_extract(self, url):
playli... | ```suggestion
raise ExtractorError(
'Request is blocked by server (412), please add cookies, wait and try later.', expected=True)
raise
if response['code'] == -401:
raise ExtractorError(
'Request is blocked... | _VALID_URL = r'https?://space\.bilibili\.com/(?P<id>\d+)(?P<video>/video)?/?(?:[?#]|$)'
_TESTS = [{
'url': 'https://space.bilibili.com/3985676/video',
'info_dict': {
'id': '3985676',
},
'playlist_mincount': 178,
}]
def _real_extract(self, url):
playli... | @@ -535,10 +536,17 @@ def _real_extract(self, url):
'To download audios, add a "/audio" to the URL')
def fetch_page(page_idx):
- return self._download_json(
- 'https://api.bilibili.com/x/space/arc/search', playlist_id,
- note=f'Downloading ... | yt_dlp/extractor/bilibili.py | 26 | Python | 1 | refactor | 399 | 51 | 51 | false | [Bilibili] fix BilibiliSpaceBaseIE with playlist-items | 5,043 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | lockmatrix |
'NL', 'NO', 'PF', 'PL', 'PM', 'PT', 'RE', 'RO',
'SE', 'SI', 'SK', 'SM', 'VA', 'WF', 'YT',
),
}
def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
lang = mobj.group('lang') or mobj.group('lang_2')
langauge_c... | The var name isnt clear imo. potential duplicate what? `potential_duplicate_formats` works. Or maybe `secondary_formats`? | 'NL', 'NO', 'PF', 'PL', 'PM', 'PT', 'RE', 'RO',
'SE', 'SI', 'SK', 'SM', 'VA', 'WF', 'YT',
),
}
def _real_extract(self, url):
mobj = self._match_valid_url(url)
video_id = mobj.group('id')
lang = mobj.group('lang') or mobj.group('lang_2')
langauge_c... | @@ -135,6 +135,7 @@ def _real_extract(self, url):
'Video is not available in this language edition of Arte or broadcast rights expired', expected=True)
formats, subtitles = [], {}
+ potential_duplicates = [] | yt_dlp/extractor/arte.py | 26 | Python | 0.5 | refactor | 121 | 51 | 51 | false | [extractor/artetv] Remove duplicate stream urls | 5,047 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
if not traverse_obj(config, ('data', 'attributes', 'rights')):
# Eg: https://www.arte.tv/de/videos/097407-215-A/28-minuten
# Eg: https://www.arte.tv/es/videos/104351-002-A/serviteur-du-peuple-1-23
raise ExtractorError(
'Video is not available in this language ... | ```suggestion
short_label = traverse_obj(stream_version, 'shortLabel', expected_type=str, default='?')
``` | if not traverse_obj(config, ('data', 'attributes', 'rights')):
# Eg: https://www.arte.tv/de/videos/097407-215-A/28-minuten
# Eg: https://www.arte.tv/es/videos/104351-002-A/serviteur-du-peuple-1-23
raise ExtractorError(
'Video is not available in this language ... | @@ -152,22 +153,26 @@ def _real_extract(self, url):
not m.group('sdh_sub'), # and we prefer not the hard-of-hearing subtitles if there are subtitles
)))
+ short_label = traverse_obj(stream_version, "shortLabel", expected_type=str, default='?') | yt_dlp/extractor/arte.py | 26 | Python | 0.857 | suggestion | 120 | 51 | 51 | false | [extractor/artetv] Remove duplicate stream urls | 5,047 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Grub4K |
def _entries(self, playlist_type, playlist_id):
playlist_url = 'https://www.bitchute.com/%s/%s/' % (playlist_type, playlist_id)
offset = 0
for page_num in itertools.count(1):
data = self._download_json(
'%sextend/' % playlist_url, playlist_id,
'Dow... | how is this better than the previous code? This is fine too, just wondering what your motive for changing it is | {
'md5': '7e427d7ed7af5a75b5855705ec750e2b',
'info_dict': {
'id': 'UGlrF9o9b-Q',
'ext': 'mp4',
'filesize': None,
'title': 'This is the first video on #BitChute !',
'description... | @@ -100,51 +92,82 @@ def _real_extract(self, url):
class BitChuteChannelIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?bitchute\.com/channel/(?P<id>[^/?#&]+)'
- _TEST = {
- 'url': 'https://www.bitchute.com/channel/victoriaxrave/',
- 'playlist_mincount': 185,
+ _VALID_URL = r'https?:/... | yt_dlp/extractor/bitchute.py | 26 | Python | 0.429 | question | 111 | 50 | 51 | false | [bitchute] extractor overhaul | 5,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
offset = 0
for page_num in itertools.count(1):
data = self._download_json(
'%sextend/' % playlist_url, playlist_id,
'Downloading %s page %d' % (playlist_type, page_num),
data=urlencode_postdata({
'csrfmiddlewaretoken': self.... | ```suggestion
offset += 1
yield self.url_result(
``` | 'info_dict': {
'id': 'UGlrF9o9b-Q',
'ext': 'mp4',
'filesize': None,
'title': 'This is the first video on #BitChute !',
'description': 'md5:a0337e7b1fe39e32336974af8173a034',
'thumbnail... | @@ -100,51 +92,82 @@ def _real_extract(self, url):
class BitChuteChannelIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?bitchute\.com/channel/(?P<id>[^/?#&]+)'
- _TEST = {
- 'url': 'https://www.bitchute.com/channel/victoriaxrave/',
- 'playlist_mincount': 185,
+ _VALID_URL = r'https?:/... | yt_dlp/extractor/bitchute.py | 26 | Python | 0.571 | suggestion | 87 | 48 | 51 | false | [bitchute] extractor overhaul | 5,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
formats = [
{'url': format_url}
for format_url in orderedSet(format_urls)]
if not formats:
entries = self._parse_html5_media_entries(
url, webpage, video_id)
if not entries:
error = self._html_search_regex(r'<h1 class="pag... | ```suggestion
r'at \d+:\d+ UTC on (.+?)\.', publish_date, 'upload date', fatal=False))
``` | 'url': 'https://www.bitchute.com/torrent/Zee5BE49045h/szoMrox2JEI.webtorrent',
'only_matching': True,
}]
_HEADERS = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.57 Safari/537.36',
'Referer': 'https://www... | @@ -69,24 +69,16 @@ def _real_extract(self, url):
formats = entries[0]['formats']
self._check_formats(formats, video_id)
- if not formats:
- raise self.raise_no_formats('Video is unavailable', expected=True, video_id=video_id)
self._sort_formats(formats)
- des... | yt_dlp/extractor/bitchute.py | 26 | Python | 0.714 | suggestion | 104 | 51 | 51 | false | [bitchute] extractor overhaul | 5,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
'info_dict': {
'id': 'UGlrF9o9b-Q',
'ext': 'mp4',
'title': 'This is the first video on #BitChute !',
'description': 'md5:a0337e7b1fe39e32336974af8173a034',
'thumbnail': r're:^https?://.*\.jpg$',
'uploader': 'BitChute',
'upload_d... | This is not just a refactor, but change where title is extracted from. Is that intentional? | _TESTS = [{
'url': 'https://www.bitchute.com/video/UGlrF9o9b-Q/',
'md5': '7e427d7ed7af5a75b5855705ec750e2b',
'info_dict': {
'id': 'UGlrF9o9b-Q',
'ext': 'mp4',
'title': 'This is the first video on #BitChute !',
'description': 'md5:a0337e7b1fe39e... | @@ -42,12 +47,7 @@ def _real_extract(self, url):
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.57 Safari/537.36',
})
- title = self._html_search_regex(
- (r'<[^>]+\bid=["\']video-title[^>]+>([^<]+)... | yt_dlp/extractor/bitchute.py | 26 | Python | 0.286 | refactor | 91 | 51 | 51 | false | [bitchute] extractor overhaul | 5,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
import itertools
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
GeoRestrictedError,
clean_html,
get_element_by_class,
get_elements_html_by_class,
orderedSet,
parse_count,
parse_duration,
unified_strdate,
urlencode_postdata,
)
class BitChuteIE... | video id should not change if it can be helped. If you must change it, add relevent `_old_archive_ids` | import functools
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
HEADRequest,
OnDemandPagedList,
clean_html,
get_element_by_class,
get_elements_html_by_class,
int_or_none,
orderedSet,
parse_count,
parse_duration,
traverse_obj,
unified_st... | @@ -18,7 +23,7 @@ class BitChuteIE(InfoExtractor):
'url': 'https://www.bitchute.com/video/UGlrF9o9b-Q/',
'md5': '7e427d7ed7af5a75b5855705ec750e2b',
'info_dict': {
- 'id': 'szoMrox2JEI',
+ 'id': 'UGlrF9o9b-Q', | yt_dlp/extractor/bitchute.py | 26 | Python | 0.571 | suggestion | 102 | 51 | 51 | false | [bitchute] extractor overhaul | 5,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
formats = [
{'url': format_url}
for format_url in orderedSet(format_urls)]
if not formats:
entries = self._parse_html5_media_entries(
url, webpage, video_id)
if not entries:
error = self._html_search_regex(r'<h1 class="pag... | These are now simple enough to be inlined in the return | 'url': 'https://www.bitchute.com/torrent/Zee5BE49045h/szoMrox2JEI.webtorrent',
'only_matching': True,
}]
_HEADERS = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.57 Safari/537.36',
'Referer': 'https://www... | @@ -69,24 +69,16 @@ def _real_extract(self, url):
formats = entries[0]['formats']
self._check_formats(formats, video_id)
- if not formats:
- raise self.raise_no_formats('Video is unavailable', expected=True, video_id=video_id)
self._sort_formats(formats)
- des... | yt_dlp/extractor/bitchute.py | 26 | Python | 0.214 | suggestion | 55 | 51 | 51 | false | [bitchute] extractor overhaul | 5,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Referer': playlist_url,
'X-Requested-With': 'XMLHttpRequest',
'Cookie': 'csrftoken=%s' % self._TOKEN,
})
if data.get('success') is not True:
... | coding convention
```suggestion
description=clean_html(get_element_by_class(class_name['description'], video_html)),
duration=parse_duration(get_element_by_class('video-duration', video_html)),
view_count=parse_count(clean_html(get_element_by_class('video-... | 'view_count': int,
},
}
],
'params': {
'skip_download': True,
'playlist_items': '-1',
},
}, {
'url': 'https://www.bitchute.com/playlist/wV9Imujxasw9/',
'playlist_mincount': 20,
'info_dict': {
... | @@ -100,51 +92,82 @@ def _real_extract(self, url):
class BitChuteChannelIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?bitchute\.com/channel/(?P<id>[^/?#&]+)'
- _TEST = {
- 'url': 'https://www.bitchute.com/channel/victoriaxrave/',
- 'playlist_mincount': 185,
+ _VALID_URL = r'https?:/... | yt_dlp/extractor/bitchute.py | 26 | Python | 0.786 | suggestion | 347 | 38 | 51 | false | [bitchute] extractor overhaul | 5,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
'id': 'bitchute',
'title': 'BitChute',
'description': 'md5:5329fb3866125afa9446835594a9b138',
},
'playlist': [
{
'md5': '7e427d7ed7af5a75b5855705ec750e2b',
'info_dict': {
'id': 'UGlrF9o9b-Q',
... | Why is the test defined like this? | 'id': 'bitchute',
'title': 'BitChute',
'description': 'md5:5329fb3866125afa9446835594a9b138',
},
'playlist': [
{
'md5': '7e427d7ed7af5a75b5855705ec750e2b',
'info_dict': {
'id': 'UGlrF9o9b-Q',
... | @@ -109,51 +113,106 @@ def _real_extract(self, url):
class BitChuteChannelIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?bitchute\.com/channel/(?P<id>[^/?#&]+)'
- _TEST = {
- 'url': 'https://www.bitchute.com/channel/victoriaxrave/',
- 'playlist_mincount': 185,
+ _VALID_URL = r'https?... | yt_dlp/extractor/bitchute.py | 26 | Python | 0.071 | question | 34 | 51 | 51 | false | [bitchute] extractor overhaul | 5,066 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | flashdagger |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.