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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
for kind in ('episode', 'clip'):
current_key = page_data.get(kind, {}).get(
'current%sKey' % kind.capitalize())
if not current_key:
continue
cache = page_data.get(kind, {}).get('%sCache' % kind, {})
if not cache:
co... | ```suggestion
brightcove_id = try_get(
common_data,
lambda x: x['episode']['video']['brightcoveId'] or f'ref:{x["episode"]["video"]["referenceId"]}',
compat_str)
``` | 'title': 'Episode 3',
'ext': 'mp4',
'season_number': 3,
'episode_number': 3,
'description': 'In the first elimination of the competition, teams will have 10 hours to build a world inside a snow globe.',
'uploader_id': '4460760524001',
'... | @@ -59,26 +55,36 @@ def _real_extract(self, url):
cache = page_data.get(kind, {}).get('%sCache' % kind, {})
if not cache:
continue
- common_data = (cache.get(current_key) or list(cache.values())[0])[kind]
+ common_data = {
+ 'episode': (cac... | yt_dlp/extractor/ninenow.py | 26 | Python | 1 | suggestion | 217 | 51 | 51 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | dalanmiller |
r'window\.__data\s*=\s*({.*?});', webpage,
'page data', default='{}'), display_id, fatal=False)
if not page_data:
page_data = self._parse_json(self._parse_json(self._search_regex(
r'window\.__data\s*=\s*JSON\.parse\s*\(\s*(".+?")\s*\)\s*;',
web... | ```suggestion
if not self.get_param('allow_unplayable_formats') and try_get(common_data, lambda x: x['episode']['video']['drm']):
self.report_drm(display_id)
``` | 'only_matching': True,
}, {
# episode of series
'url': 'https://www.9now.com.au/lego-masters/season-3/episode-3',
'info_dict': {
'id': '6249614030001',
'title': 'Episode 3',
'ext': 'mp4',
'season_number': 3,
'episode_number'... | @@ -59,26 +55,36 @@ def _real_extract(self, url):
cache = page_data.get(kind, {}).get('%sCache' % kind, {})
if not cache:
continue
- common_data = (cache.get(current_key) or list(cache.values())[0])[kind]
+ common_data = {
+ 'episode': (cac... | yt_dlp/extractor/ninenow.py | 26 | Python | 1 | suggestion | 184 | 51 | 51 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | dalanmiller |
continue
cache = page_data.get(kind, {}).get('%sCache' % kind, {})
if not cache:
continue
common_data = {
'episode': (cache.get(current_key) or list(cache.values())[0])[kind],
'season': (cache.get(current_key) or list(ca... | ```suggestion
timestamp = unified_timestamp(try_get(common_data, lambda x: x['episode']['airDate'], compat_str))
release_date = unified_strdate(try_get(common_data, lambda x: x['episode']['availability'], compat_str))
```
pretty sure this is redundant | 'uploader_id': '4460760524001',
'timestamp': 1619002200,
'upload_date': '20210421',
},
'expected_warnings': ['Ignoring subtitle tracks'],
'params':{
'skip_download': True,
}
}]
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.ne... | @@ -59,26 +55,35 @@ def _real_extract(self, url):
cache = page_data.get(kind, {}).get('%sCache' % kind, {})
if not cache:
continue
- common_data = (cache.get(current_key) or list(cache.values())[0])[kind]
+ common_data = {
+ 'episode': (cac... | yt_dlp/extractor/ninenow.py | 26 | Python | 1 | suggestion | 271 | 51 | 51 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | dalanmiller |
_GEO_COUNTRIES = ['AU']
_TESTS = [{
# episode of series
'url': 'https://www.9now.com.au/lego-masters/season-3/episode-3',
'md5': '62feeb8d534697c2c1bee11b27bf020d',
'info_dict': {
'id': '6249614030001',
'title': 'Episode 3',
'ext': 'mp4',
... | maybe add a new test for a clip , e.g. https://www.9now.com.au/60-minutes/2021/clip-ckq52ahbr001k0hqhtj9krt98/04938211-b3d9-4bb1-b64c-8e539c1d6c9b | _VALID_URL = r'https?://(?:www\.)?9now\.com\.au/(?:[^/]+/){2}(?P<id>[^/?#]+)'
_GEO_COUNTRIES = ['AU']
_TESTS = [{
# clip
'url': 'https://www.9now.com.au/afl-footy-show/2016/clip-ciql02091000g0hp5oktrnytc',
'md5': '17cf47d63ec9323e562c9957a968b565',
'info_dict': {
... | @@ -16,27 +19,20 @@ class NineNowIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?9now\.com\.au/(?:[^/]+/){2}(?P<id>[^/?#]+)'
_GEO_COUNTRIES = ['AU']
_TESTS = [{
- # clip
- 'url': 'https://www.9now.com.au/afl-footy-show/2016/clip-ciql02091000g0hp5oktrnytc',
- 'md5': '17cf47d63ec9... | yt_dlp/extractor/ninenow.py | 26 | Python | 0.286 | suggestion | 146 | 51 | 51 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | dalanmiller |
_TESTS = [{
# episode of series
'url': 'https://www.9now.com.au/lego-masters/season-3/episode-3',
'md5': '62feeb8d534697c2c1bee11b27bf020d',
'info_dict': {
'id': '6249614030001',
'title': 'Episode 3',
'ext': 'mp4',
'season_number': 3,
... | I also notice this test currently fails due to the 'Ignoring subtitle tracks found in the HLS manifest' warning.
Though this is related to the Brightcove extractor and subtitles appear to be correctly extracted through other means.
@pukkandan is there anything better to do in this situation other than copy the ent... | _GEO_COUNTRIES = ['AU']
_TESTS = [{
# clip
'url': 'https://www.9now.com.au/afl-footy-show/2016/clip-ciql02091000g0hp5oktrnytc',
'md5': '17cf47d63ec9323e562c9957a968b565',
'info_dict': {
'id': '16801',
'ext': 'mp4',
'title': 'St. Kilda\'s Joey M... | @@ -16,27 +19,20 @@ class NineNowIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?9now\.com\.au/(?:[^/]+/){2}(?P<id>[^/?#]+)'
_GEO_COUNTRIES = ['AU']
_TESTS = [{
- # clip
- 'url': 'https://www.9now.com.au/afl-footy-show/2016/clip-ciql02091000g0hp5oktrnytc',
- 'md5': '17cf47d63ec9... | yt_dlp/extractor/ninenow.py | 26 | Python | 0.857 | bug | 365 | 51 | 51 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | dalanmiller |
}
break
else:
raise ExtractorError('Unable to find video data')
# Video Data extraction
if not self.get_param('allow_unplayable_formats') and try_get(common_data, lambda x: x['episode']['video']['drm'], bool):
self.report_drm(display_id)
b... | ```suggestion
thumbnails_data = try_get(common_data, lambda x: x['episode']['image']['sizes'], dict) or {}
thumbnails = [{
'id': thumbnail_id,
'url': thumbnail_url,
'width': int_or_none(thumbnail_id[1:]),
} for thumbnail_id, thumbnail_url in thumbnails_d... | }
}]
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/4460760524001/default_default/index.html?videoId=%s'
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
page_data = self._parse_json(self._search_regex... | @@ -59,26 +55,35 @@ def _real_extract(self, url):
cache = page_data.get(kind, {}).get('%sCache' % kind, {})
if not cache:
continue
- common_data = (cache.get(current_key) or list(cache.values())[0])[kind]
+ common_data = {
+ 'episode': (cac... | yt_dlp/extractor/ninenow.py | 26 | Python | 1 | suggestion | 483 | 44 | 51 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | dalanmiller |
webpage, 'page data'), display_id), display_id)
for kind in ('episode', 'clip'):
current_key = page_data.get(kind, {}).get(
'current%sKey' % kind.capitalize())
if not current_key:
continue
cache = page_data.get(kind, {}).get('%... | don't think this works
`id` appears to be an int. `or brightcove_id` will not be reached if `id` key doesn't exist, so it should be outside the try_get
```suggestion
video_id = str_or_none(try_get(common_data, lambda x: x['episode']['video']['id'])) or brightcove_id
```
I'm not sure if its a good ide... | 'id': '6249614030001',
'title': 'Episode 3',
'ext': 'mp4',
'season_number': 3,
'episode_number': 3,
'description': 'In the first elimination of the competition, teams will have 10 hours to build a world inside a snow globe.',
'uploader_... | @@ -59,26 +55,35 @@ def _real_extract(self, url):
cache = page_data.get(kind, {}).get('%sCache' % kind, {})
if not cache:
continue
- common_data = (cache.get(current_key) or list(cache.values())[0])[kind]
+ common_data = {
+ 'episode': (cac... | yt_dlp/extractor/ninenow.py | 26 | Python | 1 | bug | 561 | 51 | 51 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | dalanmiller |
r'window\.__data\s*=\s*JSON\.parse\s*\(\s*(".+?")\s*\)\s*;',
webpage, 'page data'), display_id), display_id)
for kind in ('episode', 'clip'):
current_key = page_data.get(kind, {}).get(
'current%sKey' % kind.capitalize())
if not current_key... | same as `video_id`, the fallback doesn't work here
```suggestion
brightcove_id = try_get(
common_data, lambda x: x['episode']['video']['brightcoveId'], compat_str) or f'ref:%s' % common_data['episode']['video']['referenceId']
``` | 'info_dict': {
'id': '6249614030001',
'title': 'Episode 3',
'ext': 'mp4',
'season_number': 3,
'episode_number': 3,
'description': 'In the first elimination of the competition, teams will have 10 hours to build a world inside a snow globe.',... | @@ -59,26 +55,35 @@ def _real_extract(self, url):
cache = page_data.get(kind, {}).get('%sCache' % kind, {})
if not cache:
continue
- common_data = (cache.get(current_key) or list(cache.values())[0])[kind]
+ common_data = {
+ 'episode': (cac... | yt_dlp/extractor/ninenow.py | 26 | Python | 1 | suggestion | 253 | 51 | 51 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | coletdjnz | dalanmiller |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
smuggle_url,
unified_timestamp,
unified_strdate,
try_get,
)
class NineNowIE(InfoExtractor):
IE_NA... | ```suggestion
str_or_none,
unified_timestamp,
``` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
smuggle_url,
str_or_none,
try_get,
unified_strdate,
unified_timestamp,
)
class NineNowIE(InfoExtr... | @@ -8,6 +8,9 @@
int_or_none,
float_or_none,
smuggle_url,
+ unified_timestamp, | yt_dlp/extractor/ninenow.py | 11 | Python | 0.857 | suggestion | 60 | 36 | 36 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | dalanmiller |
if not page_data:
page_data = self._parse_json(self._parse_json(self._search_regex(
r'window\.__data\s*=\s*JSON\.parse\s*\(\s*(".+?")\s*\)\s*;',
webpage, 'page data'), display_id), display_id)
for kind in ('episode', 'clip'):
current_key = page_da... | ```suggestion
common_data, lambda x: x['episode']['video']['brightcoveId'], compat_str) or 'ref:%s' % common_data['episode']['video']['referenceId']
``` | # episode of series
'url': 'https://www.9now.com.au/lego-masters/season-3/episode-3',
'info_dict': {
'id': '6249614030001',
'title': 'Episode 3',
'ext': 'mp4',
'season_number': 3,
'episode_number': 3,
'description': 'In the ... | @@ -59,26 +55,32 @@ def _real_extract(self, url):
cache = page_data.get(kind, {}).get('%sCache' % kind, {})
if not cache:
continue
- common_data = (cache.get(current_key) or list(cache.values())[0])[kind]
+ common_data = {
+ 'episode': (cac... | yt_dlp/extractor/ninenow.py | 26 | Python | 1 | suggestion | 166 | 51 | 51 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | dalanmiller |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
smuggle_url,
str_or_none,
unified_timestamp,
unified_strdate,
try_get,
)
class NineNowIE(InfoExtr... | ```suggestion
str_or_none,
try_get,
unified_strdate,
unified_timestamp,
``` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
smuggle_url,
str_or_none,
try_get,
unified_strdate,
unified_timestamp,
)
class NineNowIE(InfoExtr... | @@ -8,6 +8,10 @@
int_or_none,
float_or_none,
smuggle_url,
+ str_or_none,
+ unified_timestamp,
+ unified_strdate,
+ try_get, | yt_dlp/extractor/ninenow.py | 14 | Python | 0.857 | suggestion | 96 | 39 | 39 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | dalanmiller |
}, {
# episode
'url': 'https://www.9now.com.au/afl-footy-show/2016/episode-19',
'only_matching': True,
}, {
# DRM protected
'url': 'https://www.9now.com.au/andrew-marrs-history-of-the-world/season-1/episode-1',
'only_matching': True,
}, {
# episode of ... | ```suggestion
'params':{
'skip_download': True,
}
``` | }, {
# episode
'url': 'https://www.9now.com.au/afl-footy-show/2016/episode-19',
'only_matching': True,
}, {
# DRM protected
'url': 'https://www.9now.com.au/andrew-marrs-history-of-the-world/season-1/episode-1',
'only_matching': True,
}, {
# episode of ... | @@ -37,6 +41,24 @@ class NineNowIE(InfoExtractor):
# DRM protected
'url': 'https://www.9now.com.au/andrew-marrs-history-of-the-world/season-1/episode-1',
'only_matching': True,
+ }, {
+ # episode of series
+ 'url': 'https://www.9now.com.au/lego-masters/season-3/episode-3',
+ ... | yt_dlp/extractor/ninenow.py | 26 | Python | 0.857 | suggestion | 85 | 51 | 51 | false | Adding improvements to 9Now to handle episodic series | 896 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | dalanmiller |
}, {
'url': 'https://zen.yandex.ru/media/id/606fd806cc13cb3c58c05cf5/vot-eto-focus-dedy-morozy-na-gidrociklah-60c7c443da18892ebfe85ed7',
'info_dict': {
'id': '60c7c443da18892ebfe85ed7',
'ext': 'mp4',
'title': 'ВОТ ЭТО Focus. Деды Морозы на гидроциклах',
... | ```suggestion
'title': try_get(data_json, (lambda x: x['og']['title'], lambda x: x['publication']['content']['preview']['title'])),
``` | }, {
'url': 'https://zen.yandex.ru/media/id/606fd806cc13cb3c58c05cf5/vot-eto-focus-dedy-morozy-na-gidrociklah-60c7c443da18892ebfe85ed7',
'info_dict': {
'id': '60c7c443da18892ebfe85ed7',
'ext': 'mp4',
'title': 'ВОТ ЭТО Focus. Деды Морозы на гидроциклах',
... | @@ -142,3 +145,88 @@ def _real_extract(self, url):
'release_year': int_or_none(content.get('release_year')),
'formats': formats,
}
+
+
+class ZenYandexIE(InfoExtractor):
+ _VALID_URL = r'https?://zen\.yandex\.ru/media/(?:id/[^/]+/|[^/]+/)(?:[a-z0-9-]+)-(?P<id>[a-z0-9-]+)'
+ _TES... | yt_dlp/extractor/yandexvideo.py | 26 | Python | 0.714 | suggestion | 149 | 51 | 51 | false | Add ZenYandexIE and ZenYandexChannelIE. | 900 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
class OlympicsReplayIE(InfoExtractor):
_VALID_URL = r'(?:https?://)(?:www\.)?olympics\.com/tokyo-2020/(?:[a-z]{2}/)?replay/(?P<id>[^/#&?]+)'
_TESTS = [{
'url': 'https://olympics.com/tokyo-2020/en/replay/300622eb-abc0-43ea-b03b-c5f2d429ec7b/jumping-team-qualifier',
'info_dict': {
'i... | This is generally not a robust approach, but given the nature of the website, I guess it's fair enough |
class OlympicsReplayIE(InfoExtractor):
_VALID_URL = r'(?:https?://)(?:www\.)?olympics\.com/tokyo-2020/(?:[a-z]{2}/)?replay/(?P<id>[^/#&?]+)'
_TESTS = [{
'url': 'https://olympics.com/tokyo-2020/en/replay/300622eb-abc0-43ea-b03b-c5f2d429ec7b/jumping-team-qualifier',
'info_dict': {
'i... | @@ -0,0 +1,52 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import unified_strdate
+
+
+class OlympicsReplayIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?olympics\.com/tokyo-2020/(?:[a-z]{2}/)?replay/(?P<id>[^/#&?]+)'
+ _TESTS = [{
+ ... | yt_dlp/extractor/olympics.py | 26 | Python | 0.357 | suggestion | 102 | 48 | 51 | false | Add OlympicsReplayIE. | 905 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'release_date': '20210806',
'upload_date': '20210713',
},
'params': {
'format': 'bv',
},
}, {
'url': 'https://olympics.com/tokyo-2020/en/replay/bd242924-4b22-49a5-a846-f1d4c809250d/mens-bronze-medal-match-hun-esp',
'only_matching': True,
... | ```suggestion
m3u8_url = self._download_json(
'https://meteringtok.ovpobs.tv/api/playback-sessions', id, headers=headers, query={
'alias': stream_data['alias'],
'stream': stream_data['stream'],
'type': 'vod'
})['data']['attributes']['... | 'release_date': '20210806',
'upload_date': '20210713',
},
'params': {
'format': 'bv',
},
}, {
'url': 'https://olympics.com/tokyo-2020/en/replay/bd242924-4b22-49a5-a846-f1d4c809250d/mens-bronze-medal-match-hun-esp',
'only_matching': True,
... | @@ -0,0 +1,52 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import unified_strdate
+
+
+class OlympicsReplayIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?olympics\.com/tokyo-2020/(?:[a-z]{2}/)?replay/(?P<id>[^/#&?]+)'
+ _TESTS = [{
+ ... | yt_dlp/extractor/olympics.py | 26 | Python | 0.929 | suggestion | 330 | 38 | 42 | false | Add OlympicsReplayIE. | 905 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'info_dict': {
'id': '341736',
'ext': 'mp4',
'title': 'The First Night',
'thumbnail': 'https://i0.hdslb.com/bfs/intl/management/91e30e5521235d9b163339a26a0b030ebda54310.png',
'episode_number': 2,
},
'params': {
'format': 'bv... | ```suggestion
type, season_id, id = self._match_valid_url(url).groups()
``` | return self._download_json(self._API_URL.format(type, endpoint), id)['data']
def _get_subtitles(self, type, ep_id):
sub_json = self._call_api(type, f'/m/subtitle?ep_id={ep_id}&platform=web', ep_id)
subtitles = {}
for sub in sub_json.get('subtitles', []):
sub_url = sub.ge... | @@ -774,3 +775,119 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?bili(?P<type>bili\.tv|intl.com)/(?:[a-z]... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.714 | suggestion | 85 | 51 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | Ashish0804 |
'title': episode_data['long_title'] or episode_data.get('title'),
'thumbnail': episode_data.get('cover'),
'episode_number': str_to_int(episode_data.get('title')),
'formats': formats,
'subtitles': subtitles,
}
class BiliIntlSeriesIE(InfoExtractor):
... | When downloading a series, this API is redownloaded for each episode. Would be better if the seriesIE itself can extract everything needed | },
}, {
'url': 'https://www.biliintl.com/en/play/34613/341736',
'info_dict': {
'id': '341736',
'ext': 'mp4',
'title': 'The First Night',
'thumbnail': 'https://i0.hdslb.com/bfs/intl/management/91e30e5521235d9b163339a26a0b030ebda54310.png',
... | @@ -774,3 +775,119 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?bili(?P<type>bili\.tv|intl.com)/(?:[a-z]... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.429 | refactor | 138 | 35 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
},
'params': {
'format': 'bv',
},
}, {
'url': 'https://www.biliintl.com/en/play/34613/341736',
'info_dict': {
'id': '341736',
'ext': 'mp4',
'title': 'The First Night',
'thumbnail': 'https://i0.hdslb.com/bfs/intl/mana... | sacrificing time here in favor of saving a ton in series extractor. | 'info_dict': {
'id': '341736',
'ext': 'mp4',
'title': 'The First Night',
'thumbnail': 'https://i0.hdslb.com/bfs/intl/management/91e30e5521235d9b163339a26a0b030ebda54310.png',
'episode_number': 2,
},
'params': {
'format': 'bv... | @@ -774,3 +775,139 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlBaseIE(InfoExtractor):
+ _API_URL = 'https://api.bili{}/intl/gateway'
+
+ def _call_api(self... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.286 | refactor | 67 | 51 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | Ashish0804 |
'acodec': aud.get('codecs'),
'vcodec': 'none',
'filesize': aud.get('size'),
})
sub_json = self._call_api(f'/m/subtitle?ep_id={ep_id}&platform=web', ep_id)
subtitles = {}
for sub in sub_json.get('subtitles', []):
... | ```suggestion
return {
'id': ep_id,
'extractor_key': BiliIntlIE.ie_key(),
'title': episode_data['long_title'] or episode_data.get('title'),
'thumbnail': episode_data.get('cover'),
'episode_number': str_to_int(episode_data.get('title')),
... | 'width': video_res.get('width'),
'height': video_res.get('height'),
'vbr': video_res.get('bandwidth'),
'acodec': 'none',
'vcodec': video_res.get('codecs'),
'filesize': video_res.get('size'),
})
for aud in... | @@ -774,3 +775,139 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlBaseIE(InfoExtractor):
+ _API_URL = 'https://api.bili{}/intl/gateway'
+
+ def _call_api(self... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.857 | refactor | 446 | 51 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
}
def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
class BiliIntlBaseIE(InfoExtractor):
_API_URL = 'https://api.bili{}/intl/gateway'
... | isnt it better to do
```
if not video_res.get('url'):
continue
formats.append(...)
```
same below | }
def _real_extract(self, url):
video_id = self._match_id(url)
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
class BiliIntlBaseIE(InfoExtractor):
_API_URL = 'https://api.bili{}/intl/gateway{}'
... | @@ -774,3 +775,139 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlBaseIE(InfoExtractor):
+ _API_URL = 'https://api.bili{}/intl/gateway'
+
+ def _call_api(self... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.786 | suggestion | 109 | 51 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'width': video_res.get('width'),
'height': video_res.get('height'),
'vbr': video_res.get('bandwidth'),
'acodec': 'none',
'vcodec': video_res.get('codecs'),
'filesize': video_res.get('size'),
... | formats and subtitle code seems completely seperate. plus, subtitles need an additional request. It is best to delegate this to `self._get_subtitles` and then call `self.extract_subtitles` in `_real_extract` | if not video_json:
self.raise_login_required(method='cookies')
video_json = video_json['playurl']
formats = []
for vid in video_json.get('video', []):
video_res = vid.get('video_resource') or {}
video_info = vid.get('stream_info') or {}
if ... | @@ -774,3 +775,139 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlBaseIE(InfoExtractor):
+ _API_URL = 'https://api.bili{}/intl/gateway'
+
+ def _call_api(self... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.643 | refactor | 207 | 51 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
if aud.get('url'):
formats.append({
'url': aud['url'],
'ext': 'mp4',
'abr': aud.get('bandwidth'),
'acodec': aud.get('codecs'),
'vcodec': 'none',
'filesize': aud.get('size')... | did u mean
```suggestion
'title': episode_data.get('long_title') or episode_data['title'],
``` | continue
formats.append({
'url': video_res['url'],
'ext': 'mp4',
'format_note': video_info.get('desc_words'),
'width': video_res.get('width'),
'height': video_res.get('height'),
'vbr': video_res.g... | @@ -774,3 +775,139 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlBaseIE(InfoExtractor):
+ _API_URL = 'https://api.bili{}/intl/gateway'
+
+ def _call_api(self... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.714 | suggestion | 110 | 51 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'id': '341736',
'ext': 'mp4',
'title': 'The First Night',
'thumbnail': 'https://i0.hdslb.com/bfs/intl/management/91e30e5521235d9b163339a26a0b030ebda54310.png',
'episode_number': 2,
},
'params': {
'format': 'bv',
},
}, {
... | why r u saving it back to `self._API_URL`? This will break if you give 2 urls at once. Just pass `type` or the url to `_call_api` |
class BiliIntlIE(BiliIntlBaseIE):
_VALID_URL = r'https?://(?:www\.)?bili(?P<type>bili\.tv|intl.com)/(?:[a-z]{2}/)?play/(?P<season_id>\d+)/(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.bilibili.tv/en/play/34613/341736',
'info_dict': {
'id': '341736',
'ext': 'mp4',
... | @@ -774,3 +775,139 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlBaseIE(InfoExtractor):
+ _API_URL = 'https://api.bili{}/intl/gateway'
+
+ def _call_api(self... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.643 | bug | 129 | 51 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
class BiliIntlBaseIE(InfoExtractor):
_API_URL = 'https://api.bili{}/intl/gateway{}'
def _call_api(self, type, endpoint, id):
return self._download_json(self._API_URL.format(type, endpoint), id)['data']
def _get_subtitles(self, type, ep_id):
sub_json = self._call_api(type, f'/m/subtitle?ep_... | ```suggestion
video_res = vid.get('video_resource') or {}
``` | class BiliIntlBaseIE(InfoExtractor):
_API_URL = 'https://api.bili{}/intl/gateway{}'
def _call_api(self, type, endpoint, id):
return self._download_json(self._API_URL.format(type, endpoint), id)['data']
def _get_subtitles(self, type, ep_id):
sub_json = self._call_api(type, f'/m/subtitle?ep_... | @@ -774,3 +775,144 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlBaseIE(InfoExtractor):
+ _API_URL = 'https://api.bili{}/intl/gateway{}'
+
+ def _call_api(se... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.571 | suggestion | 75 | 51 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
_API_URL = 'https://api.bili{}/intl/gateway{}'
def _call_api(self, type, endpoint, id):
return self._download_json(self._API_URL.format(type, endpoint), id)['data']
def _get_subtitles(self, type, ep_id):
sub_json = self._call_api(type, f'/m/subtitle?ep_id={ep_id}&platform=web', ep_id)
... | ```suggestion
video_info = vid.get('stream_info') or {}
``` | _API_URL = 'https://api.bili{}/intl/gateway{}'
def _call_api(self, type, endpoint, id):
return self._download_json(self._API_URL.format(type, endpoint), id)['data']
def _get_subtitles(self, type, ep_id):
sub_json = self._call_api(type, f'/m/subtitle?ep_id={ep_id}&platform=web', ep_id)
... | @@ -774,3 +775,144 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlBaseIE(InfoExtractor):
+ _API_URL = 'https://api.bili{}/intl/gateway{}'
+
+ def _call_api(se... | yt_dlp/extractor/bilibili.py | 26 | Python | 0.571 | suggestion | 73 | 51 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
if not aud.get('url'):
continue
formats.append({
'url': aud['url'],
'ext': 'mp4',
'abr': aud.get('bandwidth'),
'acodec': aud.get('codecs'),
'vcodec': 'none',
'filesize': aud.get('size'... | ```suggestion
return {
'id': ep_id,
'title': episode_data.get('long_title') or episode_data['title'],
'thumbnail': episode_data.get('cover'),
'episode_number': str_to_int(episode_data.get('title')),
'formats': self._get_formats(type, ep_id),
... | if not aud.get('url'):
continue
formats.append({
'url': aud['url'],
'ext': 'mp4',
'abr': aud.get('bandwidth'),
'acodec': aud.get('codecs'),
'vcodec': 'none',
'filesize': aud.get('size'... | @@ -774,3 +775,144 @@ def _real_extract(self, url):
return self.url_result(
'http://www.bilibili.tv/video/av%s/' % video_id,
ie=BiliBiliIE.ie_key(), video_id=video_id)
+
+
+class BiliIntlBaseIE(InfoExtractor):
+ _API_URL = 'https://api.bili{}/intl/gateway{}'
+
+ def _call_api(se... | yt_dlp/extractor/bilibili.py | 26 | Python | 1 | refactor | 445 | 51 | 51 | false | Add BiliIntlIE and BiliIntlSeriesIE. | 907 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
# coding: utf-8
from __future__ import unicode_literals
from .brightcove import BrightcoveNewIE
from ..compat import compat_str
from .common import InfoExtractor
from ..utils import (
ExtractorError,
traverse_obj
)
class NZHeraldIE(InfoExtractor):
IE_NAME = 'nzherald'
_VALID_URL = r'https?://(?:www\.... | ```suggestion
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
traverse_obj
)
``` | # coding: utf-8
from __future__ import unicode_literals
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
traverse_obj
)
class NZHeraldIE(InfoExtractor):
IE_NAME = 'nzherald'
_VALID_URL = r'https?://(?:www\... | @@ -0,0 +1,93 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .brightcove import BrightcoveNewIE
+from ..compat import compat_str
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ traverse_obj
+) | yt_dlp/extractor/nzherald.py | 10 | Python | 0.929 | refactor | 194 | 35 | 35 | false | [nzherald] Add NZHeraldIE | 909 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'id': 'browser'
},
'variantAvailability': {
'featureset': {
'min': featureset_video,
'max': featureset_video
},
'platformTag': platform_tag_video
... | Are you sure there is only one m3u8? otherwise, the `hls_subs` of everything but the last one is discarded | 'client': {
'version': '4.1',
'id': 'browser'
},
'variantAvailability': {
'featureset': {
'min': featureset,
'max': featureset
},
... | @@ -105,28 +120,69 @@ def _real_extract(self, url):
href = ios_base_url + href
ext = determine_ext(href)
if ext == 'm3u8':
- formats.extend(self._extract_m3u8_formats(
+ hls_formats, hls_subs = self._extract_m3u8_formats_and_subtitles(
... | yt_dlp/extractor/itv.py | 26 | Python | 0.5 | suggestion | 106 | 51 | 51 | false | [ITV] Fix Extractor | 913 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
if ios_base_url:
href = ios_base_url + href
ext = determine_ext(href)
if ext == 'm3u8':
hls_formats, hls_subs = self._extract_m3u8_formats_and_subtitles(
href, video_id, 'mp4', entry_protocol='m3u8_native',
m3u8_... | There is no such warning for other extractors. This isnt needed. If the user tries to download subs, the core code will issue a warning | if try_get(featureset, lambda x: x[2]) == 'outband-webvtt'),
(None, None))
if platform_tag_subs or featureset_subs:
subs_playlist = self._call_api(
video_id, ios_playlist_url, headers, platform_tag_subs, featureset_subs, fatal=False)
subs = try_ge... | @@ -105,28 +120,69 @@ def _real_extract(self, url):
href = ios_base_url + href
ext = determine_ext(href)
if ext == 'm3u8':
- formats.extend(self._extract_m3u8_formats(
+ hls_formats, hls_subs = self._extract_m3u8_formats_and_subtitles(
... | yt_dlp/extractor/itv.py | 26 | Python | 0.429 | refactor | 135 | 51 | 51 | false | [ITV] Fix Extractor | 913 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'name': 'Windows NT',
'version': '6.1',
'type': 'desktop'
}
},
'client': {
'version': '4.1',
'id': 'browser'
},
'variantAvai... | I believe this is same as
```suggestion
if try_get(featureset, lambda x: x[2]) == 'outband-webvtt':
```
you can also use `next` to get rid of the for loops altogether | 'only_matching': True,
}]
def _generate_api_headers(self, hmac):
return merge_dicts({
'Accept': 'application/vnd.itv.vod.playlist.v2+json',
'Content-Type': 'application/json',
'hmac': hmac.upper(),
}, self.geo_verification_headers())
def _call_ap... | @@ -87,15 +82,64 @@ def _real_extract(self, url):
},
'variantAvailability': {
'featureset': {
- 'min': ['hls', 'aes', 'outband-webvtt'],
- 'max': ['hls', 'aes', 'outband-webvtt']
+ 'min': features... | yt_dlp/extractor/itv.py | 26 | Python | 0.786 | suggestion | 187 | 51 | 51 | false | [ITV] Fix Extractor | 913 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
}
},
'client': {
'version': '4.1',
'id': 'browser'
},
'variantAvailability': {
'featureset': {
'min': featureset,
'max': feature... | ```suggestion
platform_tag_subs, featureset_subs = next(
((platform_tag, featureset)
for platform_tag, featuresets in variants.items() for featureset in featuresets
if try_get(featureset, lambda x: x[2]) == 'outband-webvtt'),
(None, None))
``` | def _generate_api_headers(self, hmac):
return merge_dicts({
'Accept': 'application/vnd.itv.vod.playlist.v2+json',
'Content-Type': 'application/json',
'hmac': hmac.upper(),
}, self.geo_verification_headers())
def _call_api(self, video_id, playlist_url, headers... | @@ -87,15 +82,64 @@ def _real_extract(self, url):
},
'variantAvailability': {
'featureset': {
- 'min': ['hls', 'aes', 'outband-webvtt'],
- 'max': ['hls', 'aes', 'outband-webvtt']
+ 'min': features... | yt_dlp/extractor/itv.py | 26 | Python | 0.786 | suggestion | 307 | 51 | 51 | false | [ITV] Fix Extractor | 913 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
for sub in subs:
if not isinstance(sub, dict):
continue
href = url_or_none(sub.get('Href'))
if not href:
continue
subtitles.setdefault('en', []).append({'url': href})
return subtitles
def _re... | ```suggestion
platform_tag_video, featureset_video = next(
((platform_tag, featureset)
for platform_tag, featuresets in variants.items() for featureset in featuresets
if try_get(featureset, lambda x: x[:2]) == ['hls', 'aes']),
(None, None))
```
same a... | 'min': featureset,
'max': featureset
},
'platformTag': platform_tag
}
}).encode(), headers=headers, fatal=fatal)
def _get_subtitles(self, video_id, variants, ios_playlist_url, headers, *args, **kwarg... | @@ -87,15 +82,64 @@ def _real_extract(self, url):
},
'variantAvailability': {
'featureset': {
- 'min': ['hls', 'aes', 'outband-webvtt'],
- 'max': ['hls', 'aes', 'outband-webvtt']
+ 'min': features... | yt_dlp/extractor/itv.py | 26 | Python | 0.786 | suggestion | 327 | 51 | 51 | false | [ITV] Fix Extractor | 913 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
'thumbnail': r're:(?:https?://)(?:www\.)?musescore\.com/.*\.png[^$]+',
'uploader': 'ClassicMan',
'creator': 'Ludwig van Beethoven (1770–1827)',
}
}]
def _real_extract(self, url):
webpage = self._download_webpage(url, None)
url = self._og_search_url(we... | I don't think this is accurate extraction; it should give you `Download and print in PDF or MIDI free sheet music for <title> Theme by <author of song> arranged by <uploader> for <instrument> (<formation>)` according to its HTML. Using `_search_json_ld` is the easiest way I think | 'thumbnail': r're:(?:https?://)(?:www\.)?musescore\.com/.*\.png[^$]+',
'uploader': 'ClassicMan',
'creator': 'Ludwig van Beethoven (1770–1827)',
}
}, {
'url': 'https://musescore.com/minh_cuteee/scores/6555384',
'only_matching': True,
}]
def _real_e... | @@ -0,0 +1,64 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class MuseScoreIE(InfoExtractor):
+ _VALID_URL = r'(?:https?://)(?:www\.)?musescore\.com/(?:user/\d+|[^/]+)(?:/scores)?/(?P<id>[^#&?]+)'
+ _TESTS = [{
+ 'url': 'https://musescore.com/minh_cu... | yt_dlp/extractor/musescore.py | 26 | Python | 0.643 | security | 280 | 28 | 31 | false | Add MuseScoreIE. | 918 | yt-dlp/yt-dlp | 132,642 | Python | Lesmiscore | Ashish0804 |
except ExtractorError as e:
self.report_warning(f'{e}; Retrying with webpage')
# If we only call once, we get a 403 when downlaoding the video.
self._download_webpage(url, video_id)
webpage = self._download_webpage(url, video_id, note='Downloading video webpage')
jso... | are u sure about this change?
I think when i added this, i found some accounts using `_` in name | return self._extract_aweme_app(video_id)
except ExtractorError as e:
self.report_warning(f'{e}; Retrying with webpage')
# If we only call once, we get a 403 when downlaoding the video.
self._download_webpage(url, video_id)
webpage = self._download_webpage(url, vi... | @@ -323,38 +336,32 @@ def _real_extract(self, url):
raise ExtractorError('Video not available', video_id=video_id)
-class TikTokUserIE(InfoExtractor):
+class TikTokUserIE(TikTokBaseIE):
IE_NAME = 'tiktok:user'
- _VALID_URL = r'https?://(?:www\.)?tiktok\.com/@(?P<id>[\w\._]+)/?(?:$|[#?])'
+ _VALI... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.429 | suggestion | 98 | 51 | 51 | false | [TikTokUser] Use mobile API + [TikTok(Base)] Cleanup | 925 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | MinePlayersPE |
def parse_url_key(url_key):
format_id, codec, res, bitrate = self._search_regex(
r'v[^_]+_(?P<id>(?P<codec>[^_]+)_(?P<res>\d+p)_(?P<bitrate>\d+))', url_key,
'url key', default=(None, None, None, None), group=('id', 'codec', 'res', 'bitrate'))
if not format... | Doesn't seem to actually deprioritize it :/ Any ideas? | r'v[^_]+_(?P<id>(?P<codec>[^_]+)_(?P<res>\d+p)_(?P<bitrate>\d+))', url_key,
'url key', default=(None, None, None, None), group=('id', 'codec', 'res', 'bitrate'))
if not format_id:
return {}, None
return {
'format_id': format_id,
... | @@ -199,6 +101,7 @@ def extract_addr(addr, add_meta={}):
'filesize': int_or_none(addr.get('data_size')),
'ext': 'mp4',
'acodec': 'aac',
+ 'source_preference': -2 if 'aweme/v1' in url else -1, # Downloads from API might get blocked | yt_dlp/extractor/tiktok.py | 26 | Python | 0.214 | question | 54 | 51 | 51 | false | [TikTokUser] Use mobile API + [TikTok(Base)] Cleanup | 925 | yt-dlp/yt-dlp | 132,642 | Python | MinePlayersPE | MinePlayersPE |
'filesize': int_or_none(addr.get('data_size')),
'ext': 'mp4',
'acodec': 'aac',
'source_preference': -2 if 'aweme/v1' in url else -1, # Downloads from API might get blocked
**add_meta, **parsed_meta
} for url in addr.get('url_li... | ```
* preference Order number of this format. If this field is
present and not None, the formats get sorted
by this field, regardless of all other values.
```
Are you sure this is what you want? The priority of `preference` canno... | 'acodec': 'aac',
'source_preference': -2 if 'aweme/v1' in url else -1, # Downloads from API might get blocked
**add_meta, **parsed_meta,
'format_note': ' '.join(filter(None, (
add_meta.get('format_note'), '(API)' if 'aweme/v1' in url e... | @@ -220,7 +123,7 @@ def extract_addr(addr, add_meta={}):
'vcodec': 'h264',
'width': video_info.get('width'),
'height': video_info.get('height'),
- 'source_preference': -2 if video_info.get('has_watermark') else -1,
+ 'preference': -2 if vi... | yt_dlp/extractor/tiktok.py | 26 | Python | 0.857 | suggestion | 414 | 51 | 51 | false | [TikTokUser] Use mobile API + [TikTok(Base)] Cleanup | 925 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | MinePlayersPE |
url, display_id, self._API_URL, 'go', 'us')
class ScienceChannelIE(DiscoveryPlusIE):
_VALID_URL = r'https?://(?:www\.)?sciencechannel\.com/video' + DPlayIE._PATH_REGEX
_TESTS = [{
'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
'... | Add an `only_matching` test for `www.` version. When you do, the test will fail. You'll need to remove that URL pattern from the `ScrippsNetworksIE` to fix it | url, display_id, self._API_URL, 'go', 'us')
class ScienceChannelIE(DiscoveryPlusIE):
_VALID_URL = r'https?://(?:www\.)?sciencechannel\.com/video' + DPlayIE._PATH_REGEX
_TESTS = [{
'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
'... | @@ -389,3 +389,23 @@ class ScienceChannelIE(DiscoveryPlusIE):
_PRODUCT = 'sci'
_API_URL = 'us1-prod-direct.sciencechannel.com'
+
+
+class DIYNetworkIE(DiscoveryPlusIE):
+ _VALID_URL = r'https?://(?:www\.|watch\.)?diynetwork\.com/video' + DPlayIE._PATH_REGEX
+ _TESTS = [{ | yt_dlp/extractor/dplay.py | 26 | Python | 0.714 | bug | 158 | 42 | 42 | false | DIY Network switched formats | 934 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Sipherdrakon |
fatal=False)
timestamp = unified_timestamp(self._html_search_regex(
(r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+</dd>\s*<dd>[^<]+)',
r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+)'), webpage, 'timestamp',
default=None))
duration = parse_duration(self._html_searc... | ```suggestion
if video_type_description == 'Audio File':
``` |
timestamp = unified_timestamp(self._html_search_regex(
(r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+</dd>\s*<dd>[^<]+)',
r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+)'), webpage, 'timestamp',
default=None))
duration = parse_duration(self._html_search_regex(
r'"durat... | @@ -128,20 +132,26 @@ def _real_extract(self, url):
(r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+</dd>\s*<dd>[^<]+)',
r'<dt>\s*Uploaded\s*</dt>\s*<dd>([^<]+)'), webpage, 'timestamp',
default=None))
- duration = parse_duration(self._search_regex(
- r'(?s)<dd>\s*Song\s*... | yt_dlp/extractor/newgrounds.py | 26 | Python | 0.714 | suggestion | 70 | 51 | 51 | false | [Newgrounds] Add NewgroundsUser and improve extractor | 942 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
_PAGE_SIZE = 30
_TESTS = [{
'url': 'https://burn7.newgrounds.com/audio',
'info_dict': {
'id': 'burn7',
},
'playlist_mincount': 150,
}, {
'url': 'https://burn7.newgrounds.com/movies',
'info_dict': {
'id': 'burn7',
},
'pla... | ```suggestion
note=f'Downloading page {page}', errnote=f'Failed to download page {page}', headers={
```
though the errnote is unnecessary here imo | 'url': 'https://burn7.newgrounds.com/audio',
'info_dict': {
'id': 'burn7',
},
'playlist_mincount': 150,
}, {
'url': 'https://burn7.newgrounds.com/movies',
'info_dict': {
'id': 'burn7',
},
'playlist_mincount': 2,
}, {
... | @@ -202,7 +213,57 @@ def _real_extract(self, url):
continue
entries.append(
self.url_result(
- 'https://www.newgrounds.com/%s' % path,
+ f'https://www.newgrounds.com/{path}',
ie=NewgroundsIE.ie_key(), video_id=medi... | yt_dlp/extractor/newgrounds.py | 26 | Python | 0.714 | bug | 161 | 46 | 45 | false | [Newgrounds] Add NewgroundsUser and improve extractor | 942 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'playlist_mincount': 150,
}, {
'url': 'https://burn7.newgrounds.com/movies',
'info_dict': {
'id': 'burn7',
},
'playlist_mincount': 2,
}, {
'url': 'https://brian-beaton.newgrounds.com/movies',
'info_dict': {
'id': 'brian-beaton',
... | why `f'{year}'`? use just `year` or `str(year)` | 'url': 'https://burn7.newgrounds.com/movies',
'info_dict': {
'id': 'burn7',
},
'playlist_mincount': 2,
}, {
'url': 'https://brian-beaton.newgrounds.com/movies',
'info_dict': {
'id': 'brian-beaton',
},
'playlist_mincount': 10,
... | @@ -202,7 +213,57 @@ def _real_extract(self, url):
continue
entries.append(
self.url_result(
- 'https://www.newgrounds.com/%s' % path,
+ f'https://www.newgrounds.com/{path}',
ie=NewgroundsIE.ie_key(), video_id=medi... | yt_dlp/extractor/newgrounds.py | 26 | Python | 0.286 | question | 47 | 40 | 39 | false | [Newgrounds] Add NewgroundsUser and improve extractor | 942 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
title = self._search_regex(
r'<title>([^>]+)</title>', webpage, 'title', default=None)
# cut left menu
webpage = self._search_regex(
r'(?s)<div[^>]+\bclass=["\']column wide(.+)',
webpage, 'wide column', default=webpage)
entries = []
for a, p... | ```suggestion
_VALID_URL = r'https?://(?P<id>[^\.]+)\.newgrounds\.com/(?:movies|audio)/?(?:[#?]|$)'
```
should fix the tests | title = self._search_regex(
r'<title>([^>]+)</title>', webpage, 'title', default=None)
# cut left menu
webpage = self._search_regex(
r'(?s)<div[^>]+\bclass=["\']column wide(.+)',
webpage, 'wide column', default=webpage)
entries = []
for a, pa... | @@ -202,7 +213,57 @@ def _real_extract(self, url):
continue
entries.append(
self.url_result(
- 'https://www.newgrounds.com/%s' % path,
+ f'https://www.newgrounds.com/{path}',
ie=NewgroundsIE.ie_key(), video_id=medi... | yt_dlp/extractor/newgrounds.py | 26 | Python | 0.786 | suggestion | 131 | 51 | 51 | false | [Newgrounds] Add NewgroundsUser and improve extractor | 942 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
_TESTS = [{
'url': 'https://www.newgrounds.com/collection/cats',
'info_dict': {
'id': 'cats',
'title': 'Cats',
},
'playlist_mincount': 45,
}, {
'url': 'https://www.newgrounds.com/collection/dogs',
'info_dict': {
'id': 'dogs',
... | ```suggestion
r'<title>([^>]+)</title>', webpage, 'title', default=None)
``` | _TESTS = [{
'url': 'https://www.newgrounds.com/collection/cats',
'info_dict': {
'id': 'cats',
'title': 'Cats',
},
'playlist_mincount': 45,
}, {
'url': 'https://www.newgrounds.com/collection/dogs',
'info_dict': {
'id': 'dogs',
... | @@ -197,7 +196,7 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, playlist_id)
title = self._search_regex(
- r'<title>([^>]+)</title>', webpage, 'title', default=None)
+ r'<title>(.+?)</title>', webpage, 'title', default=None) | yt_dlp/extractor/newgrounds.py | 26 | Python | 0.571 | suggestion | 90 | 51 | 51 | false | [Newgrounds] Add NewgroundsUser and improve extractor | 942 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
'playlist_mincount': 9,
}]
_PAGE_SIZE = 30
def _call_api(self, host, uuid, path, note=None, errnote=None, fatal=True):
return self._download_json(
self._API_BASE % (host, uuid, path), uuid,
note=note, errnote=errnote, fatal=fatal)
def _fetch_page(self, host, uui... | ```suggestion
host, playlist_id = self._match_valid_url(url).group('host', 'id')
``` | 'playlist_mincount': 9,
}]
_PAGE_SIZE = 30
def _call_api(self, host, uuid, path, note=None, errnote=None, fatal=True):
return self._download_json(
self._API_BASE % (host, uuid, path), uuid,
note=note, errnote=errnote, fatal=fatal)
def _fetch_page(self, host, uui... | @@ -1291,3 +1293,82 @@ def channel_data(field, type_):
'subtitles': subtitles,
'webpage_url': webpage_url,
}
+
+
+class PeerTubePlaylistIE(InfoExtractor):
+ IE_NAME = 'PeerTube:Playlist'
+ _VALID_URL = r'''(?x)
+ (?:
+ https?://(?P<host>... | yt_dlp/extractor/peertube.py | 26 | Python | 0.571 | suggestion | 94 | 43 | 40 | false | [Peertube] Add playlist extractor and update instances list | 957 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | u-spec-png |
for rendition_id, rendition in settings['renditions'].items():
bitrates = rendition.get('bitrates')
if not isinstance(bitrates, dict):
continue
m3u8_url = url_or_none(bitrates.get('hls'))
if not m3u8_url:
... | ```suggestion
for cc_file in cc_files:
cc_url = url_or_none(try_get(cc_file, lambda x: x[2]))
# name is used since we cant distinguish subs with same language code
cc_lang = try_get(cc_file, (lambda x: x[1].replace(' ', '-').lower(), lambda... |
for rendition_id, rendition in settings['renditions'].items():
m3u8_url = url_or_none(try_get(rendition, lambda x: x['bitrates']['hls']))
if not m3u8_url:
continue
frmt = self._extract_m3u8_formats(
m3u8_url, video_id, ... | @@ -57,48 +58,59 @@ def _real_extract(self, url):
mobj = self._match_valid_url(url)
title, key = mobj.group('title', 'key')
video_id = '%s/%s' % (title, key)
+ webpage = self._download_webpage(url, video_id, fatal=False)
+ data_videos = re.findall(r'data-video=\"([^\"]+)\"\s?dat... | yt_dlp/extractor/hidive.py | 26 | Python | 0.857 | suggestion | 467 | 44 | 36 | false | Fix HiDiveIE. | 958 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
settings = self._download_json(
'https://www.hidive.com/play/settings', video_id,
data=urlencode_postdata({
'Title': title,
'Key': key,
'PlayerId': 'f4f895ce1ca713ba263b91caeb1daa2d08904783',
'Ve... | ```suggestion
m3u8_url = url_or_none(try_get(rendition, lambda x: x['bitrates']['hls']))
``` |
settings = self._download_json(
'https://www.hidive.com/play/settings', video_id,
data=urlencode_postdata({
'Title': title,
'Key': key,
'PlayerId': 'f4f895ce1ca713ba263b91caeb1daa2d08904783',
'Ve... | @@ -57,48 +58,59 @@ def _real_extract(self, url):
mobj = self._match_valid_url(url)
title, key = mobj.group('title', 'key')
video_id = '%s/%s' % (title, key)
+ webpage = self._download_webpage(url, video_id, fatal=False)
+ data_videos = re.findall(r'data-video=\"([^\"]+)\"\s?dat... | yt_dlp/extractor/hidive.py | 26 | Python | 0.714 | suggestion | 110 | 51 | 51 | false | Fix HiDiveIE. | 958 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
class NDRBaseIE(InfoExtractor):
def _real_extract(self, url):
mobj = self._match_valid_url(url)
display_id = next(group for group in mobj.groups() if group)
id = mobj.group('id')
webpage = self._download_webpage(url, display_id)
return self._extract_embed(webpage, display_id,... | why remove these existing fields? | class NDRBaseIE(InfoExtractor):
def _real_extract(self, url):
mobj = self._match_valid_url(url)
display_id = next(group for group in mobj.groups() if group)
id = mobj.group('id')
webpage = self._download_webpage(url, display_id)
return self._extract_embed(webpage, display_id,... | @@ -23,115 +22,130 @@ def _real_extract(self, url):
return self._extract_embed(webpage, display_id, id)
-class NDRIE(NDRBaseIE):
+class NDRIE(InfoExtractor):
IE_NAME = 'ndr'
IE_DESC = 'NDR.de - Norddeutscher Rundfunk'
_VALID_URL = r'https?://(?:www\.)?(?:daserste\.)?ndr\.de/(?:[^/]+/)*(?P<di... | yt_dlp/extractor/ndr.py | 26 | Python | 0.143 | question | 33 | 51 | 51 | false | Rewrite NDRIE. | 962 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'thumbnail': 'https://www.ndr.de/fernsehen/screenshot983938_v-contentxl.jpg',
'description': 'md5:700f6de264010585012a72f97b0ac0c9',
'series': 'extra 3',
'channel': 'NDR Fernsehen',
'upload_date': '20201111',
'duration': 1749,
}
}, {
... | this code is duplicate from the BaseIE
you can use `_extract_embed` instead like what the extractor was already doing | 'id': 'audio51535',
'ext': 'mp3',
'title': 'La Valette entgeht der Hinrichtung',
'thumbnail': 'https://www.ndr.de/mediathek/mediathekbild140_v-podcast.jpg',
'description': 'md5:22f9541913a40fe50091d5cdd7c9f536',
'upload_date': '20140729',
... | @@ -23,115 +22,130 @@ def _real_extract(self, url):
return self._extract_embed(webpage, display_id, id)
-class NDRIE(NDRBaseIE):
+class NDRIE(InfoExtractor):
IE_NAME = 'ndr'
IE_DESC = 'NDR.de - Norddeutscher Rundfunk'
_VALID_URL = r'https?://(?:www\.)?(?:daserste\.)?ndr\.de/(?:[^/]+/)*(?P<di... | yt_dlp/extractor/ndr.py | 26 | Python | 0.571 | refactor | 118 | 51 | 51 | false | Rewrite NDRIE. | 962 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
def _real_extract(self, url):
webpage = self._download_webpage(url, None)
id = self._search_regex(r'data-video-id\s?=\s?\"([^\"]+)\"', webpage, 'id')
data_json = self._download_json(f'https://cdn.jwplayer.com/v2/media/{id}', id)
video_json = data_json['playlist'][0]
formats ... | just use `self._parse_jwplayer_data` | from __future__ import unicode_literals
from .common import InfoExtractor
class MediaiteIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mediaite.com/(?:tv|sports|politics|podcasts|opinion)/[\w-]+/'
_TESTS = [{
'url': 'https://www.mediaite.com/sports/bill-burr-roasts-nfl-for-promoting-black-live... | @@ -0,0 +1,117 @@
+from __future__ import unicode_literals
+
+
+from .common import InfoExtractor
+
+from ..utils import int_or_none
+
+
+class MediaiteIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mediaite.com/(?:tv|sports|politics|podcasts|opinion)/[\w-]+/'
+ _TESTS = [{
+ 'url': 'https://www.me... | yt_dlp/extractor/mediaite.py | 26 | Python | 0.286 | suggestion | 36 | 37 | 81 | false | Add MediaiteIE. | 973 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'url': 'https://news.cgtn.com/news/2021-06-06/China-Indonesia-vow-to-further-deepen-maritime-cooperation-10REvJCewCY/index.html',
'info_dict': {
'id': '10REvJCewCY',
'ext': 'mp4',
'title': 'China, Indonesia vow to further deepen maritime cooperatio... | title, description and thumbnail can be obtained from `og property` using `self._og_search_thumbnail` `self._og_search_title` `self._og_search_desccription` | }, {
'url': 'https://news.cgtn.com/news/2021-06-06/China-Indonesia-vow-to-further-deepen-maritime-cooperation-10REvJCewCY/index.html',
'info_dict': {
'id': '10REvJCewCY',
'ext': 'mp4',
'title': 'China, Indonesia vow to further deepen mariti... | @@ -0,0 +1,71 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+)
+
+
+class CGTNIE(InfoExtractor):
+ _VALID_URL = r'https?://news\.cgtn\.com/news/[0-9]{4}-[0-9]{2}-[0-9]{2}/[a-zA-Z0-9-]+-(?P<id>[a-zA-Z... | yt_dlp/extractor/cgtn.py | 26 | Python | 0.5 | suggestion | 156 | 46 | 39 | false | [CGTN] Add new extractor | 981 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | chao813 |
'title': 'China, Indonesia vow to further deepen maritime cooperation',
'thumbnail': r're:^https?://.*\.png$',
'description': 'China and Indonesia vowed to upgrade their cooperation into the maritime sector and also for political security, economy, and cultural and people... | if `unified_timestamp` doesn't directly work, add the format to `utils.DATE_FORMATS` | 'ext': 'mp4',
'title': 'China, Indonesia vow to further deepen maritime cooperation',
'thumbnail': r're:^https?://.*\.png$',
'description': 'China and Indonesia vowed to upgrade their cooperation into the maritime sector and also for political security, ec... | @@ -0,0 +1,71 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+)
+
+
+class CGTNIE(InfoExtractor):
+ _VALID_URL = r'https?://news\.cgtn\.com/news/[0-9]{4}-[0-9]{2}-[0-9]{2}/[a-zA-Z0-9-]+-(?P<id>[a-zA-Z... | yt_dlp/extractor/cgtn.py | 26 | Python | 0.357 | style | 84 | 42 | 35 | false | [CGTN] Add new extractor | 981 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | chao813 |
{
'url': 'https://news.cgtn.com/news/2021-03-09/Up-and-Out-of-Poverty-Ep-1-A-solemn-promise-YuOUaOzGQU/index.html',
'info_dict': {
'id': 'YuOUaOzGQU',
'ext': 'mp4',
'title': 'Up and Out of Poverty Ep. 1: A solemn promise',
'... | add `skip_download` to the tests | 'url': 'https://news.cgtn.com/news/2021-03-09/Up-and-Out-of-Poverty-Ep-1-A-solemn-promise-YuOUaOzGQU/index.html',
'info_dict': {
'id': 'YuOUaOzGQU',
'ext': 'mp4',
'title': 'Up and Out of Poverty Ep. 1: A solemn promise',
'thumbnail'... | @@ -0,0 +1,71 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import datetime
+
+from .common import InfoExtractor
+from ..utils import (
+ unified_timestamp,
+)
+
+
+class CGTNIE(InfoExtractor):
+ _VALID_URL = r'https?://news\.cgtn\.com/news/[0-9]{4}-[0-9]{2}-[0-9]{2}/[a-zA-Z0-9-]+-(?P<id>[a-zA-Z... | yt_dlp/extractor/cgtn.py | 26 | Python | 0.214 | suggestion | 32 | 51 | 51 | false | [CGTN] Add new extractor | 981 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | chao813 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class StreamanityIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
_TEST = {
'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
'info_dict': {
... | Use try_get for these, especially for non essentials like description thumbnail and title and uploader | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class StreamanityIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
_TESTS = [{
'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
'md5': '6ab171e8d4a02ad... | @@ -0,0 +1,49 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class StreamanityIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
+ _TEST = {
+ 'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
+ ... | yt_dlp/extractor/streamanity.py | 26 | Python | 0.5 | suggestion | 102 | 50 | 51 | false | Streamanity extractor | 984 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | alerikaisattera |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class StreamanityIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
_TEST = {
'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
'info_dict': {
... | Also can you add a test where description is not empty? If it's big then you can write
'md5:md5hashofstring' instead of the whole string | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class StreamanityIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
_TESTS = [{
'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
'md5': '6ab171e8d4a02ad... | @@ -0,0 +1,49 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class StreamanityIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
+ _TEST = {
+ 'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
+ ... | yt_dlp/extractor/streamanity.py | 17 | Python | 0.5 | suggestion | 138 | 42 | 42 | false | Streamanity extractor | 984 | yt-dlp/yt-dlp | 132,642 | Python | Ashish0804 | alerikaisattera |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class StreamanityIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
_TEST = {
'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
'info_dict': {
... | ```suggestion
'thumbnail': 're:https://res\.cloudinary\.com/.+\.png',
``` | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class StreamanityIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
_TESTS = [{
'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
'md5': '6ab171e8d4a02ad... | @@ -0,0 +1,49 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class StreamanityIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
+ _TEST = {
+ 'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
+ ... | yt_dlp/extractor/streamanity.py | 15 | Python | 0.857 | suggestion | 87 | 40 | 40 | false | Streamanity extractor | 984 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
video_info = self._download_json('https://app.streamanity.com/api/video/{}'.format(video_id), video_id)
# All relevant & useful information
uploader = video_info['data']['video']['author_name']
description = video_info['data']['video']['description']
play_id = video_info['data']['... | ```suggestion
video_info = self._download_json(
f'https://app.streamanity.com/api/video/{video_id}', video_id)['data']['video']
formats = self._extract_m3u8_formats(
f'https://stream.mux.com/{video_id}.m3u8?token={video_info["token"]}',
video_id, ext='mp4',m3u8... | 'id': 'JktOUjSlfzTD',
'ext': 'mp4',
'title': 'Share data when you see it',
'thumbnail': r're:https://res\.cloudinary\.com/.+\.png',
'description': 'Reposting as data should be public and stored on blockchain',
'uploader': 'digitalcurrencydaily',
... | @@ -0,0 +1,49 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class StreamanityIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
+ _TEST = {
+ 'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
+ ... | yt_dlp/extractor/streamanity.py | 26 | Python | 1 | security | 721 | 27 | 29 | false | Streamanity extractor | 984 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
from .common import InfoExtractor
class StreamanityIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
_TEST = {
'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
'info_dict': {
'id': '9DFPTnuYi8f2',
'ext': 'mp4',
... | ```suggestion
video_id, ext='mp4', m3u8_id='hls')
``` |
from .common import InfoExtractor
class StreamanityIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
_TESTS = [{
'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
'md5': '6ab171e8d4a02ad5dcbff6bea44cf5a1',
'info_dict': {
'... | @@ -0,0 +1,39 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class StreamanityIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
+ _TEST = {
+ 'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
+ ... | yt_dlp/extractor/streamanity.py | 26 | Python | 0.857 | suggestion | 67 | 38 | 50 | false | Streamanity extractor | 984 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
'id': '9DFPTnuYi8f2',
'ext': 'mp4',
'title': 'Bitcoin vs The Lighting Network',
'thumbnail': r're:https://res\.cloudinary\.com/.+\.png',
'description': '',
'uploader': 'Tom Bombadil (Freddy78)',
}
}, {
'url': 'https://streamanit... | ```suggestion
'https://stream.mux.com/%s.m3u8?token=%s' % (video_info['play_id'], video_info['token']),
```
that was my mistake. this should fix it | 'info_dict': {
'id': '9DFPTnuYi8f2',
'ext': 'mp4',
'title': 'Bitcoin vs The Lighting Network',
'thumbnail': r're:https://res\.cloudinary\.com/.+\.png',
'description': '',
'uploader': 'Tom Bombadil (Freddy78)',
}
}, {
'ur... | @@ -0,0 +1,49 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class StreamanityIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)'
+ _TESTS = [{
+ 'url': 'https://streamanity.com/video/9DFPTnuYi8f2',
+ ... | yt_dlp/extractor/streamanity.py | 26 | Python | 1 | suggestion | 164 | 39 | 41 | false | Streamanity extractor | 984 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | alerikaisattera |
import re
from .common import InfoExtractor
from ..utils import ExtractorError, clean_html, int_or_none, try_get
from ..compat import compat_str
class DamtomoBaseIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
webpage, handle = self._download_webpage_handle(self._... | ```suggestion
data_dict = {
mobj.group('class'): re.sub(r'\s+', ' ', clean_html(mobj.group('value')))
for mobj in re.finditer(r'(?s)<(p|div)\s+class="(?P<class>[^" ]+?)">(?P<value>.+?)</\1>', webpage)}
``` |
import re
from .common import InfoExtractor
from ..utils import ExtractorError, clean_html, int_or_none, try_get, unified_strdate
from ..compat import compat_str
class DamtomoBaseIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
webpage, handle = self._download_webp... | @@ -0,0 +1,116 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, clean_html, int_or_none, try_get
+from ..compat import compat_str
+
+
+class DamtomoBaseIE(InfoExtractor):
+ def _real_extract(self, url):
+ video_... | yt_dlp/extractor/damtomo.py | 26 | Python | 1 | suggestion | 241 | 51 | 51 | false | [damtomo] add support for Damtomo service | 992 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import ExtractorError, clean_html, int_or_none, try_get
from ..compat import compat_str
class DamtomoBaseIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
... | ```suggestion
```
using /s* everywhere is already recommended practice | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import ExtractorError, clean_html, int_or_none, try_get, unified_strdate
from ..compat import compat_str
class DamtomoBaseIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._mat... | @@ -0,0 +1,116 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, clean_html, int_or_none, try_get
+from ..compat import compat_str
+
+
+class DamtomoBaseIE(InfoExtractor):
+ def _real_extract(self, url):
+ video_... | yt_dlp/extractor/damtomo.py | 21 | Python | 0.857 | suggestion | 72 | 46 | 46 | false | [damtomo] add support for Damtomo service | 992 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
data_dict['user_name'] = re.sub(r'\s*さん\s*$', '', data_dict['user_name'])
title = data_dict['song_title']
stream_tree = self._download_xml(
self._DKML_XML_URL % video_id, video_id, note='Requesting stream information', encoding='sjis',
# doing this has no problem since t... | dont pass m3u8 url directly. parse and sort the formats |
stream_tree = self._download_xml(
self._DKML_XML_URL % video_id, video_id, note='Requesting stream information', encoding='sjis',
# doing this has no problem since there is no character outside ASCII,
# and never likely to happen in the future
transform_source=la... | @@ -0,0 +1,116 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, clean_html, int_or_none, try_get
+from ..compat import compat_str
+
+
+class DamtomoBaseIE(InfoExtractor):
+ def _real_extract(self, url):
+ video_... | yt_dlp/extractor/damtomo.py | 26 | Python | 0.143 | style | 55 | 51 | 51 | false | [damtomo] add support for Damtomo service | 992 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
for mobj in re.finditer(r'(?s)<(p|div)\s+class="(?P<class>[^" ]+?)">(?P<value>.+?)</\1>', webpage)}
# since videos do not have title, give the name of song instead
data_dict['user_name'] = re.sub(r'\s*さん\s*$', '', data_dict['user_name'])
title = data_dict.get('song_title')
... | ```suggestion
'upload_date': unified_strdate(self._search_regex(r'(\d{4}/\d{2}/\d{2})', data_dict.get('date'), 'upload_date', default=None)),
``` | for mobj in re.finditer(r'(?s)<(p|div)\s+class="(?P<class>[^" ]+?)">(?P<value>.+?)</\1>', webpage)}
# since videos do not have title, give the name of song instead
data_dict['user_name'] = re.sub(r'\s*さん\s*$', '', data_dict['user_name'])
title = data_dict.get('song_title')
... | @@ -0,0 +1,114 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, clean_html, int_or_none, try_get, unified_strdate
+from ..compat import compat_str
+
+
+class DamtomoBaseIE(InfoExtractor):
+ def _real_extract(self, url)... | yt_dlp/extractor/damtomo.py | 26 | Python | 1 | suggestion | 159 | 51 | 51 | false | [damtomo] add support for Damtomo service | 992 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
raise ExtractorError('You are rate-limited. Try again later.', expected=True)
if '<h2>予期せぬエラーが発生しました。</h2>' in webpage:
raise ExtractorError('There is an error on server-side. Try again later.', expected=True)
description = self._search_regex(r'(?m)<div id="public_comment">\s*<p... | ```suggestion
formats = self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4')
``` | raise ExtractorError('You are rate-limited. Try again later.', expected=True)
if '<h2>予期せぬエラーが発生しました。</h2>' in webpage:
raise ExtractorError('There is an error on server-side. Try again later.', expected=True)
description = self._search_regex(r'(?m)<div id="public_comment">\s*<p... | @@ -0,0 +1,114 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import ExtractorError, clean_html, int_or_none, try_get, unified_strdate
+from ..compat import compat_str
+
+
+class DamtomoBaseIE(InfoExtractor):
+ def _real_extract(self, url)... | yt_dlp/extractor/damtomo.py | 26 | Python | 0.857 | refactor | 95 | 51 | 51 | false | [damtomo] add support for Damtomo service | 992 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Lesmiscore |
import base64
import hashlib
import json
import random
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
)
from ..utils import (
ExtractorError,
float_or_none,
orderedSet,
str_or_none,
try_get,
)
class GloboIE(InfoExtractor):
_VALID_URL = r'(?:globo:|https?:/... | md5s that keep changing are useless to test for. `skip_download` the tests |
import base64
import hashlib
import json
import random
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
)
from ..utils import (
ExtractorError,
float_or_none,
orderedSet,
str_or_none,
try_get,
)
class GloboIE(InfoExtractor):
_VALID_URL = r'(?:globo:|https?:/... | @@ -26,18 +25,18 @@ class GloboIE(InfoExtractor):
_NETRC_MACHINE = 'globo'
_TESTS = [{
'url': 'http://g1.globo.com/carros/autoesporte/videos/t/exclusivos-do-g1/v/mercedes-benz-gla-passa-por-teste-de-colisao-na-europa/3607726/',
- 'md5': 'b3ccc801f75cd04a914d51dadb83a78d',
+ 'md5': 'a0e8... | yt_dlp/extractor/globo.py | 26 | Python | 0.429 | suggestion | 74 | 51 | 51 | false | Fix GloboIE. | 994 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
raise ExtractorError(
'%s returned error: %s' % (self.IE_NAME, message), expected=True)
hash_code = security_hash[:2]
padding = '%010d' % random.randint(1, 10000000000)
if hash_code in ('04', '14'):
received_time = security_hash[3:13]
... | ```suggestion
formats.extend(self._extract_m3u8_formats(
signed_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False))
```
The intends are confusing. The params are inside `_extract_m3u8_formats` but are aligned to the `formats.extend`. weird that flake8 doesnt catch ... | security_hash = security['source']['token']
if not security_hash:
message = security.get('message')
if message:
raise ExtractorError(
'%s returned error: %s' % (self.IE_NAME, message), expected=True)
hash_code = security_hash[:2]
... | @@ -102,73 +77,66 @@ def _real_extract(self, url):
title = video['title']
formats = []
+ security = self._download_json(
+ 'https://playback.video.globo.com/v1/video-session', video_id, 'Downloading security hash for %s' % video_id,
+ headers={'content-type': 'applicatio... | yt_dlp/extractor/globo.py | 26 | Python | 0.857 | refactor | 324 | 51 | 51 | false | Fix GloboIE. | 994 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | Ashish0804 |
'client': {
'version': '4.1',
'id': 'browser'
},
'variantAvailability': {
'featureset': {
'min': featureset,
'max': featureset
},
... | Better to use `and` to make it clear both `platform_tag_subs` and `featureset_subs` are needed for API call | 'client': {
'version': '4.1',
'id': 'browser'
},
'variantAvailability': {
'featureset': {
'min': featureset,
'max': featureset
},
... | @@ -113,11 +113,16 @@ def _call_api(self, video_id, playlist_url, headers, platform_tag, featureset, f
def _get_subtitles(self, video_id, variants, ios_playlist_url, headers, *args, **kwargs):
subtitles = {}
- platform_tag_subs, featureset_subs = next(
- ((platform_tag, featureset)
- ... | yt_dlp/extractor/itv.py | 26 | Python | 0.571 | suggestion | 107 | 51 | 51 | false | [itv] Prefer last matching featureset | 1,001 | yt-dlp/yt-dlp | 132,642 | Python | sleaux-meaux | coletdjnz |
'name': 'Windows NT',
'version': '6.1',
'type': 'desktop'
}
},
'client': {
'version': '4.1',
'id': 'browser'
},
'variantAvai... | why not just
```diff
platform_tag_subs, featureset_subs = next(
((platform_tag, featureset)
- for platform_tag, featuresets in variants.items() for featureset in featuresets
+ for platform_tag, featuresets in reversed(variants.items()) for featureset in featuresets
... | 'name': 'Windows NT',
'version': '6.1',
'type': 'desktop'
}
},
'client': {
'version': '4.1',
'id': 'browser'
},
'variantAvai... | @@ -113,12 +113,17 @@ def _call_api(self, video_id, playlist_url, headers, platform_tag, featureset, f
def _get_subtitles(self, video_id, variants, ios_playlist_url, headers, *args, **kwargs):
subtitles = {}
- platform_tag_subs, featureset_subs = next(
- ((platform_tag, featureset)
- ... | yt_dlp/extractor/itv.py | 26 | Python | 0.857 | suggestion | 604 | 51 | 51 | false | [itv] Prefer last matching featureset | 1,001 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
determine_ext,
dict_get,
int_or_none,
unescapeHTML,
)
class ATVAtIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?atv\.at/(?:[^/]+/){2}(?P<id>[dv]\d+)'
_TESTS = [{
'url'... | use better var names and remove comments | # coding: utf-8
from __future__ import unicode_literals
import datetime
from .common import InfoExtractor
from ..utils import (
float_or_none,
jwt_encode_hs256,
try_get,
)
class ATVAtIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?atv\.at/tv/(?:[^/]+/){2,3}(?P<id>.*)'
_TESTS = [{
'... | @@ -1,74 +1,194 @@
# coding: utf-8
from __future__ import unicode_literals
+# import jwt
+import json
+import base64
+import hmac
+import hashlib
+import datetime
+
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- dict_get,
- int_or_none,
- unescapeHTML,
+ float_or_none,
... | yt_dlp/extractor/atvat.py | 26 | Python | 0.143 | suggestion | 40 | 75 | 107 | false | ATV.at: fix extractor using the new jwt JSON Web Token | 1,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NeroBurner |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
determine_ext,
dict_get,
int_or_none,
unescapeHTML,
)
class ATVAtIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?atv\.at/(?:[^/]+/){2}(?P<id>[dv]\d+)'
_TESTS = [{
'url'... | Most comments (including this) are unnecessary. Anyone can see that we are creating the jwt token from the below code `jwt_token = jwt_encode_hs256(...)`. There is no need to explain it again | # coding: utf-8
from __future__ import unicode_literals
import datetime
from .common import InfoExtractor
from ..utils import (
float_or_none,
jwt_encode_hs256,
try_get,
)
class ATVAtIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?atv\.at/tv/(?:[^/]+/){2,3}(?P<id>.*)'
_TESTS = [{
'... | @@ -1,74 +1,194 @@
# coding: utf-8
from __future__ import unicode_literals
+# import jwt
+import json
+import base64
+import hmac
+import hashlib
+import datetime
+
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- dict_get,
- int_or_none,
- unescapeHTML,
+ float_or_none,
... | yt_dlp/extractor/atvat.py | 26 | Python | 0.5 | suggestion | 191 | 75 | 107 | false | ATV.at: fix extractor using the new jwt JSON Web Token | 1,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NeroBurner |
def _process_entry(self, entry):
part_id = entry.get('id')
if not part_id:
return
formats = []
for source in entry.get('sources', []):
formats.extend(self._process_source_entry(source, part_id) or [])
self._sort_formats(formats)
return {
... | ```suggestion
playlist_id, playlist = next(videos['data'].items())
``` | if not source_url:
continue
if protocol == 'dash':
formats.extend(self._extract_mpd_formats(
source_url, clip_id, mpd_id=protocol, fatal=False))
elif protocol == 'hls':
formats.extend(self._extract_m3u8_formats(
... | @@ -1,74 +1,105 @@
# coding: utf-8
from __future__ import unicode_literals
+import json
+import datetime
+
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- dict_get,
- int_or_none,
- unescapeHTML,
+ float_or_none,
+ jwt_encode_hs256
)
class ATVAtIE(InfoExtractor):... | yt_dlp/extractor/atvat.py | 26 | Python | 0.571 | suggestion | 80 | 36 | 51 | false | ATV.at: fix extractor using the new jwt JSON Web Token | 1,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NeroBurner |
for source in entry.get('sources', []):
formats.extend(self._process_source_entry(source, part_id) or [])
self._sort_formats(formats)
return {
'id': part_id,
'title': entry.get('title'),
'duration': int_or_none(entry.get('duration')),
... | ```suggestion
entries = [
self._extract_video_info(url, video['id'], contentResource[video['id']], video)
for video in playlist]
```
You can also change the signature of `_extract_video_info` to make this even simpler | formats.extend(self._extract_m3u8_formats(
source_url, clip_id, 'mp4', 'm3u8_native',
m3u8_id=protocol, fatal=False))
else:
formats.append({
'url': source_url,
'format_id': protocol,
... | @@ -1,74 +1,105 @@
# coding: utf-8
from __future__ import unicode_literals
+import json
+import datetime
+
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- dict_get,
- int_or_none,
- unescapeHTML,
+ float_or_none,
+ jwt_encode_hs256
)
class ATVAtIE(InfoExtractor):... | yt_dlp/extractor/atvat.py | 26 | Python | 0.857 | refactor | 256 | 30 | 51 | false | ATV.at: fix extractor using the new jwt JSON Web Token | 1,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NeroBurner |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
determine_ext,
dict_get,
int_or_none,
unescapeHTML,
)
class ATVAtIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?atv\.at/(?:[^/]+/){2}(?P<id>[dv]\d+)'
_TESTS = [{
'url'... | ```suggestion
json_data = self._parse_json(self._search_regex(
r'<script id="state" type="text/plain">(.*)</script>',
webpage, 'json_data'))
``` |
return {
'id': clip_id,
'title': content.get('title'),
'duration': float_or_none(content.get('duration')),
'series': content.get('tvShowTitle'),
'formats': formats,
}
def _real_extract(self, url):
video_id = self._match_id(url)
... | @@ -1,74 +1,105 @@
# coding: utf-8
from __future__ import unicode_literals
+import json
+import datetime
+
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- dict_get,
- int_or_none,
- unescapeHTML,
+ float_or_none,
+ jwt_encode_hs256
)
class ATVAtIE(InfoExtractor):... | yt_dlp/extractor/atvat.py | 26 | Python | 0.857 | suggestion | 180 | 75 | 51 | false | ATV.at: fix extractor using the new jwt JSON Web Token | 1,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NeroBurner |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
determine_ext,
dict_get,
int_or_none,
unescapeHTML,
)
class ATVAtIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?atv\.at/(?:[^/]+/){2}(?P<id>[dv]\d+)'
_TESTS = [{
'url'... | ```suggestion
return self._extract_playlist(url, contentResource, videos)
``` | payload = {
'content_ids': {
content_id: content_ids,
},
'secure_delivery': True,
'iat': int(time_of_request.timestamp()),
'nbf': int(not_before.timestamp()),
'exp': int(expire.timestamp()),
}
jwt_token = jwt... | @@ -1,74 +1,105 @@
# coding: utf-8
from __future__ import unicode_literals
+import json
+import datetime
+
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- dict_get,
- int_or_none,
- unescapeHTML,
+ float_or_none,
+ jwt_encode_hs256
)
class ATVAtIE(InfoExtractor):... | yt_dlp/extractor/atvat.py | 26 | Python | 0.643 | refactor | 87 | 75 | 28 | false | ATV.at: fix extractor using the new jwt JSON Web Token | 1,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NeroBurner |
return
formats = []
for source in entry.get('sources', []):
formats.extend(self._process_source_entry(source, part_id) or [])
self._sort_formats(formats)
return {
'id': part_id,
'title': entry.get('title'),
'duration': int_or_n... | are you sure this is a playlist and not a multi_video? The tests seem to imply that | source_url, clip_id, mpd_id=protocol, fatal=False))
elif protocol == 'hls':
formats.extend(self._extract_m3u8_formats(
source_url, clip_id, 'mp4', 'm3u8_native',
m3u8_id=protocol, fatal=False))
else:
form... | @@ -1,74 +1,101 @@
# coding: utf-8
from __future__ import unicode_literals
+import datetime
+
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- dict_get,
- int_or_none,
- unescapeHTML,
+ float_or_none,
+ jwt_encode_hs256,
+ try_get,
)
class ATVAtIE(InfoExtractor... | yt_dlp/extractor/atvat.py | 26 | Python | 0.214 | suggestion | 83 | 32 | 51 | false | ATV.at: fix extractor using the new jwt JSON Web Token | 1,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NeroBurner |
elif protocol == 'hls':
formats.extend(self._extract_m3u8_formats(
source_url, clip_id, 'mp4', 'm3u8_native',
m3u8_id=protocol, fatal=False))
else:
formats.append({
'url': source_url,
... | ```suggestion
json_data = self._parse_json(
self._search_regex(r'<script id="state" type="text/plain">(.*)</script>', webpage, 'json_data'),
video_id=video_id)
``` | elif protocol == 'hls':
formats.extend(self._extract_m3u8_formats(
source_url, clip_id, 'mp4', 'm3u8_native',
m3u8_id=protocol, fatal=False))
else:
formats.append({
'url': source_url,
... | @@ -1,74 +1,106 @@
# coding: utf-8
from __future__ import unicode_literals
+import datetime
+
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- dict_get,
- int_or_none,
- unescapeHTML,
+ float_or_none,
+ jwt_encode_hs256,
+ try_get,
)
class ATVAtIE(InfoExtractor... | yt_dlp/extractor/atvat.py | 26 | Python | 0.857 | suggestion | 199 | 51 | 51 | false | ATV.at: fix extractor using the new jwt JSON Web Token | 1,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NeroBurner |
formats.append({
'url': source_url,
'format_id': protocol,
})
self._sort_formats(formats)
return {
'id': clip_id,
'title': content.get('title'),
'duration': float_or_none(content.get('duration'))... | ```suggestion
content_ids = [{'id': id, 'subclip_start': content['start'], 'subclip_end': content['end']}
for id, content in enumerate(contentResource)]
``` | formats.append({
'url': source_url,
'format_id': protocol,
})
self._sort_formats(formats)
return {
'id': clip_id,
'title': content.get('title'),
'duration': float_or_none(content.get('duration'))... | @@ -1,74 +1,106 @@
# coding: utf-8
from __future__ import unicode_literals
+import datetime
+
from .common import InfoExtractor
from ..utils import (
- determine_ext,
- dict_get,
- int_or_none,
- unescapeHTML,
+ float_or_none,
+ jwt_encode_hs256,
+ try_get,
)
class ATVAtIE(InfoExtractor... | yt_dlp/extractor/atvat.py | 26 | Python | 0.714 | suggestion | 190 | 51 | 51 | false | ATV.at: fix extractor using the new jwt JSON Web Token | 1,012 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | NeroBurner |
try:
out, content_type = _multipart_encode_impl(data, boundary)
break
except ValueError:
if has_specified_boundary:
raise
boundary = None
return out, content_type
def dict_get(d, key_or_keys, default=None, skip_false_values=True):
... | unnecessary. You can either use try_get or traverse_obj | boundary = '---------------' + str(random.randrange(0x0fffffff, 0xffffffff))
try:
out, content_type = _multipart_encode_impl(data, boundary)
break
except ValueError:
if has_specified_boundary:
raise
boundary = None
return ... | @@ -4299,6 +4298,11 @@ def dict_get(d, key_or_keys, default=None, skip_false_values=True):
return default
return d.get(key_or_keys, default)
+def list_get(list, i):
+ try:
+ return list[i]
+ except IndexError:
+ return None | yt_dlp/utils.py | 26 | Python | 0.286 | suggestion | 55 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
},
'skip': 'Geo-restricted to Canada',
}, {
# with clipId, feed only available via tpfeed.cbc.ca
'url': 'http://www.cbc.ca/archives/entry/1978-robin-williams-freestyles-on-90-minutes-live',
'md5': '0274a90b51a9b4971fe005c63f592f12',
'info_dict': {
'id': '2... | If removing this because the link isnt working, add a new test for `with clipId, feed available via tpfeed.cbc.ca and feed.theplatform.com` | 'skip': 'Geo-restricted to Canada',
}, {
# with clipId, feed available via tpfeed.cbc.ca and feed.theplatform.com
'url': 'http://www.cbc.ca/22minutes/videos/22-minutes-update/22-minutes-update-episode-4',
'md5': '162adfa070274b144f4fdc3c3b8207db',
'info_dict': {
'... | @@ -46,19 +35,6 @@ class CBCIE(InfoExtractor):
'uploader': 'CBCC-NEW',
},
'skip': 'Geo-restricted to Canada',
- }, {
- # with clipId, feed available via tpfeed.cbc.ca and feed.theplatform.com
- 'url': 'http://www.cbc.ca/22minutes/videos/22-minutes-update/22-minutes-update... | yt_dlp/extractor/cbc.py | 26 | Python | 0.571 | suggestion | 139 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
class CBCGemIE(InfoExtractor):
IE_NAME = 'gem.cbc.ca'
_VALID_URL = r'https?://gem\.cbc\.ca/media/(?P<id>[0-9a-z-]+/[0-9a-z-]+)'
_TESTS = [{
# geo-restricted to Canada, bypassable
# This is a normal, public, TV show video
'url': 'https://gem.cbc.ca/media/schitts-creek/s06e01',
... | ```suggestion
'params': {'format': 'bv'},
``` | }]
def _real_extract(self, url):
video_id = self._match_id(url)
return {
'_type': 'url_transparent',
'ie_key': 'ThePlatform',
'url': smuggle_url(
'http://link.theplatform.com/s/ExhSPC/media/guid/2655402169/%s?mbr=true&formats=MPEG4,FLV,MP3' % ... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.571 | suggestion | 55 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
'episode_number': 1,
'episode_id': 'schitts-creek/s06e01',
},
'params': {'format': 'bv'}, # No format has audio and video combined
'skip': 'Geo-restricted to Canada',
}, {
# geo-restricted to Canada, bypassable
# This video requires an account in the ... | ```suggestion
'params': {'format': 'bv'},
``` | 'md5': '93dbb31c74a8e45b378cf13bd3f6f11e',
'info_dict': {
'id': 'schitts-creek/s06e01',
'ext': 'mp4',
'title': 'Smoke Signals',
'description': 'md5:929868d20021c924020641769eb3e7f1',
'thumbnail': 'https://images.radio-canada.ca/v1/synps-cbc/epi... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.571 | suggestion | 55 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
'skip': 'Geo-restricted to Canada',
}, {
# geo-restricted to Canada, bypassable
# This video requires an account in the browser, but works fine in yt-dlp
'url': 'https://gem.cbc.ca/media/schitts-creek/s01e01',
'md5': '297a9600f554f2258aed01514226a697',
'info_dict': {
... | ```suggestion
# TV show playlist, all public videos
``` | 'title': 'Smoke Signals',
'description': 'md5:929868d20021c924020641769eb3e7f1',
'thumbnail': 'https://images.radio-canada.ca/v1/synps-cbc/episode/perso/cbc_schitts_creek_season_06e01_thumbnail_v01.jpg?im=Resize=(Size)',
'duration': 1314,
'categories': ['comed... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.571 | suggestion | 65 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
'episode': 'The Cup Runneth Over',
'episode_id': 'schitts-creek/s01e01',
'duration': 1309,
'categories': ['comedy'],
},
'params': {'format': 'bv'}, # No format has audio and video combined
'skip': 'Geo-restricted to Canada',
}, {
# geo... | get rid of constants that are used only once | # This video requires an account in the browser, but works fine in yt-dlp
'url': 'https://gem.cbc.ca/media/schitts-creek/s01e01',
'md5': '297a9600f554f2258aed01514226a697',
'info_dict': {
'id': 'schitts-creek/s01e01',
'ext': 'mp4',
'title': 'The Cup Ru... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.143 | suggestion | 44 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
'categories': ['comedy'],
},
'params': {'format': 'bv'}, # No format has audio and video combined
'skip': 'Geo-restricted to Canada',
}, {
# geo-restricted to Canada, bypassable
# TV show playlist, all public videos at time of coding (2021-09)
'url': 'htt... | Set this as `display_id` in the infodict | 'info_dict': {
'id': 'schitts-creek/s01e01',
'ext': 'mp4',
'title': 'The Cup Runneth Over',
'description': 'md5:9bca14ea49ab808097530eb05a29e797',
'thumbnail': 'https://images.radio-canada.ca/v1/synps-cbc/episode/perso/cbc_schitts_creek_season_01e01_th... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.214 | suggestion | 40 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
'skip': 'Geo-restricted to Canada',
}, {
# geo-restricted to Canada, bypassable
# TV show playlist, all public videos at time of coding (2021-09)
'url': 'https://gem.cbc.ca/media/schitts-creek/s06',
'playlist_count': 16,
'info_dict': {
'id': 'schitts-creek... | having a massive `if` is a sign that the 2 urls is probly better handled by 2 seperate extractors | 'title': 'The Cup Runneth Over',
'description': 'md5:9bca14ea49ab808097530eb05a29e797',
'thumbnail': 'https://images.radio-canada.ca/v1/synps-cbc/episode/perso/cbc_schitts_creek_season_01e01_thumbnail_v01.jpg?im=Resize=(Size)',
'series': 'Schitt\'s Creek',
'se... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.571 | refactor | 97 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
'thumbnail': thumbnail,
'series': show_info.get('title'),
'season_number': season_info.get('season'),
'season': season_info['title'],
}
elif re.fullmatch(self._VIDEO_ID, url_id) is None:
# Not a playlist or video
... | Error message should be like `IE_NAME said: code - message`. Also set `expected=True` | 'duration': video_info.get('duration'),
'categories': [video_info.get('category')],
'formats': formats,
'release_timestamp': video_info.get('airDate'),
'timestamp': video_info.get('availableDate'),
}
class CBCGemPlaylistIE(InfoExtractor):
IE_NAME... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.571 | suggestion | 85 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
m3u8_info = self._download_json(video_info['playSession']['url'], video_id)
if m3u8_info.get('errorCode') == 1:
# errorCode 1 means geo-blocked
self.raise_geo_restricted(countries=['CA'])
elif m3u8_info.get('errorCode') not in [35, 0, None]:
# 35 means media ... | retries should obey `extractor_retries` param. See tiktok.py for example code | 'url': 'https://gem.cbc.ca/media/schitts-creek/s06',
'playlist_count': 16,
'info_dict': {
'id': 'schitts-creek/s06',
'title': 'Season 6',
'description': 'md5:6a92104a56cbeb5818cc47884d4326a2',
},
'skip': 'Geo-restricted to Canada',
}]
_... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.429 | refactor | 77 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
# errorCode 1 means geo-blocked
self.raise_geo_restricted(countries=['CA'])
elif m3u8_info.get('errorCode') not in [35, 0, None]:
# 35 means media unavailable, which is handled below. 0 means no
# error. None is there just in case. Any other errorCode can't be
... | if there are no subs, use `_extract_m3u8_formats`. If there are, dont discard it | 'id': 'schitts-creek/s06',
'title': 'Season 6',
'description': 'md5:6a92104a56cbeb5818cc47884d4326a2',
},
'skip': 'Geo-restricted to Canada',
}]
_API_BASE = 'https://services.radio-canada.ca/ott/cbc-api/v2/shows/'
def _real_extract(self, url):
mat... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.429 | refactor | 80 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
self._sort_formats(formats)
return {
'id': video_id,
'title': video_info['title'],
'description': video_info.get('description'),
'thumbnail': video_info.get('image'),
'series': video_info.get('series'),
'season_number': video_info... | add a test that works, but then add something like `'skip': 'Live ended'` | '_type': 'playlist',
'entries': episodes,
'id': season_id,
'title': season_info['title'],
'description': season_info.get('description'),
'thumbnail': thumbnail,
'series': show_info.get('title'),
'season_number': season_info.... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.357 | suggestion | 73 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
def _real_extract(self, url):
video_id = self._match_id(url)
live_info = self._download_json(self._API, video_id)['entries']
video_info = None
for stream in live_info:
if stream.get('guid') == video_id:
video_info = stream
if video_info is None:
... | ```suggestion
return {
'_type': 'url_transparent',
'ie_key': 'ThePlatform',
'url': video_info['content'][0]['url'],
'id': video_id,
'title': video_info.get('title'),
'description': video_info.get('description'),
'tags': ... | # It's unclear where the chars at the end come from, but they appear to be
# constant. Might need updating in the future.
_API = 'https://tpfeed.cbc.ca/f/ExhSPC/t_t3UKJR6MAT'
def _real_extract(self, url):
video_id = self._match_id(url)
live_info = self._download_json(self._API, video_id... | @@ -209,289 +185,243 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.929 | suggestion | 473 | 28 | 30 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
'ext': 'mp4',
'timestamp': 1492106160,
'upload_date': '20170413',
'uploader': 'CBCC-NEW',
},
'skip': 'Live might have ended',
}
# It's unclear where the chars at the end come from, but they appear to be
# constant. Might need updating in the f... | use single quotes and put parens at end of line. Dont make me repeat this. This issue exists in multiple places | }
# It's unclear where the chars at the end come from, but they appear to be
# constant. Might need updating in the future.
_API = 'https://tpfeed.cbc.ca/f/ExhSPC/t_t3UKJR6MAT'
def _real_extract(self, url):
video_id = self._match_id(url)
live_info = self._download_json(self._API, v... | @@ -209,289 +198,239 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.429 | suggestion | 111 | 39 | 32 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
'release_timestamp': video_info.get('airDate'),
'timestamp': video_info.get('availableDate'),
}
class CBCGemPlaylistIE(InfoExtractor):
IE_NAME = 'gem.cbc.ca:playlist'
_VALID_URL = r'https?://gem\.cbc\.ca/media/(?P<id>([0-9a-z-]+)/s([0-9]+))'
_TESTS = [{
# geo-restri... | name the group. same for season | IE_NAME = 'gem.cbc.ca:playlist'
_VALID_URL = r'https?://gem\.cbc\.ca/media/(?P<id>(?P<show>[0-9a-z-]+)/s(?P<season>[0-9]+))/?(?:[?#]|$)'
_TESTS = [{
# geo-restricted to Canada, bypassable
# TV show playlist, all public videos
'url': 'https://gem.cbc.ca/media/schitts-creek/s06',
... | @@ -209,289 +198,239 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.071 | suggestion | 31 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
class CBCGemPlaylistIE(InfoExtractor):
IE_NAME = 'gem.cbc.ca:playlist'
_VALID_URL = r'https?://gem\.cbc\.ca/media/(?P<id>([0-9a-z-]+)/s([0-9]+))'
_TESTS = [{
# geo-restricted to Canada, bypassable
# TV show playlist, all public videos
'url': 'https://gem.cbc.ca/media/schitts-creek/... | while this is correct, the normal practice is
```suggestion
season_info = try_get(show_info, lambda x: x['seasons'][season - 1])
``` | # geo-restricted to Canada, bypassable
# TV show playlist, all public videos
'url': 'https://gem.cbc.ca/media/schitts-creek/s06',
'playlist_count': 16,
'info_dict': {
'id': 'schitts-creek/s06',
'title': 'Season 6',
'description': 'md5:6a92104a5... | @@ -209,289 +198,239 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.714 | suggestion | 144 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
if m3u8_info.get('errorCode') == 1:
# errorCode 1 means geo-blocked
self.raise_geo_restricted(countries=['CA'])
elif m3u8_info.get('errorCode') not in [35, 0, None]:
# 35 means media unavailable, which is handled below. 0 means no
# error. None is there j... | (untested)
```suggestion
last_error, attempt, retries = None, -1, self.get_param('extractor_retries', 3)
while attempt < retries:
attempt += 1
if last_error:
self.report_warning('%s. Retrying ...' % last_error)
m3u8_info = self._download_json(
... | last_error = None
attempt = -1
retries = self.get_param('extractor_retries', 15)
while attempt < retries:
attempt += 1
if last_error:
self.report_warning('%s. Retrying ...' % last_error)
m3u8_info = self._download_json(
... | @@ -209,289 +198,239 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 1 | refactor | 994 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
format['preference'] = -2
self._sort_formats(formats)
return {
'id': video_id,
'title': video_info['title'],
'description': video_info.get('description'),
'thumbnail': video_info.get('image'),
'series': video_info.get('ser... | ```suggestion
_VALID_URL = r'https?://gem\.cbc\.ca/media/(?P<id>(?P<show>[0-9a-z-]+)/s(?P<season>[0-9]+))/?(?:[?#]|$)'
``` | format['preference'] = -2
self._sort_formats(formats)
return {
'id': video_id,
'title': video_info['title'],
'description': video_info.get('description'),
'thumbnail': video_info.get('image'),
'series': video_info.get('ser... | @@ -209,289 +198,232 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.714 | suggestion | 128 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | makew0rld |
video_id = self._match_id(url)
return {
'_type': 'url_transparent',
'ie_key': 'ThePlatform',
'url': smuggle_url(
'http://link.theplatform.com/s/ExhSPC/media/guid/2655402169/%s?mbr=true&formats=MPEG4,FLV,MP3' % video_id, {
'force_smi... | The original comment above says the geo-restriction is bypassable? |
class CBCGemIE(InfoExtractor):
IE_NAME = 'gem.cbc.ca'
_VALID_URL = r'https?://gem\.cbc\.ca/media/(?P<id>[0-9a-z-]+/s[0-9]+[a-z][0-9]+)'
_TESTS = [{
# geo-restricted to Canada, bypassable
# This is a normal, public, TV show video
'url': 'https://gem.cbc.ca/media/schitts-creek/s06e01'... | @@ -209,289 +198,232 @@ def _real_extract(self, url):
}
-class CBCWatchBaseIE(InfoExtractor):
- _device_id = None
- _device_token = None
- _API_BASE_URL = 'https://api-cbc.cloud.clearleap.com/cloffice/client/'
- _NS_MAP = {
- 'media': 'http://search.yahoo.com/mrss/',
- 'clearleap'... | yt_dlp/extractor/cbc.py | 26 | Python | 0.214 | question | 66 | 51 | 51 | false | Fix CBC Gem | 1,013 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | makew0rld |
view_count_text = self._get_text(renderer, 'viewCountText') or ''
view_count = str_to_int(self._search_regex(
r'^([\d,]+)', re.sub(r'\s', '', view_count_text),
'view count', default=None))
uploader = self._get_text(renderer, 'ownerText', 'shortBylineText')
channe... | Don't set timestamp, only upload date. Since the video extractor doesn't return its own timestamp, this will be propagated | renderer, 'lengthText', ('thumbnailOverlays', ..., 'thumbnailOverlayTimeStatusRenderer', 'text')))
view_count_text = self._get_text(renderer, 'viewCountText') or ''
view_count = str_to_int(self._search_regex(
r'^([\d,]+)', re.sub(r'\s', '', view_count_text),
'view cou... | @@ -763,6 +793,13 @@ def _extract_video(self, renderer):
'duration': duration,
'view_count': view_count,
'uploader': uploader,
+ 'channel_id': channel_id, # TODO: validate?
+ 'timestamp': timestamp, | yt_dlp/extractor/youtube.py | 26 | Python | 0.429 | refactor | 122 | 51 | 51 | false | [youtube:tab] Extract more metadata for feeds/channels/playlists | 1,018 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
uploader = self._get_text(renderer, 'ownerText', 'shortBylineText')
channel_id = traverse_obj(
renderer, ('shortBylineText', 'runs', ..., 'navigationEndpoint', 'browseEndpoint', 'browseId'), expected_type=str, get_all=False)
timestamp, time_text = self._extract_time_text(renderer, '... | u can just add `live_status` and the rest will be auto-populated | 'view count', default=None))
uploader = self._get_text(renderer, 'ownerText', 'shortBylineText')
channel_id = traverse_obj(
renderer, ('shortBylineText', 'runs', ..., 'navigationEndpoint', 'browseEndpoint', 'browseId'), expected_type=str, get_all=False)
timestamp, time_t... | @@ -763,6 +793,13 @@ def _extract_video(self, renderer):
'duration': duration,
'view_count': view_count,
'uploader': uploader,
+ 'channel_id': channel_id, # TODO: validate?
+ 'timestamp': timestamp,
+ 'upload_date': upload_date,
+ 'is_l... | yt_dlp/extractor/youtube.py | 26 | Python | 0.357 | suggestion | 64 | 51 | 51 | false | [youtube:tab] Extract more metadata for feeds/channels/playlists | 1,018 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
def _get_innertube_host(self, client='web'):
return INNERTUBE_CLIENTS[client]['INNERTUBE_HOST']
def _ytcfg_get_safe(self, ytcfg, getter, expected_type=None, default_client='web'):
# try_get but with fallback to default ytcfg client values when present
_func = lambda y: try_get(y, getter... | if `client` doesnt already exist, this won't do anything. Is that what you intended? | def _get_innertube_host(self, client='web'):
return INNERTUBE_CLIENTS[client]['INNERTUBE_HOST']
def _ytcfg_get_safe(self, ytcfg, getter, expected_type=None, default_client='web'):
# try_get but with fallback to default ytcfg client values when present
_func = lambda y: try_get(y, getter... | @@ -393,23 +407,10 @@ def _extract_api_key(self, ytcfg=None, default_client='web'):
return self._ytcfg_get_safe(ytcfg, lambda x: x['INNERTUBE_API_KEY'], compat_str, default_client)
def _extract_context(self, ytcfg=None, default_client='web'):
- _get_context = lambda y: try_get(y, lambda x: x['INN... | yt_dlp/extractor/youtube.py | 26 | Python | 0.357 | question | 84 | 51 | 51 | false | [youtube:tab] Extract more metadata for feeds/channels/playlists | 1,018 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
r'^([\d,]+)', re.sub(r'\s', '', view_count_text),
'view count', default=None))
uploader = self._get_text(renderer, 'ownerText', 'shortBylineText')
channel_id = traverse_obj(
renderer, ('shortBylineText', 'runs', ..., 'navigationEndpoint', 'browseEndpoint', 'browseId'... | ```suggestion
'live_status': ('is_upcoming' if scheduled_timestamp is not None
else 'was_live' if any(i in time_text.lower() for i in ('streamed', 'premiered'))
else 'is_live' if overlay_style is not None and overlay_style == 'LIVE' or 'live now' in... | r'^([\d,]+)', re.sub(r'\s', '', view_count_text),
'view count', default=None))
uploader = self._get_text(renderer, 'ownerText', 'shortBylineText')
channel_id = traverse_obj(
renderer, ('shortBylineText', 'runs', ..., 'navigationEndpoint', 'browseEndpoint', 'browseId'... | @@ -763,6 +793,13 @@ def _extract_video(self, renderer):
'duration': duration,
'view_count': view_count,
'uploader': uploader,
+ 'channel_id': channel_id, # TODO: validate?
+ 'upload_date': strftime_or_none(timestamp, '%Y%m%d'),
+ 'live_status': (... | yt_dlp/extractor/youtube.py | 26 | Python | 0.857 | suggestion | 781 | 51 | 51 | false | [youtube:tab] Extract more metadata for feeds/channels/playlists | 1,018 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | coletdjnz |
logger.error('could not find local state file')
return None
with open(path, 'r') as f:
data = json.load(f)
try:
base64_key = data['os_crypt']['encrypted_key']
except KeyError:
logger.error('no encrypted key in Local State')
return None
encrypted_key = comp... | @mbway, could you confirm that this is correct | return None
encrypted_key = compat_b64decode(base64_key)
prefix = b'DPAPI'
if not encrypted_key.startswith(prefix):
logger.error('invalid key')
return None
return _decrypt_windows_dpapi(encrypted_key[len(prefix):], logger)
def pbkdf2_sha1(password, salt, iterations, key_length)... | @@ -643,21 +643,18 @@ def pbkdf2_sha1(password, salt, iterations, key_length):
def _decrypt_aes_cbc(ciphertext, key, logger, initialization_vector=b' ' * 16):
- plaintext = aes_cbc_decrypt(bytes_to_intlist(ciphertext),
- bytes_to_intlist(key),
- byte... | yt_dlp/cookies.py | 26 | Python | 0.143 | suggestion | 46 | 51 | 51 | false | Add aes-128-gcm decrypt and verify | 1,020 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sulyi |
b"\x97\x92+\xe5\x0b\xc3\x18\x91ky9m&\xb3\xb5@\xe6'\xc2\x96.\xc8u\x88\xab9-[\x9e|\xf1\xcd")
def test_ctr_decrypt(self):
data = bytes_to_intlist(
b"\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xaf\x08"
)
decrypted = intlist_to_bytes(aes_ctr_decrypt(data, ... | this is ugly
```suggestion
decrypted = intlist_to_bytes(aes_gcm_decrypt_and_verify(
bytes_to_intlist(data), self.key, bytes_to_intlist(authentication_tag), self.iv[:12]))
```
same below | b'\x97\x92+\xe5\x0b\xc3\x18\x91ky9m&\xb3\xb5@\xe6\'\xc2\x96.\xc8u\x88\xab9-[\x9e|\xf1\xcd')
def test_ctr_decrypt(self):
data = bytes_to_intlist(b'\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xaf\x08')
decrypted = intlist_to_bytes(aes_ctr_decrypt(data, self.key, self.iv))
... | @@ -40,6 +53,38 @@ def test_cbc_encrypt(self):
encrypted,
b"\x97\x92+\xe5\x0b\xc3\x18\x91ky9m&\xb3\xb5@\xe6'\xc2\x96.\xc8u\x88\xab9-[\x9e|\xf1\xcd")
+ def test_ctr_decrypt(self):
+ data = bytes_to_intlist(
+ b"\x03\xc7\xdd\xd4\x8e\xb3\xbc\x1a*O\xdc1\x12+8Aio\xd1z\xb5#\xa... | test/test_aes.py | 26 | Python | 0.786 | security | 210 | 51 | 47 | false | Add aes-128-gcm decrypt and verify | 1,020 | yt-dlp/yt-dlp | 132,642 | Python | pukkandan | sulyi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.