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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_GEO_COUNTRIES = ['RU']
_TESTS = [
{
'url': 'https://www.1tv.ru/live',
'info_dict': {
'id': 'live',
'ext': 'mp4',
'title': 'ПЕРВЫЙ КАНАЛ ПРЯМОЙ ЭФИР СМОТРЕТЬ ОНЛАЙН',
'is_live': True,
},
},
]... | ```suggestion
mpd_url = traverse_obj(streams_list, ('mpd', ..., {url_or_none}, any, {require('mpd url')}))
formats, subtitles = self._extract_mpd_formats_and_subtitles(
mpd_url, display_id, mpd_id='dash', fatal=False)
```
import `require` from `..utils.traversal` | 'url': 'https://www.1tv.ru/live',
'info_dict': {
'id': 'live',
'ext': 'mp4',
'title': r're:ПЕРВЫЙ КАНАЛ ПРЯМОЙ ЭФИР СМОТРЕТЬ ОНЛАЙН \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
'live_status': 'is_live',
},
'params': {'skip_download': 'livestream'},
... | @@ -129,3 +130,51 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thumbnail(webpage, default=None))
+
+
+class FirstTVLiveIE(InfoExtractor):
+ IE_NAME = '1tv-live... | yt_dlp/extractor/firsttv.py | 26 | Python | 0.857 | refactor | 298 | 42 | 26 | false | [ie/1tv:live] Add extractor | 14,299 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | swayll |
{
'url': 'https://www.1tv.ru/live',
'info_dict': {
'id': 'live',
'ext': 'mp4',
'title': 'ПЕРВЫЙ КАНАЛ ПРЯМОЙ ЭФИР СМОТРЕТЬ ОНЛАЙН',
'is_live': True,
},
},
]
def _real_extract(self, url):
... | ```suggestion
```
No longer necessary with 7af6d81f35aea8832023daa30ada10e6673a0529 | import urllib.parse
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
join_nonempty,
mimetype2ext,
parse_qs,
unified_strdate,
url_or_none,
)
from ..utils.traversal import require, traverse_obj
class FirstTVIE(InfoExtractor):
IE_NAME = '1tv'
IE_DES... | @@ -129,3 +129,48 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thumbnail(webpage, default=None))
+
+
+class FirstTVLiveIE(InfoExtractor):
+ IE_NAME = '1tv-live... | yt_dlp/extractor/firsttv.py | 26 | Python | 0.571 | suggestion | 85 | 36 | 165 | false | [ie/1tv:live] Add extractor | 14,299 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
_VALID_URL = r'https?://(?:www\.)?1tv\.ru/live/?'
_GEO_BYPASS = False
_GEO_COUNTRIES = ['RU']
_TESTS = [
{
'url': 'https://www.1tv.ru/live',
'info_dict': {
'id': 'live',
'ext': 'mp4',
'title': 'ПЕРВЫЙ КАНАЛ ПРЯМОЙ ЭФИР СМОТ... | - We shouldn't require both DASH and HLS. One or the other
- We can't download live subs
- extend `formats`
```suggestion
mpd_url = traverse_obj(streams_list, ('mpd', ..., {url_or_none}, any))
formats = self._extract_mpd_formats(mpd_url, display_id, mpd_id='dash', fatal=False)
hls_url = tr... | _VALID_URL = r'https?://(?:www\.)?1tv\.ru/live'
_TESTS = [{
'url': 'https://www.1tv.ru/live',
'info_dict': {
'id': 'live',
'ext': 'mp4',
'title': r're:ПЕРВЫЙ КАНАЛ ПРЯМОЙ ЭФИР СМОТРЕТЬ ОНЛАЙН \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
'live_status': 'is_liv... | @@ -129,3 +129,48 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thumbnail(webpage, default=None))
+
+
+class FirstTVLiveIE(InfoExtractor):
+ IE_NAME = '1tv-live... | yt_dlp/extractor/firsttv.py | 26 | Python | 1 | refactor | 593 | 41 | 29 | false | [ie/1tv:live] Add extractor | 14,299 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
'formats': formats,
'subtitles': subtitles,
}
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
playlist_url = urllib.parse.urljoin(url, self._html_search_regex(
r'data-pl... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?1tv\.ru/live'
``` | 'formats': formats,
'subtitles': subtitles,
}
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
playlist_url = urllib.parse.urljoin(url, self._html_search_regex(
r'data-pl... | @@ -129,3 +129,48 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thumbnail(webpage, default=None))
+
+
+class FirstTVLiveIE(InfoExtractor):
+ IE_NAME = '1tv-live... | yt_dlp/extractor/firsttv.py | 26 | Python | 0.571 | suggestion | 71 | 51 | 51 | false | [ie/1tv:live] Add extractor | 14,299 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | swayll |
_GEO_BYPASS = False
_GEO_COUNTRIES = ['RU']
_TESTS = [
{
'url': 'https://www.1tv.ru/live',
'info_dict': {
'id': 'live',
'ext': 'mp4',
'title': 'ПЕРВЫЙ КАНАЛ ПРЯМОЙ ЭФИР СМОТРЕТЬ ОНЛАЙН',
'is_live': True,
... | Why did you add the HLS code? From what I can tell, the HLS streams are completely unavailable. Even with a Russian IP. | _TESTS = [{
'url': 'https://www.1tv.ru/live',
'info_dict': {
'id': 'live',
'ext': 'mp4',
'title': r're:ПЕРВЫЙ КАНАЛ ПРЯМОЙ ЭФИР СМОТРЕТЬ ОНЛАЙН \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
'live_status': 'is_live',
},
'params': {'skip_download': 'l... | @@ -129,3 +130,42 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thumbnail(webpage, default=None))
+
+
+class FirstTVLiveIE(InfoExtractor):
+ IE_NAME = '1tv-live... | yt_dlp/extractor/firsttv.py | 26 | Python | 0.357 | question | 119 | 34 | 27 | false | [ie/1tv:live] Add extractor | 14,299 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | swayll |
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thumbnail(webpage, default=None))
class FirstTVLiveIE(InfoExtractor):
IE_NAME = '1tv-live'
IE_DESC = 'Первый канал (прямой эфир)'
_VALID_URL = r'https?://(?:www\.)?1tv\.ru/live... | Probably doesn't make a huge difference, but
```suggestion
webpage = self._download_webpage(url, display_id, fatal=False)
``` | thumbnail=self._og_search_thumbnail(webpage, default=None))
class FirstTVLiveIE(InfoExtractor):
IE_NAME = '1tv:live'
IE_DESC = 'Первый канал (прямой эфир)'
_VALID_URL = r'https?://(?:www\.)?1tv\.ru/live'
_TESTS = [{
'url': 'https://www.1tv.ru/live',
'info_dict': {
... | @@ -129,3 +130,42 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thumbnail(webpage, default=None))
+
+
+class FirstTVLiveIE(InfoExtractor):
+ IE_NAME = '1tv-live... | yt_dlp/extractor/firsttv.py | 26 | Python | 0.714 | suggestion | 136 | 42 | 35 | false | [ie/1tv:live] Add extractor | 14,299 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | swayll |
self._download_json(playlist_url, display_id),
lambda _, v: v['uid'] and (str(v['uid']) in item_ids if item_ids else True))
return self.playlist_result(
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thum... | Align formatting with yt-dlp convention
```suggestion
_TESTS = [{
'url': 'https://www.1tv.ru/live',
'info_dict': {
'id': 'live',
'ext': 'mp4',
'title': 'ПЕРВЫЙ КАНАЛ ПРЯМОЙ ЭФИР СМОТРЕТЬ ОНЛАЙН',
'is_live': True,
},
}]
``` | lambda _, v: v['uid'] and (str(v['uid']) in item_ids if item_ids else True))
return self.playlist_result(
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thumbnail(webpage, default=None))
class FirstTVLiveIE(InfoExt... | @@ -129,3 +130,42 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thumbnail(webpage, default=None))
+
+
+class FirstTVLiveIE(InfoExtractor):
+ IE_NAME = '1tv-live... | yt_dlp/extractor/firsttv.py | 26 | Python | 0.786 | suggestion | 313 | 46 | 39 | false | [ie/1tv:live] Add extractor | 14,299 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | swayll |
class FirstTVLiveIE(InfoExtractor):
IE_NAME = '1tv-live'
IE_DESC = 'Первый канал (прямой эфир)'
_VALID_URL = r'https?://(?:www\.)?1tv\.ru/live'
_GEO_BYPASS = False
_GEO_COUNTRIES = ['RU']
_TESTS = [
{
'url': 'https://www.1tv.ru/live',
'info_dict': {
... | Can't do that since it would raise an ignored subtitle warning. Instead we should write to `_`
```suggestion
formats, _ = self._extract_mpd_formats_and_subtitles(mpd_url, display_id, mpd_id='dash', fatal=False)
``` | IE_NAME = '1tv:live'
IE_DESC = 'Первый канал (прямой эфир)'
_VALID_URL = r'https?://(?:www\.)?1tv\.ru/live'
_TESTS = [{
'url': 'https://www.1tv.ru/live',
'info_dict': {
'id': 'live',
'ext': 'mp4',
'title': r're:ПЕРВЫЙ КАНАЛ ПРЯМОЙ ЭФИР СМОТРЕТЬ ОНЛАЙН... | @@ -129,3 +130,42 @@ def _real_extract(self, url):
return self.playlist_result(
self._entries(items), display_id, self._og_search_title(webpage, default=None),
thumbnail=self._og_search_thumbnail(webpage, default=None))
+
+
+class FirstTVLiveIE(InfoExtractor):
+ IE_NAME = '1tv-live... | yt_dlp/extractor/firsttv.py | 26 | Python | 0.857 | refactor | 225 | 38 | 31 | false | [ie/1tv:live] Add extractor | 14,299 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | swayll |
continue
item_mode = 'sammlung' if item.get('type') == 'compilation' else 'video'
yield self.url_result(
f'https://www.ardmediathek.de/{item_mode}/{item_id}',
ie=(ARDMediathekCollectionIE if item_mode == 'sammlung' else ARDBetaM... | I think this matchgroup is not relevant and can be ignored?
```suggestion
(?P<id>urn:ard:(?:episode|section|extra|show):[a-f0-9]{16})/$'''
``` | if not item_id or item_id == playlist_id:
continue
item_mode = 'sammlung' if item.get('type') == 'compilation' else 'video'
yield self.url_result(
f'https://www.ardmediathek.de/{item_mode}/{item_id}',
ie=(ARDMedi... | @@ -601,3 +602,149 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekIE(InfoExtractor):
+ _VALID_URL =... | yt_dlp/extractor/ard.py | 26 | Python | 0.714 | suggestion | 152 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | 1100101 | evilpie |
'display_id': 'urn:ard:section:855c7a53dac72e0a',
'timestamp': 1735629900,
'series': 'Auf der Spur – Die ARD Ermittlerkrimis',
'channel': 'ARD',
'episode': 'Episode 1',
'episode_number': 1,
},
},
]
... | Might make sense to also fetch `audioBitrate` and `audioCodec` | 'channel': 'ARD',
'episode': 'Episode 1',
'episode_number': 1,
},
}, {
'url': 'https://www.ardaudiothek.de/episode/urn:ard:extra:d2fe7303d2dcbf5d/',
'info_dict': {
'id': 'urn:ard:extra:d2fe7303d2dcbf5d',
'ext': 'mp3',
't... | @@ -601,3 +602,149 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekIE(InfoExtractor):
+ _VALID_URL =... | yt_dlp/extractor/ard.py | 26 | Python | 0.357 | suggestion | 62 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
return self._download_json(
self._GRAPHQL_ENDPOINT,
urn,
data=json.dumps({'query': query,
'variables': {'id': urn},
}).encode(),
headers={
'Content-Type': 'application/json',
},
... | This should be a separate extractor. There is no overlap in the URL and there is almost no shared code. You can move the `_graphql_query` function in to a base class. So `ARDAudiothekBaseIE` for shared functionality, `ARDAudiothekIE` for individual items, `ARDAudiothekPlaylistIE` for playlists. | 'id': urn,
**traverse_obj(item, {
'formats': ('audioList', lambda _, v: url_or_none(v['href']), {
'url': 'href',
'format_id': ('distributionType', {str}),
'abr': ('audioBitrate', {int_or_none}),
'acod... | @@ -601,3 +602,149 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekIE(InfoExtractor):
+ _VALID_URL =... | yt_dlp/extractor/ard.py | 26 | Python | 0.643 | refactor | 295 | 47 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
if playlist_type:
playlist_info = self._graphql_query(urn, self._QUERY_PLAYLIST)['show']
episodes = playlist_info['items']['nodes']
entries = []
for episode in episodes:
entries.append(self.url_result(
episode['url'],
... | ```suggestion
'series': ('show', 'title', {str}),
``` | 'thumbnail': ('image', 'url1X1', {url_or_none}, {update_url(query=None)}),
'timestamp': ('startDate', {parse_iso8601}),
'title': ('title', {str}),
}),
}
class ARDAudiothekPlaylistIE(ARDAudiothekBaseIE):
_VALID_URL = r'https:?//(?:www\.)?ardaudiot... | @@ -601,3 +602,149 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekIE(InfoExtractor):
+ _VALID_URL =... | yt_dlp/extractor/ard.py | 26 | Python | 0.571 | suggestion | 71 | 33 | 48 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
class ARDAudiothekBaseIE(InfoExtractor):
_GRAPHQL_ENDPOINT = 'https://api.ardaudiothek.de/graphql'
... | I would just keep this as a single line. Any reason for the `$` anchor? It would exclude URLs that contain query args or fragments.
```suggestion
_VALID_URL = r'https:?//(?:www\.)?ardaudiothek\.de/episode/(?P<id>urn:ard:(?:episode|section|extra):[a-f0-9]{16})'
``` |
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
class ARDAudiothekBaseIE(InfoExtractor):
def _graphql_query(self, urn, query):
return self._dow... | @@ -601,3 +602,186 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ _GRAPHQL... | yt_dlp/extractor/ard.py | 26 | Python | 0.786 | suggestion | 271 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
'audioList', lambda _, v: url_or_none(v['href']), {
'url': 'href',
'format_id': ('distributionType', {str}),
'abr': ('audioBitrate', {int}),
'acodec': ('audioCodec', {str}),
})),
'id': urn,
... | Same here
```suggestion
_VALID_URL = r'https:?//(?:www\.)?ardaudiothek\.de/sendung/(?P<playlist>[\w-]+)/(?P<id>urn:ard:show:[a-f0-9]{16})'
``` | }),
}
class ARDAudiothekPlaylistIE(ARDAudiothekBaseIE):
_VALID_URL = r'https:?//(?:www\.)?ardaudiothek\.de/sendung/(?P<playlist>[\w-]+)/(?P<id>urn:ard:show:[a-f0-9]{16})'
_TESTS = [{
'url': 'https://www.ardaudiothek.de/sendung/mia-insomnia/urn:ard:show:c405aa26d9a4060a/',
... | @@ -601,3 +602,186 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ _GRAPHQL... | yt_dlp/extractor/ard.py | 26 | Python | 0.714 | suggestion | 149 | 51 | 45 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
href
distributionType
audioBitrate
audioCodec
}
show {
title
}
image {
url1X1
}
programSet {
publicationService {
organization... | ```suggestion
urn = self._match_id(url)
``` | description
title
duration
startDate
episodeNumber
}
}'''
def _real_extract(self, url):
urn = self._match_id(url)
item = self._graphql_query(urn, self._QUERY_ITEM)['item']
return {
'id': urn,
**t... | @@ -601,3 +602,186 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ _GRAPHQL... | yt_dlp/extractor/ard.py | 26 | Python | 0.571 | suggestion | 53 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
programSet {
publicationService {
organizationName
}
}
description
title
duration
startDate
episodeNumber
}
}'''
def _real_extract(self, url):
urn = self._match_valid_... | Let's combine this in to a single call:
```suggestion
'id': urn,
**traverse_obj(item, {
'formats': ('audioList', lambda _, v: url_or_none(v['href']), {
'url': 'href',
'format_id': ('distributionType', {str}),
'abr... | return {
'id': urn,
**traverse_obj(item, {
'formats': ('audioList', lambda _, v: url_or_none(v['href']), {
'url': 'href',
'format_id': ('distributionType', {str}),
'abr': ('audioBitrate', {int_or_none}),
... | @@ -601,3 +602,186 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ _GRAPHQL... | yt_dlp/extractor/ard.py | 26 | Python | 0.929 | suggestion | 596 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
class ARDAudiothekIE(ARDAudiothekBaseIE):
_VALID_URL = r'''(?x)https:?//
(?:www\.)?ardaudiothek\.de/
episode/
(?P<id>urn:ard:(?:episode|section|extra):[a-f0-9]{16})/$'''
_TESTS = [
{
'url': 'https://www.ardaudiothek.de/episode/urn:ard:episode:eabead1add170e93/',
... | These are not tested for when returning multiple formats
```suggestion
``` |
_TESTS = [{
'url': 'https://www.ardaudiothek.de/episode/urn:ard:episode:eabead1add170e93/',
'info_dict': {
'id': 'urn:ard:episode:eabead1add170e93',
'ext': 'mp3',
'upload_date': '20240717',
'duration': 3339,
'title': 'CAIMAN CLUB (S04E04):... | @@ -601,3 +602,186 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ _GRAPHQL... | yt_dlp/extractor/ard.py | 26 | Python | 0.571 | suggestion | 76 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
title
duration
startDate
episodeNumber
}
}'''
def _real_extract(self, url):
urn = self._match_valid_url(url).group('id')
item = self._graphql_query(urn, self._QUERY_ITEM)['item']
return {
'formats': traverse_obj(item, (... | use `update_url` from `..utils`
```suggestion
'thumbnail': ('image', 'url1X1', {url_or_none}, {update_url(query=None)}),
``` | 'abr': ('audioBitrate', {int_or_none}),
'acodec': ('audioCodec', {str}),
'vcodec': {value('none')},
}),
'channel': ('programSet', 'publicationService', 'organizationName', {str}),
'description': ('description', {... | @@ -601,3 +602,186 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ _GRAPHQL... | yt_dlp/extractor/ard.py | 26 | Python | 0.786 | suggestion | 143 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
'duration': ('duration', {int_or_none}),
'timestamp': ('broadcastedOn', {parse_iso8601}),
}))
page_data = call_api(0)
full_id = join_nonempty(playlist_id, season_number, version, delim='_')
return self.playlist_result(
... | I would inline the URL since it's only used once
```suggestion
def _graphql_query(self, urn, query):
return self._download_json(
'https://api.ardaudiothek.de/graphql', urn,
data=json.dumps({
'query': query,
'variables': {'id': urn},
... | 'title': ('longTitle', {str}),
'duration': ('duration', {int_or_none}),
'timestamp': ('broadcastedOn', {parse_iso8601}),
}))
page_data = call_api(0)
full_id = join_nonempty(playlist_id, season_number, version, d... | @@ -601,3 +602,186 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ _GRAPHQL... | yt_dlp/extractor/ard.py | 26 | Python | 1 | suggestion | 427 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
'playlist_mincount': 37,
},
]
_QUERY_PLAYLIST = '''
query($id: ID!) {
show(id: $id) {
title
description
items(filter: { isPublished: { equalTo: true } }) {
nodes {
url
}
}
... | ```suggestion
entries = []
for url in traverse_obj(playlist_info, ('items', 'nodes', ..., 'url', {url_or_none})):
entries.append(self.url_result(url, ie=ARDAudiothekIE))
``` | import functools
import json
import re
from .common import InfoExtractor
from ..utils import (
OnDemandPagedList,
bug_reports_message,
determine_ext,
int_or_none,
join_nonempty,
jwt_decode_hs256,
make_archive_id,
parse_duration,
parse_iso8601,
remove_start,
str_or_none,
... | @@ -601,3 +602,186 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ _GRAPHQL... | yt_dlp/extractor/ard.py | 26 | Python | 0.786 | suggestion | 205 | 31 | 766 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
'id': ('id', {str}),
'title': ('longTitle', {str}),
'duration': ('duration', {int_or_none}),
'timestamp': ('broadcastedOn', {parse_iso8601}),
}))
page_data = call_api(0)
full_id = join_no... | ```suggestion
'https://api.ardaudiothek.de/graphql', urn,
data=json.dumps({
'query': query,
'variables': {'id': urn},
}).encode(), headers={
'Content-Type': 'application/json',
})['data']
``` | 'id': ('id', {str}),
'title': ('longTitle', {str}),
'duration': ('duration', {int_or_none}),
'timestamp': ('broadcastedOn', {parse_iso8601}),
}))
page_data = call_api(0)
full_id = join_no... | @@ -601,3 +603,170 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ def _gra... | yt_dlp/extractor/ard.py | 26 | Python | 0.929 | suggestion | 295 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
organizationName
}
}
description
title
duration
startDate
episodeNumber
}
}'''
def _real_extract(self, url):
urn = self._match_id(url)
item = self._graphql_query(urn, self._QUERY_ITEM)[... | No need to have these be separate calls
```suggestion
``` | startDate
episodeNumber
}
}'''
def _real_extract(self, url):
urn = self._match_id(url)
item = self._graphql_query(urn, self._QUERY_ITEM)['item']
return {
'id': urn,
**traverse_obj(item, {
'formats': ('audioList', la... | @@ -601,3 +603,170 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ def _gra... | yt_dlp/extractor/ard.py | 26 | Python | 0.571 | suggestion | 59 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
return {
'id': urn,
**traverse_obj(item, {
'formats': ('audioList', lambda _, v: url_or_none(v['href']), {
'url': 'href',
'format_id': ('distributionType', {str}),
'abr': ('audioBitrate', {int_or_none}),
... | I changed this to `\w` for a reason. Otherwise, URLs such as https://www.ardaudiothek.de/sendung/100-berlin/urn:ard:show:4d248e0806ce37bc/ would not match. Maybe add that as a `only_matching` test.
```suggestion
_VALID_URL = r'''https:?//(?:www\.)?ardaudiothek\.de/sendung/(?P<playlist>[\w-]+)/(?P<id>urn:ard:show:... | 'abr': ('audioBitrate', {int_or_none}),
'acodec': ('audioCodec', {str}),
'vcodec': {value('none')},
}),
'channel': ('programSet', 'publicationService', 'organizationName', {str}),
'description': ('description', {... | @@ -601,3 +603,170 @@ def fetch_page(page_num):
return self.playlist_result(
OnDemandPagedList(fetch_page, self._PAGE_SIZE), full_id, display_id=display_id,
title=page_data.get('title'), description=page_data.get('synopsis'))
+
+
+class ARDAudiothekBaseIE(InfoExtractor):
+ def _gra... | yt_dlp/extractor/ard.py | 26 | Python | 0.857 | suggestion | 341 | 51 | 51 | false | [ie/ARDAudiothek] Add extractors | 14,309 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | evilpie |
'channel': 'Hi별',
'channel_id': '244396',
},
'skip': 'The channel is offline',
}, {
'url': 'https://www.flextv.co.kr/channels/746/live',
'only_matching': True,
}]
def _real_extract(self, url):
channel_id = self._match_id(url)
try:
... | do we want to add an `m3u8_id`? | 'channel': 'Hi별',
'channel_id': '244396',
},
'skip': 'The channel is offline',
}, {
'url': 'https://www.flextv.co.kr/channels/746/live',
'only_matching': True,
}]
def _real_extract(self, url):
channel_id = self._match_id(url)
try:
... | @@ -36,21 +40,33 @@ def _real_extract(self, url):
try:
stream_data = self._download_json(
- f'https://api.flextv.co.kr/api/channels/{channel_id}/stream',
+ f'https://api.ttinglive.com/api/channels/{channel_id}/stream',
channel_id, query={'option': '... | yt_dlp/extractor/flextv.py | 26 | Python | 0.214 | question | 31 | 51 | 50 | false | [ie/ttinglive] Rename from FlexTV to ttinglive | 14,375 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
channel_id = self._match_id(url)
try:
stream_data = self._download_json(
f'https://api.ttinglive.com/api/channels/{channel_id}/stream',
channel_id, query={'option': 'all'})
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and ... | I don't think this does anything?
```suggestion
``` | channel_id = self._match_id(url)
try:
stream_data = self._download_json(
f'https://api.ttinglive.com/api/channels/{channel_id}/stream',
channel_id, query={'option': 'all'})
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and ... | @@ -36,21 +40,33 @@ def _real_extract(self, url):
try:
stream_data = self._download_json(
- f'https://api.flextv.co.kr/api/channels/{channel_id}/stream',
+ f'https://api.ttinglive.com/api/channels/{channel_id}/stream',
channel_id, query={'option': '... | yt_dlp/extractor/flextv.py | 26 | Python | 0.571 | suggestion | 53 | 41 | 40 | false | [ie/ttinglive] Rename from FlexTV to ttinglive | 14,375 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
import hashlib
import hmac
import re
import time
from .common import InfoExtractor
from ..utils import (
ExtractorError,
dict_get,
int_or_none,
js_to_json,
parse_iso8601,
str_or_none,
traverse_obj,
try_get,
unescapeHTML,
update_url_query,
url_or_none,
)
class ABCIE(InfoExt... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?abc\.net\.au/(?:news|btn|listen)/(?:[^/?#]+/){1,4}(?P<id>\d{5,})'
``` | import hashlib
import hmac
import re
import time
from .common import InfoExtractor
from ..utils import (
ExtractorError,
dict_get,
int_or_none,
js_to_json,
parse_iso8601,
str_or_none,
traverse_obj,
try_get,
unescapeHTML,
update_url_query,
url_or_none,
)
class ABCIE(InfoExt... | @@ -21,7 +21,7 @@
class ABCIE(InfoExtractor):
IE_NAME = 'abc.net.au'
- _VALID_URL = r'https?://(?:www\.)?abc\.net\.au/(?:news|btn)/(?:[^/]+/){1,4}(?P<id>\d{5,})'
+ _VALID_URL = r'https?://(?:www\.)?abc\.net\.au/(?:news|btn|listen)/(?:[^/]+/){1,4}(?P<id>\d{5,})' | yt_dlp/extractor/abc.py | 24 | Python | 0.714 | suggestion | 123 | 49 | 49 | false | Add support for ABC Listen to ABC Extractor | 14,389 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | uoag |
'description': 'md5:809ad29c67a05f54eb41f2a105693a67',
},
'skip': 'this video has expired',
}, {
'url': 'http://www.abc.net.au/news/2015-08-17/warren-entsch-introduces-same-sex-marriage-bill/6702326',
'md5': '4ebd61bdc82d9a8b722f64f1f4b4d121',
'info_dict': {
... | shorten all the thumbnail urls using regex | 'description': 'md5:809ad29c67a05f54eb41f2a105693a67',
},
'skip': 'this video has expired',
}, {
'url': 'http://www.abc.net.au/news/2015-08-17/warren-entsch-introduces-same-sex-marriage-bill/6702326',
'md5': '4ebd61bdc82d9a8b722f64f1f4b4d121',
'info_dict': {
... | @@ -53,8 +53,10 @@ class ABCIE(InfoExtractor):
'info_dict': {
'id': '6880080',
'ext': 'mp3',
- 'title': 'NAB lifts interest rates, following Westpac and CBA',
+ 'title': 'NAB lifts interest rates, following Westpac and CBA - ABC listen',
'description... | yt_dlp/extractor/abc.py | 26 | Python | 0.071 | suggestion | 42 | 51 | 51 | false | Add support for ABC Listen to ABC Extractor | 14,389 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | uoag |
'ext': 'mp4',
'title': 'Australia to help staff Ebola treatment centre in Sierra Leone',
'description': 'md5:809ad29c67a05f54eb41f2a105693a67',
},
'skip': 'this video has expired',
}, {
'url': 'http://www.abc.net.au/news/2015-08-17/warren-entsch-introduces... | Should be processing the title with `lambda title: re.sub(r'\s+-\s+ABC \w+$', '', title)`? | 'ext': 'mp4',
'title': 'Australia to help staff Ebola treatment centre in Sierra Leone',
'description': 'md5:809ad29c67a05f54eb41f2a105693a67',
},
'skip': 'this video has expired',
}, {
'url': 'http://www.abc.net.au/news/2015-08-17/warren-entsch-introduces... | @@ -53,8 +53,9 @@ class ABCIE(InfoExtractor):
'info_dict': {
'id': '6880080',
'ext': 'mp3',
- 'title': 'NAB lifts interest rates, following Westpac and CBA',
+ 'title': 'NAB lifts interest rates, following Westpac and CBA - ABC listen', | yt_dlp/extractor/abc.py | 26 | Python | 0.429 | question | 90 | 51 | 51 | false | Add support for ABC Listen to ABC Extractor | 14,389 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | uoag |
'title': 'Introducing Understood: Who Broke the Internet?',
'ext': 'mp3',
'description': 'md5:c605117500084e43f08a950adc6a708c',
'duration': 229,
'timestamp': 1745827200000,
},
}, {
'url': 'https://www.cbc.ca/listen/live-radio/1-64-the-hous... | We can inline this below
```suggestion
``` | 'release_date': '20250428',
'upload_date': '20250428',
},
}, {
'url': 'https://www.cbc.ca/listen/live-radio/1-64-the-house/clip/16170773-should-canada-suck-stand-donald-trump',
'info_dict': {
'id': '16170773',
'title': 'Should Canada suck up or... | @@ -913,3 +915,74 @@ def _real_extract(self, url):
'thumbnail': ('images', 'card', 'url'),
}),
}
+
+
+class CBCListenIE(InfoExtractor):
+ IE_NAME = 'cbc.ca:listen'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(:?listen/)(?:cbc-podcasts|live-radio)/(?:[^/]+/)+(?P<id>\d+)'
+ ... | yt_dlp/extractor/cbc.py | 26 | Python | 0.429 | suggestion | 44 | 51 | 46 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | uoag |
},
}]
def _download_api_json(self, video_id):
api_url = f'https://www.cbc.ca/listen/api/v1/clips/{video_id}'
raw = self._download_webpage(api_url, video_id,
note='Downloading episode JSON')
api_json = self._parse_json(raw, video_id)
... | I'd prioritize the api extraction
```suggestion
data = traverse_obj(self._download_json(
f'https://www.cbc.ca/listen/api/v1/clips/{video_id}', video_id), 'data', {dict})
``` | },
}]
def _real_extract(self, url):
video_id = self._match_id(url)
response = self._download_json(
f'https://www.cbc.ca/listen/api/v1/clips/{video_id}', video_id, fatal=False)
data = traverse_obj(response, ('data', {dict}))
if not data:
self.repo... | @@ -913,3 +915,74 @@ def _real_extract(self, url):
'thumbnail': ('images', 'card', 'url'),
}),
}
+
+
+class CBCListenIE(InfoExtractor):
+ IE_NAME = 'cbc.ca:listen'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(:?listen/)(?:cbc-podcasts|live-radio)/(?:[^/]+/)+(?P<id>\d+)'
+ ... | yt_dlp/extractor/cbc.py | 26 | Python | 0.786 | refactor | 197 | 48 | 31 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | uoag |
api_json = self._parse_json(raw, video_id)
return api_json.get('data')
def _extract_webpage_data(self, url, video_id):
webpage = self._download_webpage(url, video_id)
preloaded_state = self._search_json(
r'window\.__PRELOADED_STATE__\s*=', webpage, 'preloaded state',
... | Why would this be expected? Also since the webpage extraction is fatal we can just
```suggestion
if not data:
self.report_warning('Api returned no data. Falling back to webpage parsing')
data = self._extract_webpage_data(url, video_id)
``` | import functools
import re
import time
import urllib.parse
from .common import InfoExtractor
from ..networking import HEADRequest
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
js_to_json,
jwt_decode_hs256,
mimetype2ext,
order... | @@ -913,3 +915,74 @@ def _real_extract(self, url):
'thumbnail': ('images', 'card', 'url'),
}),
}
+
+
+class CBCListenIE(InfoExtractor):
+ IE_NAME = 'cbc.ca:listen'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(:?listen/)(?:cbc-podcasts|live-radio)/(?:[^/]+/)+(?P<id>\d+)'
+ ... | yt_dlp/extractor/cbc.py | 26 | Python | 0.857 | refactor | 276 | 41 | 972 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | uoag |
'episodes', lambda _, v: str(v['clipID']) == video_id, any, {require('episode data')}))
def _real_extract(self, url):
video_id = self._match_id(url)
data = self._extract_webpage_data(url, video_id)
if not data:
self.to_screen('Unable to extract data from webpage. Tr... | Should use `traverse_obj` to ensure data type. Timestamps need to be in seconds.
```suggestion
return {
'id': video_id,
**traverse_obj(data, {
'url': (('src', 'url'), {url_or_none}, any),
'title': ('title', {str}),
'description': ('d... | import functools
import re
import time
import urllib.parse
from .common import InfoExtractor
from ..networking import HEADRequest
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
js_to_json,
jwt_decode_hs256,
mimetype2ext,
order... | @@ -913,3 +915,74 @@ def _real_extract(self, url):
'thumbnail': ('images', 'card', 'url'),
}),
}
+
+
+class CBCListenIE(InfoExtractor):
+ IE_NAME = 'cbc.ca:listen'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(:?listen/)(?:cbc-podcasts|live-radio)/(?:[^/]+/)+(?P<id>\d+)'
+ ... | yt_dlp/extractor/cbc.py | 26 | Python | 1 | suggestion | 584 | 27 | 972 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | uoag |
'ext': 'mp3',
'description': 'md5:7385194f1cdda8df27ba3764b35e7976',
'duration': 3159,
'timestamp': 1758254400000,
},
}]
def _download_api_json(self, video_id):
api_url = f'https://www.cbc.ca/listen/api/v1/clips/{video_id}'
raw = self._dow... | Since we don't use the show_data we might as well
```suggestion
return traverse_obj(preloaded_state, (
('podcastDetailData', 'showDetailData'), ..., 'episodes',
lambda _, v: str(v['clipID']) == video_id, any, {require('episode data')}))
``` | 'timestamp': 1758340800,
'release_timestamp': 1758254400,
'release_date': '20250919',
'upload_date': '20250920',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
response = self._download_json(
f'https://www.... | @@ -913,3 +915,74 @@ def _real_extract(self, url):
'thumbnail': ('images', 'card', 'url'),
}),
}
+
+
+class CBCListenIE(InfoExtractor):
+ IE_NAME = 'cbc.ca:listen'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(:?listen/)(?:cbc-podcasts|live-radio)/(?:[^/]+/)+(?P<id>\d+)'
+ ... | yt_dlp/extractor/cbc.py | 26 | Python | 1 | suggestion | 277 | 51 | 35 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | uoag |
'id': '2658915080',
'ext': 'mp4',
'title': 'Fly like an eagle!',
'description': 'Eagle equipped with a mini camera flies from the world\'s tallest tower',
'upload_date': '20150315',
'timestamp': 1426443984,
'... | We should rely as little as possible on overwriting suitable. In this case, we can just adjust the _VALID_URL
```py
_VALID_URL = r'https?://(?:www\.)?cbc\.ca/(?!player/|listen/)(?:[^/]+/)+(?P<id>[^/?#]+)'
``` | 'id': '2658915080',
'ext': 'mp4',
'title': 'Fly like an eagle!',
'description': 'Eagle equipped with a mini camera flies from the world\'s tallest tower',
'upload_date': '20150315',
'timestamp': 1426443984,
'... | @@ -114,7 +114,9 @@ class CBCIE(InfoExtractor):
@classmethod
def suitable(cls, url):
- return False if CBCPlayerIE.suitable(url) else super().suitable(url)
+ EXCLUDE_IE = (CBCPlayerIE, CBCListenIE)
+ return (False if any(ie.suitable(url) for ie in EXCLUDE_IE)
+ else super... | yt_dlp/extractor/cbc.py | 26 | Python | 0.857 | suggestion | 215 | 51 | 51 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | uoag |
'deviceType': 'ipad',
'idMedia': video_stream_id,
'multibitrate': 'true',
'output': 'json',
'tech': 'hls',
'manifestType': 'desktop',
})
formats = self._extract_m3u8_format... | Seems like a pretty broad match. Any reason not to use this?
```suggestion
_VALID_URL = r'https?://(?:www\.)?cbc\.ca/listen/(?:cbc-podcasts|live-radio)/[\w-]+/[\w-]+/(?P<id>\d+)'
``` | })
formats = self._extract_m3u8_formats(
stream_data['url'], video_id, 'mp4', live=live_status == 'is_live')
return {
'id': video_id,
'formats': formats,
'live_status': live_status,
'release_timestamp': release_timestam... | @@ -913,3 +915,74 @@ def _real_extract(self, url):
'thumbnail': ('images', 'card', 'url'),
}),
}
+
+
+class CBCListenIE(InfoExtractor):
+ IE_NAME = 'cbc.ca:listen'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(:?listen/)(?:cbc-podcasts|live-radio)/(?:[^/]+/)+(?P<id>\d+)' | yt_dlp/extractor/cbc.py | 26 | Python | 0.929 | suggestion | 189 | 51 | 51 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | uoag |
'timestamp': 1758340800,
'release_timestamp': 1758254400,
'release_date': '20250919',
'upload_date': '20250920',
},
}]
def _download_api_json(self, video_id):
return traverse_obj(self._download_json(
f'https://www.cbc.ca/listen/api/v1/... | Just inline this with `fatal=False`
```suggestion
data = traverse_obj(self._download_json(
f'https://www.cbc.ca/listen/api/v1/clips/{video_id}', video_id, fatal=False), 'data', {dict})``` | 'release_timestamp': 1758254400,
'release_date': '20250919',
'upload_date': '20250920',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
response = self._download_json(
f'https://www.cbc.ca/listen/api/v1/clips/{video_id}... | @@ -913,3 +910,70 @@ def _real_extract(self, url):
'thumbnail': ('images', 'card', 'url'),
}),
}
+
+
+class CBCListenIE(InfoExtractor):
+ IE_NAME = 'cbc.ca:listen'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/listen/(?:cbc-podcasts|live-radio)/[\w-]+/[\w-]+/(?P<id>\d+)'
+ ... | yt_dlp/extractor/cbc.py | 26 | Python | 0.786 | suggestion | 210 | 42 | 34 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | uoag |
from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
js_to_json,
jwt_decode_hs256,
mimetype2ext,
orderedSet,
parse_age_limit,
parse_iso8601,
replace_extension,
smuggle_url,
strip_or_none,
try_get,
unified_timestamp,
update_url,
url_basename,
... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?cbc\.ca/(?!player/|listen/|i/caffeine/syndicate/)(?:[^/?#]+/)+(?P<id>[^/?#]+)'
``` | from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
js_to_json,
jwt_decode_hs256,
mimetype2ext,
orderedSet,
parse_age_limit,
parse_iso8601,
replace_extension,
smuggle_url,
strip_or_none,
try_get,
unified_timestamp,
update_url,
url_basename,
... | @@ -31,7 +31,7 @@
class CBCIE(InfoExtractor):
IE_NAME = 'cbc.ca'
- _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(?!player/)(?:[^/]+/)+(?P<id>[^/?#]+)'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/(?!player/|listen/|i/caffeine/syndicate/)(?:[^/]+/)+(?P<id>[^/?#]+)' | yt_dlp/extractor/cbc.py | 26 | Python | 0.714 | suggestion | 136 | 51 | 51 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | uoag |
'title': 'Should Canada suck up or stand up to Donald Trump?',
'ext': 'mp3',
'description': 'md5:7385194f1cdda8df27ba3764b35e7976',
'duration': 3159,
'timestamp': 1758340800,
'release_timestamp': 1758254400,
'release_date': '20250919',
... | traversal is wrong, and let's break this up to enhance readability
```suggestion
response = self._download_json(f'https://www.cbc.ca/listen/api/v1/clips/{video_id}', video_id, fatal=False)
data = traverse_obj(response, ('data', {dict}))
``` | 'title': 'Should Canada suck up or stand up to Donald Trump?',
'ext': 'mp3',
'description': 'md5:7385194f1cdda8df27ba3764b35e7976',
'duration': 3159,
'timestamp': 1758340800,
'release_timestamp': 1758254400,
'release_date': '20250919',
... | @@ -913,3 +909,66 @@ def _real_extract(self, url):
'thumbnail': ('images', 'card', 'url'),
}),
}
+
+
+class CBCListenIE(InfoExtractor):
+ IE_NAME = 'cbc.ca:listen'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/listen/(?:cbc-podcasts|live-radio)/[\w-]+/[\w-]+/(?P<id>\d+)'
+ ... | yt_dlp/extractor/cbc.py | 26 | Python | 0.786 | bug | 260 | 42 | 39 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | uoag |
'duration': 3159,
'timestamp': 1758340800,
'release_timestamp': 1758254400,
'release_date': '20250919',
'upload_date': '20250920',
},
}]
def _extract_webpage_data(self, url, video_id):
webpage = self._download_webpage(url, video_id)
... | ```suggestion
self.report_warning('API failed to return data. Falling back to webpage parsing')
webpage = self._download_webpage(url, video_id)
preloaded_state = self._search_json(
r'window\.__PRELOADED_STATE__\s*=', webpage, 'preloaded state',
vi... | 'duration': 3159,
'timestamp': 1758340800,
'release_timestamp': 1758254400,
'release_date': '20250919',
'upload_date': '20250920',
},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
response = self._download_js... | @@ -913,3 +909,66 @@ def _real_extract(self, url):
'thumbnail': ('images', 'card', 'url'),
}),
}
+
+
+class CBCListenIE(InfoExtractor):
+ IE_NAME = 'cbc.ca:listen'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/listen/(?:cbc-podcasts|live-radio)/[\w-]+/[\w-]+/(?P<id>\d+)'
+ ... | yt_dlp/extractor/cbc.py | 26 | Python | 0.929 | bug | 581 | 39 | 36 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | uoag |
'id': '16142603',
'title': 'Introducing Understood: Who Broke the Internet?',
'ext': 'mp3',
'description': 'md5:c605117500084e43f08a950adc6a708c',
'duration': 229,
'timestamp': 1745812800,
'release_timestamp': 1745827200,
'r... | ```suggestion
}]
def _real_extract(self, url):
``` | 'id': '16142603',
'title': 'Introducing Understood: Who Broke the Internet?',
'ext': 'mp3',
'description': 'md5:c605117500084e43f08a950adc6a708c',
'duration': 229,
'timestamp': 1745812800,
'release_timestamp': 1745827200,
'r... | @@ -913,3 +909,66 @@ def _real_extract(self, url):
'thumbnail': ('images', 'card', 'url'),
}),
}
+
+
+class CBCListenIE(InfoExtractor):
+ IE_NAME = 'cbc.ca:listen'
+ _VALID_URL = r'https?://(?:www\.)?cbc\.ca/listen/(?:cbc-podcasts|live-radio)/[\w-]+/[\w-]+/(?P<id>\d+)'
+ ... | yt_dlp/extractor/cbc.py | 26 | Python | 0.643 | refactor | 63 | 51 | 51 | false | [ie/cbc.ca:listen] Add extractor | 14,391 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | uoag |
}
if known_idx == last_seq:
no_fragment_score += 5
else:
no_fragment_score = 0
known_idx = last_seq
except ExtractorError:
continue
if manifestless_orig_fmt:
... | ```suggestion
if not re.fullmatch(r'[0-9]{5,}@[0-9a-f]{8,}', player_js_version):
self.report_warning(
f'Invalid player JS version "{player_js_version}" specified. '
f'It should be "actual" or in the format of STS@HASH', only_once=True)
return None, No... | }
if known_idx == last_seq:
no_fragment_score += 5
else:
no_fragment_score = 0
known_idx = last_seq
except ExtractorError:
continue
if manifestless_orig_fmt:
... | @@ -2015,16 +2015,28 @@ def _extract_sequence_from_mpd(refresh_sequence, immediate):
time.sleep(max(0, FETCH_SPAN + fetch_time - time.time()))
+ def _get_player_js_version(self):
+ player_js_version = self._configuration_arg('player_js_version', [''])[0] or '20348@0004de42'
+ if player... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.857 | suggestion | 372 | 51 | 51 | false | [ie/youtube] Force player `0004de42` | 14,398 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
def _extract_n_function_from_code(self, jsi, func_code):
func = jsi.extract_function_from_code(*func_code)
def extract_nsig(s):
try:
ret = func([s])
except JSInterpreter.Exception:
raise
except Exception as e:
rais... | if truthy we don't need `int_or_none`
```suggestion
player_sts_override = self._get_player_js_version()[0]
if player_sts_override:
return int(player_sts_override)
``` |
def _extract_n_function_from_code(self, jsi, func_code):
func = jsi.extract_function_from_code(*func_code)
def extract_nsig(s):
try:
ret = func([s])
except JSInterpreter.Exception:
raise
except Exception as e:
rais... | @@ -2387,6 +2399,10 @@ def _extract_signature_timestamp(self, video_id, player_url, ytcfg=None, fatal=F
Extract signatureTimestamp (sts)
Required to tell API what sig/player version is in use.
"""
+ player_sts_override = self._get_player_js_version()[0]
+ if player_sts_override:... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.714 | suggestion | 199 | 51 | 51 | false | [ie/youtube] Force player `0004de42` | 14,398 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
f'https://pubads.g.doubleclick.net/ondemand/hls/content/{content_source_id}/vid/{video_id}/streams',
content_id, note='Downloading DAI JSON',
data=urlencode_postdata({'auth-token': auth_token}))
# Ignore subs to avoid ad break cleanup
formats, _ = self._extract_m3u8_... | I think there's supposed to be an upgrade-attempt-720p as well. I'll find an example URL soon™️ | raise ExtractorError('Failed to get DAI auth token')
dai_data = self._download_json(
f'https://pubads.g.doubleclick.net/ondemand/hls/content/{content_source_id}/vid/{video_id}/streams',
content_id, note='Downloading DAI JSON',
data=urlencode_postdata({'auth-token... | @@ -101,30 +108,145 @@ class TenPlayIE(InfoExtractor):
'X': 18,
}
+ _refresh_token = None
+ _access_token = None
+
+ @staticmethod
+ def _filter_ads_from_m3u8(m3u8_doc):
+ out = []
+ for line in m3u8_doc.splitlines():
+ if line.startswith('https://redirector.googlevi... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.214 | suggestion | 95 | 51 | 51 | false | [ie/10play] Rework extractor | 14,417 | yt-dlp/yt-dlp | 132,642 | Python | gamer191 | seproDev |
}).encode())
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
raise ExtractorError('Invalid username/password', expected=True)
raise
self._refresh_token = auth_data['jwt']['refreshToken']
self._acces... | ```suggestion
self.to_screen('Access token has expired; refreshing')
``` | 'password': password,
}).encode())
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
raise ExtractorError('Invalid username/password', expected=True)
raise
self._refresh_token = auth_data[... | @@ -100,31 +108,147 @@ class TenPlayIE(InfoExtractor):
'R': 18,
'X': 18,
}
+ _SEGMENT_BITRATE_RE = r'(?m)-(?:300|150|75|55)0000-(\d+(?:-[\da-f]+)?)\.ts$'
+
+ _refresh_token = None
+ _access_token = None
+
+ @staticmethod
+ def _filter_ads_from_m3u8(m3u8_doc):
+ out = []
+ ... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.571 | suggestion | 98 | 51 | 51 | false | [ie/10play] Rework extractor | 14,417 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
headers={
'Content-Type': 'application/json',
}, data=json.dumps({
'accessToken': self._access_token,
'refreshToken': self._refresh_token,
}).encode())
except ExtractorError as e:
if isinstanc... | ```suggestion
if self._refresh_token and self._access_token:
self.write_debug('Using cached refresh token')
return
``` | 'https://10.com.au/api/token/refresh', None, 'Refreshing access token',
headers={
'Content-Type': 'application/json',
}, data=json.dumps({
'accessToken': self._access_token,
'refreshToken': self._refresh_token,
... | @@ -100,31 +108,147 @@ class TenPlayIE(InfoExtractor):
'R': 18,
'X': 18,
}
+ _SEGMENT_BITRATE_RE = r'(?m)-(?:300|150|75|55)0000-(\d+(?:-[\da-f]+)?)\.ts$'
+
+ _refresh_token = None
+ _access_token = None
+
+ @staticmethod
+ def _filter_ads_from_m3u8(m3u8_doc):
+ out = []
+ ... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.857 | bug | 156 | 51 | 51 | false | [ie/10play] Rework extractor | 14,417 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
if not self._refresh_token:
self._refresh_token, self._access_token = self.cache.load(
self._NETRC_MACHINE, 'token_data', default=[None, None])
if self._refresh_token and self._access_token:
self.write_debug('Using cached refresh token')
return
... | I would do this all over to make maintenance easier
```py
_TOKEN_CACHE_KEY = 'token_data'
```
```suggestion
self.cache.store(self._NETRC_MACHINE, self._TOKEN_CACHE_KEY, [self._refresh_token, self._access_token])
``` | def _perform_login(self, username, password):
if not self._refresh_token:
self._refresh_token, self._access_token = self.cache.load(
self._NETRC_MACHINE, self._TOKEN_CACHE_KEY, default=[None, None])
if self._refresh_token and self._access_token:
self.write_deb... | @@ -100,31 +108,147 @@ class TenPlayIE(InfoExtractor):
'R': 18,
'X': 18,
}
+ _SEGMENT_BITRATE_RE = r'(?m)-(?:300|150|75|55)0000-(\d+(?:-[\da-f]+)?)\.ts$'
+
+ _refresh_token = None
+ _access_token = None
+
+ @staticmethod
+ def _filter_ads_from_m3u8(m3u8_doc):
+ out = []
+ ... | yt_dlp/extractor/tenplay.py | 26 | Python | 0.786 | performance | 235 | 51 | 51 | false | [ie/10play] Rework extractor | 14,417 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
else:
no_fragment_score = 0
known_idx = last_seq
except ExtractorError:
continue
if manifestless_orig_fmt:
# Stop at the first iteration if running for post-live manifestless;
# fragment count no... | ```suggestion
def _construct_player_url(self, player_id, variant):
return f'/s/player/{player_id}/{self._PLAYER_JS_VARIANT_MAP[variant]}'
``` | if known_idx == last_seq:
no_fragment_score += 5
else:
no_fragment_score = 0
known_idx = last_seq
except ExtractorError:
continue
if manifestless_orig_fmt:
# Stop at the first... | @@ -2026,6 +2026,9 @@ def _get_player_js_version(self):
return None, None
return player_js_version.split('@')
+ def _construct_player_url(self, player_id, varient):
+ return f'/s/player/{player_id}/{self._PLAYER_JS_VARIANT_MAP[varient]}' | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.714 | suggestion | 156 | 51 | 51 | false | [ie/youtube] Fix player JS overrides | 14,430 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | seproDev |
'uploader': 'DrTomServo',
'channel_id': '136',
'duration': 19018.392,
'cast': ['DrTomServo'],
'description': '',
'categories': [],
'upload_date': '20250817',
},
}]
def _real_extract(self, url):
video_id, display... | The `timestamp` code seems now pretty difficult to read. I'd like to simplify the entire return block using `traverse_obj`
```py
return {
'id': video_id,
'display_id': display_id,
'title': self._og_search_title(webpage),
**traverse_obj(post, {
... | 'duration': 19018.392,
'cast': ['DrTomServo'],
'description': '',
'upload_date': '20250817',
},
}]
def _real_extract(self, url):
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
webpage = self._download_webpage(... | @@ -119,8 +151,8 @@ def _real_extract(self, url):
'id': video_id,
'title': post.get('post_title') or self._og_search_title(webpage),
'display_id': display_id,
- 'url': content.get('url'),
- 'timestamp': parse_iso8601(content.get('start_date') or content.get('... | yt_dlp/extractor/prankcast.py | 26 | Python | 1 | refactor | 1,275 | 41 | 40 | false | [ie/PrankCastPost] Rework extractor | 14,445 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | columndeeply |
},
}]
def _real_extract(self, url):
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
webpage = self._download_webpage(url, video_id)
post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
content = self._par... | ```suggestion
'timestamp': ((
(('start_date', 'crdate'), {parse_iso8601(delimiter=' ')}),
('created_at', {parse_iso8601}),
), any),
``` | def _real_extract(self, url):
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
webpage = self._download_webpage(url, video_id)
post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
content = self._parse_json(post['post_... | @@ -112,26 +144,27 @@ def _real_extract(self, url):
post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
content = self._parse_json(post['post_contents_json'], video_id)[0]
- uploader = post.get('user_name')
- guests_json = traverse_obj(content, ('... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.786 | suggestion | 212 | 35 | 33 | false | [ie/PrankCastPost] Rework extractor | 14,445 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | columndeeply |
def _real_extract(self, url):
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
webpage = self._download_webpage(url, video_id)
post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
content = self._parse_json(post['post... | ```suggestion
'categories': ('category', {str}, filter, all, filter),
``` |
webpage = self._download_webpage(url, video_id)
post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
content = self._parse_json(post['post_contents_json'], video_id)[0]
return {
'id': video_id,
'display_id': display_id,
... | @@ -112,26 +144,27 @@ def _real_extract(self, url):
post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
content = self._parse_json(post['post_contents_json'], video_id)[0]
- uploader = post.get('user_name')
- guests_json = traverse_obj(content, ('... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.571 | suggestion | 91 | 33 | 31 | false | [ie/PrankCastPost] Rework extractor | 14,445 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | columndeeply |
webpage = self._download_webpage(url, video_id)
post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
content = self._parse_json(post['post_contents_json'], video_id)[0]
return {
'id': video_id,
'display_id': display_id,
... | ```suggestion
), {str}, filter),
``` |
return {
'id': video_id,
'display_id': display_id,
'title': self._og_search_title(webpage),
**traverse_obj(post, {
'title': ('post_title', {str}),
'description': ('post_body', {str}),
'tags': ('post_tags', {lambda x... | @@ -112,26 +144,27 @@ def _real_extract(self, url):
post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
content = self._parse_json(post['post_contents_json'], video_id)[0]
- uploader = post.get('user_name')
- guests_json = traverse_obj(content, ('... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.571 | suggestion | 54 | 29 | 27 | false | [ie/PrankCastPost] Rework extractor | 14,445 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | columndeeply |
'timestamp': 1755453505,
'uploader': 'DrTomServo',
'channel_id': '136',
'duration': 19018.392,
'cast': ['DrTomServo'],
'description': '',
'categories': [],
'upload_date': '20250817',
},
}]
def _real_extract(... | ```suggestion
'tags': ('post_tags', {lambda x: x.split(',')}, ..., {str.strip}, filter),
``` | 'channel_id': '136',
'duration': 19018.392,
'cast': ['DrTomServo'],
'description': '',
'upload_date': '20250817',
},
}]
def _real_extract(self, url):
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
... | @@ -112,26 +144,27 @@ def _real_extract(self, url):
post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts']
content = self._parse_json(post['post_contents_json'], video_id)[0]
- uploader = post.get('user_name')
- guests_json = traverse_obj(content, ('... | yt_dlp/extractor/prankcast.py | 26 | Python | 0.714 | suggestion | 110 | 43 | 41 | false | [ie/PrankCastPost] Rework extractor | 14,445 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | columndeeply |
continue
format_url = format_item
format_url = url_or_none(format_url)
if not format_url or format_url in format_urls:
continue
format_urls.add(format_url)
formats.append({... | Remove preceding two lines, "simplify" this part, and reindent the lines down to, but not including, original l.244 :
```suggestion
for hls_format_key, hls_url in traverse_obj(initials, (
'xplayerSettings', 'sources', 'hls', {dict.items},
lambda _, k_v: k_v[0] in ('url', ... | })
xplayer_sources = try_get(
initials, lambda x: x['xplayerSettings']['sources'], dict)
if xplayer_sources:
hls_sources = xplayer_sources.get('hls')
if isinstance(hls_sources, dict):
for hls_format_key in ('... | @@ -230,17 +303,18 @@ def get_height(s):
if xplayer_sources:
hls_sources = xplayer_sources.get('hls')
if isinstance(hls_sources, dict):
- for hls_format_key in ('url', 'fallback'):
- hls_url = hls_sources.get(hls_format_key)
- ... | yt_dlp/extractor/xhamster.py | 26 | Python | 0.857 | refactor | 351 | 51 | 51 | false | [ie/xhamster] Fix extractor (#14395) | 14,446 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | shssoichiro |
if cipher_type == 'xor':
return bytes(
a ^ b for a, b in
zip(ciphertext.encode(), itertools.cycle(self._XOR_KEY))).decode()
if cipher_type == 'rot13':
return codecs.decode(ciphertext, cipher_type)
self.report_warning(f'Skipping format "{... | Perhaps should actually be a generator, say a `class` with a `next()` method to replace `get_next_byte`...:
<details><summary>..., s/t like this</summary>
```py
...
class prng:
def __init__(self, algo_id: int, seed: int)
try:
self._the_algo = getattr(self... | 'url': 'https://xhamster2.com/videos/femaleagent-shy-beauty-takes-the-bait-1509445',
'only_matching': True,
}, {
'url': 'https://xhamster11.com/videos/femaleagent-shy-beauty-takes-the-bait-1509445',
'only_matching': True,
}, {
'url': 'https://xhamster26.com/videos/femalea... | @@ -164,6 +169,73 @@ def _decipher_format_url(self, format_url, format_id):
self.report_warning(f'Skipping format "{format_id}": unsupported cipher type "{cipher_type}"')
return None
+ def _deobfuscate_url(self, hex_string: str) -> str:
+ """
+ Deobfuscates a URL from a hex string, ... | yt_dlp/extractor/xhamster.py | 26 | Python | 1 | suggestion | 1,909 | 51 | 51 | false | [ie/xhamster] Fix extractor (#14395) | 14,446 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | shssoichiro |
'format_id': f'{format_id}-{quality}',
'url': format_url,
'ext': determine_ext(format_url, 'mp4'),
'height': get_height(quality),
'filesize': format_sizes.get(quality),
'http_h... | Reindentation to match above:
```suggestion
for
hls_url = self._decipher_format_url(hls_url, f'hls-{hls_format_key}')
if not hls_url or hls_url in format_urls:
continue
format_urls.add(hls_url)
formats.extend(self._extract_m3u8_formats(
... | hls_url = hls_sources.get(hls_format_key)
if not hls_url:
continue
hls_url = self._decipher_format_url(hls_url, f'hls-{hls_format_key}')
if not hls_url or hls_url in format_urls:
... | @@ -230,17 +303,18 @@ def get_height(s):
if xplayer_sources:
hls_sources = xplayer_sources.get('hls')
if isinstance(hls_sources, dict):
- for hls_format_key in ('url', 'fallback'):
- hls_url = hls_sources.get(hls_format_key)
- ... | yt_dlp/extractor/xhamster.py | 26 | Python | 1 | refactor | 1,281 | 51 | 51 | false | [ie/xhamster] Fix extractor (#14395) | 14,446 | yt-dlp/yt-dlp | 132,642 | Python | dirkf | shssoichiro |
hls_url = self._decipher_format_url(encrypted_url, f'hls-{hls_format_key}')
if hls_url and hls_url not in format_urls:
format_urls.add(hls_url)
formats.extend(self._extract_m3u8_formats(
... | I'm going to revert all this refactoring; it doesn't belong in this PR and it is nigh unreadable | for standard_format_key in ('url', 'fallback'):
standard_url = standard_format.get(standard_format_key)
if not standard_url:
continue
quality = (str_or_none(sta... | @@ -230,54 +297,62 @@ def get_height(s):
if xplayer_sources:
hls_sources = xplayer_sources.get('hls')
if isinstance(hls_sources, dict):
- for hls_format_key in ('url', 'fallback'):
- hls_url = hls_sources.get(hls_format_key)
- ... | yt_dlp/extractor/xhamster.py | 26 | Python | 0.286 | refactor | 96 | 51 | 51 | false | [ie/xhamster] Fix extractor (#14395) | 14,446 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | shssoichiro |
if cipher_type == 'rot13':
return codecs.decode(ciphertext, cipher_type)
self.report_warning(f'Skipping format "{format_id}": unsupported cipher type "{cipher_type}"')
return None
def _deobfuscate_url(self, hex_string: str) -> str:
"""
Deobfuscates a URL from a... | let's move this outside of the IE | 'url': 'https://xhamster26.com/videos/femaleagent-shy-beauty-takes-the-bait-1509445',
'only_matching': True,
}, {
'url': 'http://xhamster.com/movies/1509445/femaleagent_shy_beauty_takes_the_bait.html',
'only_matching': True,
}, {
'url': 'http://xhamster.com/movies/2221348... | @@ -164,6 +170,66 @@ def _decipher_format_url(self, format_url, format_id):
self.report_warning(f'Skipping format "{format_id}": unsupported cipher type "{cipher_type}"')
return None
+ def _deobfuscate_url(self, hex_string: str) -> str:
+ """
+ Deobfuscates a URL from a hex string, ... | yt_dlp/extractor/xhamster.py | 26 | Python | 0.143 | refactor | 33 | 51 | 51 | false | [ie/xhamster] Fix extractor (#14395) | 14,446 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | shssoichiro |
s = to_signed_32(s ^ ((s & 0xFFFFFFFF) >> 16))
s = to_signed_32(s * to_signed_32(0x85ebca77))
s = to_signed_32(s ^ ((s & 0xFFFFFFFF) >> 13))
s = to_signed_32(s * to_signed_32(0xc2b2ae3d))
return to_signed_32(s ^ ((s & 0xFFFFFFFF) >> 16))
... | unquoting is bad per comments in linked issue | a ^ b for a, b in
zip(ciphertext.encode(), itertools.cycle(self._XOR_KEY))).decode()
if cipher_type == 'rot13':
return codecs.decode(ciphertext, cipher_type)
self.report_warning(f'Skipping format "{format_id}": unsupported cipher type "{cipher_type}"')
... | @@ -164,6 +170,66 @@ def _decipher_format_url(self, format_url, format_id):
self.report_warning(f'Skipping format "{format_id}": unsupported cipher type "{cipher_type}"')
return None
+ def _deobfuscate_url(self, hex_string: str) -> str:
+ """
+ Deobfuscates a URL from a hex string, ... | yt_dlp/extractor/xhamster.py | 26 | Python | 0.071 | suggestion | 45 | 51 | 51 | false | [ie/xhamster] Fix extractor (#14395) | 14,446 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | shssoichiro |
'url': 'http://xhamster.com/movies/1509445/femaleagent_shy_beauty_takes_the_bait.html',
'only_matching': True,
}, {
'url': 'http://xhamster.com/movies/2221348/britney_spears_sexy_booty.html?hd',
'only_matching': True,
}, {
'url': 'http://de.xhamster.com/videos/skinny-girl... | why raise all of the descriptive ValueErrors if we're just going to ignore them ? | 'duration': 72,
'age_limit': 18,
'comment_count': int,
'uploader_url': 'https://xhamster.com/users/parejafree',
'description': '',
'view_count': int,
'thumbnail': r're:https?://.+\.jpg',
},
'skip': 'Invalid URL',
}, ... | @@ -146,12 +148,16 @@ class XHamsterIE(InfoExtractor):
_XOR_KEY = b'xh7999'
def _decipher_format_url(self, format_url, format_id):
+ # New version of encrypted URLs that are present in site's JSON
+ decrypted = try_call(lambda: self._deobfuscate_url(format_url)) or None
+ if decrypted i... | yt_dlp/extractor/xhamster.py | 26 | Python | 0.357 | question | 81 | 51 | 51 | false | [ie/xhamster] Fix extractor (#14395) | 14,446 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | shssoichiro |
"""
Fetch a PO Token for a given client and context. This function will validate required parameters for a given context and client.
EXPERIMENTAL: This method is unstable and may change or be removed without notice.
@param client: The client to fetch the PO Token for.
@param co... | can shorten these lines:
```suggestion
experiments = traverse_obj(ytcfg, (
'WEB_PLAYER_CONTEXT_CONFIGS', ..., 'serializedExperimentFlags', {urllib.parse.parse_qs}))
if traverse_obj(experiments, (..., 'html5_generate_content_po_token', -1, any)) == 'true':
```
or, I kinda li... | """
Fetch a PO Token for a given client and context. This function will validate required parameters for a given context and client.
EXPERIMENTAL: This method is unstable and may change or be removed without notice.
@param client: The client to fetch the PO Token for.
@param co... | @@ -2955,9 +2955,20 @@ def fetch_po_token(self, client='web', context: _PoTokenContext = _PoTokenContex
# TODO(future): This validation should be moved into pot framework.
# Some sort of middleware or validation provider perhaps?
+ gvs_bind_to_video_id = False
+ experiments = traverse... | yt_dlp/extractor/youtube/_video.py | 26 | Python | 0.857 | suggestion | 600 | 51 | 51 | false | [ie/youtube] Detect experiment binding GVS PO Token to video id | 14,471 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | coletdjnz |
import re
from .common import InfoExtractor
from ..utils import (
extract_attributes,
float_or_none,
int_or_none,
join_nonempty,
mimetype2ext,
parse_resolution,
str_or_none,
unescapeHTML,
url_or_none,
)
from ..utils.traversal import traverse_obj
class VidyardBaseIE(InfoExtractor):... | The playlist previously embedded on https://www.avaya.com/en/ has been replaced with a single video, and the embed method has been changed. I am not aware of an alternative iframe embed that could be added as a replacement test | 'duration': 6.0,
'thumbnail': 'https://cdn.vidyard.com/thumbnails/42061563/p6bY08d2N4e4IDz-7J4_wkgsPq3-qgcx_small.jpg',
},
}, {
'info_dict': {
'id': 'VAsYDi7eiqZRbHodUA2meC',
'display_id': '42456569',
'ext': ... | @@ -317,83 +290,22 @@ class VidyardIE(VidyardBaseIE):
'ext': 'mp4',
'title': 'Lesson 1 - Opening an MT4 Account',
'description': 'Never heard of MetaTrader4? Here\'s the 411 on the popular trading platform!',
- 'duration': 168,
+ 'duration': 168.16,
... | yt_dlp/extractor/vidyard.py | 26 | Python | 0.5 | suggestion | 227 | 338 | 51 | false | [ie/vidyard] Add support for chapter metadata | 14,478 | yt-dlp/yt-dlp | 132,642 | Python | exterrestris | exterrestris |
import re
from .common import InfoExtractor
from ..utils import (
extract_attributes,
float_or_none,
int_or_none,
join_nonempty,
mimetype2ext,
parse_resolution,
str_or_none,
unescapeHTML,
url_or_none,
)
from ..utils.traversal import traverse_obj
class VidyardBaseIE(InfoExtractor):... | There is still a Vidyard embed on this page (although just for a single video, not a playlist), however the embed method has been changed - it now appears that the embed is generated on-the-fly by custom JS for the site, so it cannot be detected on page load. I have therefore removed the test | 'display_id': '3225198',
'ext': 'mp4',
'title': 'The Extreme Importance of PC Board Stack Up',
'thumbnail': 'https://cdn.vidyard.com/thumbnails/73_Q3_hBexWX7Og1sae6cg/9998fa4faec921439e2c04_small.jpg',
'duration': 3422.742,
},
}, {
# <scrip... | @@ -317,83 +290,22 @@ class VidyardIE(VidyardBaseIE):
'ext': 'mp4',
'title': 'Lesson 1 - Opening an MT4 Account',
'description': 'Never heard of MetaTrader4? Here\'s the 411 on the popular trading platform!',
- 'duration': 168,
+ 'duration': 168.16,
... | yt_dlp/extractor/vidyard.py | 26 | Python | 0.5 | suggestion | 293 | 338 | 51 | false | [ie/vidyard] Add support for chapter metadata | 14,478 | yt-dlp/yt-dlp | 132,642 | Python | exterrestris | exterrestris |
import re
from .common import InfoExtractor
from ..utils import (
extract_attributes,
float_or_none,
int_or_none,
join_nonempty,
mimetype2ext,
parse_resolution,
str_or_none,
unescapeHTML,
url_or_none,
)
from ..utils.traversal import traverse_obj
class VidyardBaseIE(InfoExtractor):... | The http://videos.vivint.com/watch/DXx2sW4WaLA6hTdGFz7ja8 test above currently fails as the certificate for the site expired earlier this month (on 10/09/2025). I have left this test in place for now on the assumption that the certificate will be renewed/replaced in the near future | 'id': 'GDx1oXrFWj4XHbipfoXaMn',
'display_id': '3225198',
'ext': 'mp4',
'title': 'The Extreme Importance of PC Board Stack Up',
'thumbnail': 'https://cdn.vidyard.com/thumbnails/73_Q3_hBexWX7Og1sae6cg/9998fa4faec921439e2c04_small.jpg',
'duration': 34... | @@ -317,83 +290,22 @@ class VidyardIE(VidyardBaseIE):
'ext': 'mp4', | yt_dlp/extractor/vidyard.py | 26 | Python | 0.5 | bug | 282 | 338 | 51 | false | [ie/vidyard] Add support for chapter metadata | 14,478 | yt-dlp/yt-dlp | 132,642 | Python | exterrestris | exterrestris |
self._remove_duplicate_formats(formats)
return formats, subtitles
def _get_direct_subtitles(self, caption_json):
subs = {}
for caption in traverse_obj(caption_json, lambda _, v: url_or_none(v['vttUrl'])):
subs.setdefault(caption.get('language') or 'und', []).append({
... | If we make that additional request, we might as well use all the metadata
```suggestion
def _get_additional_metadata(self, video_id):
additional_metadata = self._download_json(
f'https://play.vidyard.com/video/{video_id}', video_id,
note='Downloading additional metadata', fatal=... | self._remove_duplicate_formats(formats)
return formats, subtitles
def _get_direct_subtitles(self, caption_json):
subs = {}
for caption in traverse_obj(caption_json, lambda _, v: url_or_none(v['vttUrl'])):
subs.setdefault(caption.get('language') or 'und', []).append({
... | @@ -58,6 +58,20 @@ def _get_direct_subtitles(self, caption_json):
return subs
+ def _get_chapters(self, video_id):
+ sections_json = self._download_json(
+ f'https://play.vidyard.com/video/{video_id}', video_id, note='Downloading chapter metadata', fatal=False)
+
+ if sections_j... | yt_dlp/extractor/vidyard.py | 26 | Python | 1 | suggestion | 809 | 51 | 51 | false | [ie/vidyard] Add support for chapter metadata | 14,478 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | exterrestris |
from .vidyard import VidyardBaseIE, VidyardIE
from ..utils import ExtractorError, make_archive_id, url_basename
class CellebriteIE(VidyardBaseIE):
_VALID_URL = r'https?://cellebrite\.com/(?:\w+)?/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://cellebrite.com/en/how-to-lawfully-collect-the-maximum-amount-o... | This page now redirects to a page with no embeds, however the test case looks to be a duplicate of the following (working) test case, so I've removed it | from .vidyard import VidyardBaseIE, VidyardIE
from ..utils import ExtractorError, make_archive_id, url_basename
class CellebriteIE(VidyardBaseIE):
_VALID_URL = r'https?://cellebrite\.com/(?:\w+)?/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://cellebrite.com/en/how-to-lawfully-collect-the-maximum-amount-o... | @@ -5,26 +5,14 @@
class CellebriteIE(VidyardBaseIE):
_VALID_URL = r'https?://cellebrite\.com/(?:\w+)?/(?P<id>[\w-]+)'
_TESTS = [{
- 'url': 'https://cellebrite.com/en/collect-data-from-android-devices-with-cellebrite-ufed/',
- 'info_dict': {
- 'id': 'ZqmUss3dQfEMGpauambPuH',
- ... | yt_dlp/extractor/cellebrite.py | 19 | Python | 0.429 | refactor | 152 | 39 | 39 | false | [ie/vidyard] Add support for chapter metadata | 14,478 | yt-dlp/yt-dlp | 132,642 | Python | exterrestris | exterrestris |
'ext': mimetype2ext(source.get('mimeType'), default=None),
'format_id': join_nonempty('http', source_type, profile),
**parse_resolution(profile),
})
self._remove_duplicate_formats(formats)
return formats, subtitles
def _ge... | this will conflict with the `thumbnails` field that we are extracting from `json_Data` | 'ext': mimetype2ext(source.get('mimeType'), default=None),
'format_id': join_nonempty('http', source_type, profile),
**parse_resolution(profile),
})
self._remove_duplicate_formats(formats)
return formats, subtitles
def _ge... | @@ -58,6 +58,20 @@ def _get_direct_subtitles(self, caption_json):
return subs
+ def _get_additional_metadata(self, video_id):
+ additional_metadata = self._download_json(
+ f'https://play.vidyard.com/video/{video_id}', video_id,
+ note='Downloading additional metadata', fata... | yt_dlp/extractor/vidyard.py | 26 | Python | 0.429 | refactor | 86 | 51 | 51 | false | [ie/vidyard] Add support for chapter metadata | 14,478 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | exterrestris |
})
self._remove_duplicate_formats(formats)
return formats, subtitles
def _get_direct_subtitles(self, caption_json):
subs = {}
for caption in traverse_obj(caption_json, lambda _, v: url_or_none(v['vttUrl'])):
subs.setdefault(caption.get('language') or 'un... | should filter for start_time
```suggestion
'chapters': ('videoSections', lambda _, v: float_or_none(v['milliseconds']) is not None, {
'title': ('title', {str}),
'start_time': ('milliseconds', {float_or_none(scale=1000)}),
``` | })
self._remove_duplicate_formats(formats)
return formats, subtitles
def _get_direct_subtitles(self, caption_json):
subs = {}
for caption in traverse_obj(caption_json, lambda _, v: url_or_none(v['vttUrl'])):
subs.setdefault(caption.get('language') or 'un... | @@ -58,6 +58,20 @@ def _get_direct_subtitles(self, caption_json):
return subs
+ def _get_additional_metadata(self, video_id):
+ additional_metadata = self._download_json(
+ f'https://play.vidyard.com/video/{video_id}', video_id,
+ note='Downloading additional metadata', fata... | yt_dlp/extractor/vidyard.py | 26 | Python | 0.857 | suggestion | 274 | 51 | 51 | false | [ie/vidyard] Add support for chapter metadata | 14,478 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | exterrestris |
'ext': mimetype2ext(source.get('mimeType'), default=None),
'format_id': join_nonempty('http', source_type, profile),
**parse_resolution(profile),
})
self._remove_duplicate_formats(formats)
return formats, subtitles
def _ge... | mb
```suggestion
'thumbnails': ('thumbnailUrl', {'url': {url_or_none}}, all),
``` | 'ext': mimetype2ext(source.get('mimeType'), default=None),
'format_id': join_nonempty('http', source_type, profile),
**parse_resolution(profile),
})
self._remove_duplicate_formats(formats)
return formats, subtitles
def _ge... | @@ -58,6 +58,20 @@ def _get_direct_subtitles(self, caption_json):
return subs
+ def _get_additional_metadata(self, video_id):
+ additional_metadata = self._download_json(
+ f'https://play.vidyard.com/video/{video_id}', video_id,
+ note='Downloading additional metadata', fata... | yt_dlp/extractor/vidyard.py | 26 | Python | 0.571 | suggestion | 96 | 51 | 51 | false | [ie/vidyard] Add support for chapter metadata | 14,478 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | exterrestris |
'description': 'md5:665bb36ec2a12c5a7f598ee713fc2b54',
},
'playlist_mincount': 11,
}, {
'url': 'https://www3.nhk.or.jp/nhkworld/en/shows/10yearshayaomiyazaki/',
'only_matching': True,
}]
@classmethod
def suitable(cls, url):
return False if NhkVodIE.su... | ```suggestion
for episode in traverse_obj(episodes, ('items', lambda _, v: v['url'])):
yield self._extract_episode_info(urljoin(url, episode['url']), episode)
``` |
def _real_extract(self, url):
lang, m_type, program_id, episode_type = self._match_valid_url(url).group('lang', 'type', 'id', 'episode_type')
episodes = self._call_api(
program_id, lang, m_type != 'audio', False, episode_type == 'clip')
def entries():
for episode in... | @@ -430,7 +352,7 @@ def _real_extract(self, url):
program_id, lang, m_type != 'audio', False, episode_type == 'clip')
def entries():
- for episode in episodes:
+ for episode in episodes['items']:
if episode_path := episode.get('url'):
y... | yt_dlp/extractor/nhk.py | 26 | Python | 0.786 | refactor | 193 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
orderedSet,
parse_duration,
remove_end,
traverse_obj,
try_call,
unescapeHTML,
unified_timestamp,
url_or_none,
urljoin,
variadic,
)
class NhkBaseIE(InfoExtractor):
_API_URL_TEMPLATE = 'https://api.nhkworld.jp/showsapi/v1/{lang}/{content_format}_{page_type}/{m_id}{extra_page}... | ```suggestion
content_format = 'video' if is_video else 'audio'
content_type = 'clips' if is_clip else 'episodes'
if not is_episode:
extra_page = f'/{content_format}_{content_type}'
page_type = 'programs'
else:
extra_page = ''
pag... | orderedSet,
parse_duration,
remove_end,
traverse_obj,
try_call,
unescapeHTML,
unified_timestamp,
url_or_none,
urljoin,
variadic,
)
class NhkBaseIE(InfoExtractor):
_API_URL_TEMPLATE = 'https://api.nhkworld.jp/showsapi/v1/{lang}/{content_format}_{page_type}/{m_id}{extra_page}... | @@ -23,96 +23,56 @@
class NhkBaseIE(InfoExtractor):
- _API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkworld/%sod%slist/v7b/%s/%s/%s/all%s.json'
+ _API_URL_TEMPLATE = 'https://api.nhkworld.jp/showsapi/v1/{lang}/{content_format}_{page_type}/{m_id}{extra_page}'
_BASE_URL_REGEX = r'https?://www3\.nhk\.or\.jp/n... | yt_dlp/extractor/nhk.py | 26 | Python | 0.929 | suggestion | 346 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
def _call_api(self, m_id, lang, is_video, is_episode, is_clip):
content_format = 'video' if is_video else 'audio'
if not is_episode:
page_type = 'programs'
if is_clip:
content_type = 'clips'
else:
content_type = 'episodes'
if not is_epi... | ```suggestion
return self._download_json(
self._API_URL_TEMPLATE.format(
lang=lang, content_format=content_format, page_type=page_type,
m_id=m_id, extra_page=extra_page),
join_nonempty(m_id, lang))
``` |
def _call_api(self, m_id, lang, is_video, is_episode, is_clip):
content_format = 'video' if is_video else 'audio'
content_type = 'clips' if is_clip else 'episodes'
if not is_episode:
extra_page = f'/{content_format}_{content_type}'
page_type = 'programs'
else... | @@ -23,96 +23,56 @@
class NhkBaseIE(InfoExtractor):
- _API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkworld/%sod%slist/v7b/%s/%s/%s/all%s.json'
+ _API_URL_TEMPLATE = 'https://api.nhkworld.jp/showsapi/v1/{lang}/{content_format}_{page_type}/{m_id}{extra_page}'
_BASE_URL_REGEX = r'https?://www3\.nhk\.or\.jp/n... | yt_dlp/extractor/nhk.py | 26 | Python | 0.929 | suggestion | 271 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
content_type = 'clips'
else:
content_type = 'episodes'
if not is_episode:
extra_page = f'/{content_format}_{content_type}'
else:
extra_page = ''
page_type = content_type
return self._download_json(self._API_URL_TEMPLATE.format... | I don't understand this comment, so it's not helpful here IMO. Add them as tests if you need them as examples
```suggestion
``` | extra_page = ''
page_type = content_type
return self._download_json(
self._API_URL_TEMPLATE.format(
lang=lang, content_format=content_format, page_type=page_type,
m_id=m_id, extra_page=extra_page),
join_nonempty(m_id, lang))
d... | @@ -23,96 +23,56 @@
class NhkBaseIE(InfoExtractor):
- _API_URL_TEMPLATE = 'https://nwapi.nhk.jp/nhkworld/%sod%slist/v7b/%s/%s/%s/all%s.json'
+ _API_URL_TEMPLATE = 'https://api.nhkworld.jp/showsapi/v1/{lang}/{content_format}_{page_type}/{m_id}{extra_page}'
_BASE_URL_REGEX = r'https?://www3\.nhk\.or\.jp/n... | yt_dlp/extractor/nhk.py | 26 | Python | 0.714 | suggestion | 129 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
episode_name = title
if series and title:
title = f'{series} - {title}'
elif series and not title:
title = series
series = None
episode_name = None
else: # title, no series
episode_name = None
info = {
'id'... | ```suggestion
**traverse_obj(episode, {
'description': ('description', {str}),
'release_timestamp': ('first_broadcasted_at', {unified_timestamp}),
'categories': ('categories', ..., 'name', {str}),
'tags': ('tags', ..., 'name', {str}),
... | 'categories': ('categories', ..., 'name', {str}),
'tags': ('tags', ..., 'name', {str}),
'thumbnails': ('images', lambda _, v: v['url'], {
'url': ('url', {urljoin(url)}),
'width': ('width', {int_or_none}),
'height... | @@ -125,37 +85,54 @@ def get_clean_field(key):
episode_name = None
info = {
- 'id': episode_id + '-' + lang,
+ 'id': video_id,
'title': title,
- 'description': get_clean_field('description'),
- 'thumbnails': thumbnails,
'serie... | yt_dlp/extractor/nhk.py | 26 | Python | 0.929 | suggestion | 592 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
title = series
series = None
episode_name = None
else: # title, no series
episode_name = None
info = {
'id': video_id,
'title': title,
'series': series,
'episode': episode_name,
**traverse_obj(e... | comment isn't obvious to me: are we making the foolish assumption? If so, this should be a TODO to investigate if an episode can be both at once
```suggestion
# FOOLISH ASSUMPTION: an episode can't be video and audio at the same time
stream_info = traverse_obj(episode, (('video', 'audio'), {dict}, an... | 'width': ('width', {int_or_none}),
'height': ('height', {int_or_none}),
}),
'webpage_url': ('url', {urljoin(url)}),
}),
'extractor_key': NhkVodIE.ie_key(),
'extractor': NhkVodIE.IE_NAME,
}
# XXX:... | @@ -125,37 +85,54 @@ def get_clean_field(key):
episode_name = None
info = {
- 'id': episode_id + '-' + lang,
+ 'id': video_id,
'title': title,
- 'description': get_clean_field('description'),
- 'thumbnails': thumbnails,
'serie... | yt_dlp/extractor/nhk.py | 26 | Python | 0.857 | suggestion | 334 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
series = None
episode_name = None
else: # title, no series
episode_name = None
info = {
'id': video_id,
'title': title,
'series': series,
'episode': episode_name,
**traverse_obj(episode, ({
... | ```suggestion
if not stream_info.get('url'):
``` | 'height': ('height', {int_or_none}),
}),
'webpage_url': ('url', {urljoin(url)}),
}),
'extractor_key': NhkVodIE.ie_key(),
'extractor': NhkVodIE.IE_NAME,
}
# XXX: We are assuming that 'video' and 'audio' are mutually ... | @@ -125,37 +85,54 @@ def get_clean_field(key):
episode_name = None
info = {
- 'id': episode_id + '-' + lang,
+ 'id': video_id,
'title': title,
- 'description': get_clean_field('description'),
- 'thumbnails': thumbnails,
'serie... | yt_dlp/extractor/nhk.py | 26 | Python | 0.571 | suggestion | 58 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
episode_name = None
info = {
'id': video_id,
'title': title,
'series': series,
'episode': episode_name,
**traverse_obj(episode, ({
'description': 'description',
'release_timestamp': ('first_broadcasted_at', ... | ```suggestion
stream_url = stream_info['url']
``` | }),
'extractor_key': NhkVodIE.ie_key(),
'extractor': NhkVodIE.IE_NAME,
}
# XXX: We are assuming that 'video' and 'audio' are mutually exclusive
stream_info = traverse_obj(episode, (('video', 'audio'), {dict}, any)) or {}
if not stream_info.get('url'):... | @@ -125,37 +85,54 @@ def get_clean_field(key):
episode_name = None
info = {
- 'id': episode_id + '-' + lang,
+ 'id': video_id,
'title': title,
- 'description': get_clean_field('description'),
- 'thumbnails': thumbnails,
'serie... | yt_dlp/extractor/nhk.py | 26 | Python | 0.571 | suggestion | 63 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
**traverse_obj(episode, ({
'description': 'description',
'release_timestamp': ('first_broadcasted_at', {unified_timestamp}),
'categories': ('categories', ..., 'name'),
'tags': ('tags', ..., 'name'),
'thumbnails': ('images', ...,... | ```suggestion
'duration': ('duration', {int_or_none}),
``` | if not stream_info.get('url'):
self.raise_no_formats('Stream not found; it has most likely expired', expected=True)
else:
stream_url = stream_info['url']
if is_video:
formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_url, video_id)
... | @@ -125,37 +85,54 @@ def get_clean_field(key):
episode_name = None
info = {
- 'id': episode_id + '-' + lang,
+ 'id': video_id,
'title': title,
- 'description': get_clean_field('description'),
- 'thumbnails': thumbnails,
'serie... | yt_dlp/extractor/nhk.py | 26 | Python | 0.571 | suggestion | 84 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
else:
stream_url = stream_info.get('url')
if is_video:
formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_url, video_id)
info.update({
'formats': formats,
'subtitles': subtitles,
... | is this method used directly by a playlist extractor?
if not, then this is unnecessary
if so, then unindent this block so the fields are still added when `--ignore-no-formats` is passed (or even better, remove this block and add these fields when the info dict is first constructed) | info['formats'] = self._extract_m3u8_formats(
f'{urljoin("https://vod-stream.nhk.jp", audio_path)}/index.m3u8',
episode_id, 'm4a', entry_protocol='m3u8_native',
m3u8_id='hls', fatal=False)
for f in info['formats']:
... | @@ -125,37 +85,54 @@ def get_clean_field(key):
episode_name = None
info = {
- 'id': episode_id + '-' + lang,
+ 'id': video_id,
'title': title,
- 'description': get_clean_field('description'),
- 'thumbnails': thumbnails,
'serie... | yt_dlp/extractor/nhk.py | 26 | Python | 0.643 | refactor | 288 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
elif series and not title:
title = series
series = None
episode_name = None
else: # title, no series
episode_name = None
info = {
'id': video_id,
'title': title,
'series': series,
'episode': episode... | ```suggestion
'extractor': NhkVodIE.IE_NAME,
``` | elif series and not title:
title = series
series = None
episode_name = None
else: # title, no series
episode_name = None
info = {
'id': video_id,
'title': title,
'series': series,
'episode': episode... | @@ -125,37 +67,52 @@ def get_clean_field(key):
episode_name = None
info = {
- 'id': episode_id + '-' + lang,
+ 'id': video_id,
'title': title,
- 'description': get_clean_field('description'),
- 'thumbnails': thumbnails,
'serie... | yt_dlp/extractor/nhk.py | 26 | Python | 0.643 | refactor | 62 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
episode_name = None
else: # title, no series
episode_name = None
info = {
'id': video_id,
'title': title,
'series': series,
'episode': episode_name,
**traverse_obj(episode, {
'description': ('descriptio... | ```suggestion
# XXX: We are assuming that 'video' and 'audio' are mutually exclusive
``` | episode_name = None
else: # title, no series
episode_name = None
info = {
'id': video_id,
'title': title,
'series': series,
'episode': episode_name,
**traverse_obj(episode, {
'description': ('descriptio... | @@ -125,37 +67,52 @@ def get_clean_field(key):
episode_name = None
info = {
- 'id': episode_id + '-' + lang,
+ 'id': video_id,
'title': title,
- 'description': get_clean_field('description'),
- 'thumbnails': thumbnails,
'serie... | yt_dlp/extractor/nhk.py | 26 | Python | 0.571 | suggestion | 98 | 51 | 51 | false | NHK World: migrate to yet another new API/stream provider | 14,528 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | garret1317 |
import functools
from .common import InfoExtractor
from .vimeo import VHXEmbedIE
from ..utils import (
ExtractorError,
OnDemandPagedList,
clean_html,
extract_attributes,
get_element_by_class,
get_element_by_id,
get_elements_html_by_class,
int_or_none,
traverse_obj,
unified_strda... | Let's match both the www and watch subdomin. While at it, we can also fix the regex to no longer be overly broad or not match URLs with query args or a fragment.
```suggestion
_VALID_URL = r'https?://(?:watch\.)?dropout\.tv/(?:[^/?#]+/)*videos/(?P<id>[^/?#]+)/?(?:[?#]|$)'
``` | import functools
from .common import InfoExtractor
from .vimeo import VHXEmbedIE
from ..utils import (
ExtractorError,
OnDemandPagedList,
clean_html,
extract_attributes,
get_element_by_class,
get_element_by_id,
get_elements_html_by_class,
int_or_none,
traverse_obj,
unified_strda... | @@ -18,15 +18,15 @@
class DropoutIE(InfoExtractor):
- _LOGIN_URL = 'https://www.dropout.tv/login'
+ _LOGIN_URL = 'https://watch.dropout.tv/login'
_NETRC_MACHINE = 'dropout'
- _VALID_URL = r'https?://(?:www\.)?dropout\.tv/(?:[^/]+/)*videos/(?P<id>[^/]+)/?$'
+ _VALID_URL = r'https?://(?:watch\.)?d... | yt_dlp/extractor/dropout.py | 24 | Python | 0.786 | suggestion | 283 | 49 | 49 | false | [ie/dropout] Update to the new dropout domain | 14,531 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | cecilia-sanare |
if action not in cls.Actions:
raise ValueError(f'{action!r} is not a valid action')
action(cls, *data) # So this can raise error to validate
@staticmethod
def field_to_template(tmpl):
if re.match(r'[a-zA-Z_]+$', tmpl):
return f'%({tmpl})s'
from ..Youtub... | following L52 (R54)
```suggestion
return rf'(?P<{fmt}>.+)'
``` | if action not in cls.Actions:
raise ValueError(f'{action!r} is not a valid action')
action(cls, *data) # So this can raise error to validate
@staticmethod
def field_to_template(tmpl):
if re.match(r'[a-zA-Z_]+$', tmpl):
return f'%({tmpl})s'
from ..Youtub... | @@ -43,6 +43,8 @@ def format_to_regex(fmt):
'(?P<title>.+)\ \-\ (?P<artist>.+)'
"""
if not re.search(r'%\(\w+\)s', fmt):
+ if re.match(r'\w+', fmt):
+ return r'(?P<' + fmt + '>.+)' | yt_dlp/postprocessor/metadataparser.py | 26 | Python | 0.571 | suggestion | 81 | 51 | 51 | false | Fix `--parse-metadata` when `TO` is a single field name | 14,577 | yt-dlp/yt-dlp | 132,642 | Python | atsushi2965 | clayote |
(Actions.REPLACE, field, search, replace)
"""
if action not in cls.Actions:
raise ValueError(f'{action!r} is not a valid action')
action(cls, *data) # So this can raise error to validate
@staticmethod
def field_to_template(tmpl):
if re.match(r'[a-zA-... | ```suggestion
ALLOWABLE_GROUP_NAME_RE = r'[a-zA-Z][a-zA-Z0-9_]*'
``` | (Actions.REPLACE, field, search, replace)
"""
if action not in cls.Actions:
raise ValueError(f'{action!r} is not a valid action')
action(cls, *data) # So this can raise error to validate
@staticmethod
def field_to_template(tmpl):
if re.match(r'[a-zA-... | @@ -42,12 +42,16 @@ def format_to_regex(fmt):
to a regex like
'(?P<title>.+)\ \-\ (?P<artist>.+)'
"""
- if not re.search(r'%\(\w+\)s', fmt):
+ ALLOWABLE_GROUP_NAME_RE = r'[a-zA-Z](?:[a-zA-Z0-9_]+)?' | yt_dlp/postprocessor/metadataparser.py | 26 | Python | 0.571 | suggestion | 78 | 51 | 51 | false | Fix `--parse-metadata` when `TO` is a single field name | 14,577 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | clayote |
@staticmethod
def field_to_template(tmpl):
if re.match(r'[a-zA-Z_]+$', tmpl):
return f'%({tmpl})s'
from ..YoutubeDL import YoutubeDL
err = YoutubeDL.validate_outtmpl(tmpl)
if err:
raise err
return tmpl
@staticmethod
def format_to_regex(f... | ```suggestion
if re.fullmatch(ALLOWABLE_GROUP_NAME_RE, fmt):
# convert a single field name into regex pattern that matches the entire input
return rf'(?s)(?P<{fmt}>.+)'
if not re.search(rf'%\({ALLOWABLE_GROUP_NAME_RE}\)s', fmt):
return fmt
``` |
@staticmethod
def field_to_template(tmpl):
if re.match(r'[a-zA-Z_]+$', tmpl):
return f'%({tmpl})s'
from ..YoutubeDL import YoutubeDL
err = YoutubeDL.validate_outtmpl(tmpl)
if err:
raise err
return tmpl
@staticmethod
def format_to_regex(f... | @@ -42,12 +42,16 @@ def format_to_regex(fmt):
to a regex like
'(?P<title>.+)\ \-\ (?P<artist>.+)'
"""
- if not re.search(r'%\(\w+\)s', fmt):
+ ALLOWABLE_GROUP_NAME_RE = r'[a-zA-Z][a-zA-Z0-9_]*'
+ if not re.search(rf'%\({ALLOWABLE_GROUP_NAME_RE}\)s', fmt):
+ ... | yt_dlp/postprocessor/metadataparser.py | 26 | Python | 0.786 | suggestion | 301 | 51 | 51 | false | Fix `--parse-metadata` when `TO` is a single field name | 14,577 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | clayote |
import re
from .common import PostProcessor
from ..utils import Namespace, filter_dict, function_with_repr
_NON_ASCII_NUMBERS = '\xB2\xB3\xB9'
_NON_ASCII_LETTERS = '\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\xFF'
_ALLOWABLE_GROUP_NAME_RE = rf'[A-Z_a-z{_NON_ASCII_LETTERS}][0-9A-Z_a-z{_NON_ASCII_NUMBERS}{_NON_ASCII_LETTERS}]*... | ```suggestion
_NON_ASCII_LETTERS = '\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\xFF'
_ALLOWABLE_GROUP_NAME_RE = rf'[A-Z_a-z{_NON_ASCII_LETTERS}][0-9A-Z_a-z\xB2\xB3\xB9{_NON_ASCII_LETTERS}]*'
``` | import re
from .common import PostProcessor
from ..utils import Namespace, filter_dict, function_with_repr
class MetadataParserPP(PostProcessor):
def __init__(self, downloader, actions):
super().__init__(downloader)
self._actions = []
for f in actions:
action, *args = f
... | @@ -3,6 +3,10 @@
from .common import PostProcessor
from ..utils import Namespace, filter_dict, function_with_repr
+_NON_ASCII_NUMBERS = '\xB2\xB3\xB9'
+_NON_ASCII_LETTERS = '\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\xFF'
+_ALLOWABLE_GROUP_NAME_RE = rf'[A-Z_a-z{_NON_ASCII_LETTERS}][0-9A-Z_a-z{_NON_ASCII_NUMBERS}{_NON_ASCI... | yt_dlp/postprocessor/metadataparser.py | 8 | Python | 0.714 | suggestion | 189 | 33 | 33 | false | Fix `--parse-metadata` when `TO` is a single field name | 14,577 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | clayote |
import subprocess
from yt_dlp import YoutubeDL
from yt_dlp.utils import shell_quote
from yt_dlp.postprocessor import (
ExecPP,
FFmpegThumbnailsConvertorPP,
MetadataFromFieldPP,
MetadataParserPP,
ModifyChaptersPP,
SponsorBlockPP,
)
class TestMetadataFromField(unittest.TestCase):
def test_... | ```suggestion
self.assertEqual(MetadataParserPP.format_to_regex(r'(?P<x>.+)'), r'(?P<x>.+)')
self.assertEqual(MetadataParserPP.format_to_regex(r'text (?P<x>.+)'), r'text (?P<x>.+)')
self.assertEqual(MetadataParserPP.format_to_regex('x'), r'(?s)(?P<x>.+)')
self.assertEqual(MetadataPar... | import subprocess
from yt_dlp import YoutubeDL
from yt_dlp.utils import shell_quote
from yt_dlp.postprocessor import (
ExecPP,
FFmpegThumbnailsConvertorPP,
MetadataFromFieldPP,
MetadataParserPP,
ModifyChaptersPP,
SponsorBlockPP,
)
class TestMetadataFromField(unittest.TestCase):
def test_... | @@ -29,6 +29,11 @@ def test_format_to_regex(self):
MetadataParserPP.format_to_regex('%(title)s - %(artist)s'),
r'(?P<title>.+)\ \-\ (?P<artist>.+)')
self.assertEqual(MetadataParserPP.format_to_regex(r'(?P<x>.+)'), r'(?P<x>.+)')
+ self.assertEqual(MetadataParserPP.format_to_rege... | test/test_postprocessors.py | 26 | Python | 0.786 | suggestion | 880 | 51 | 51 | false | Fix `--parse-metadata` when `TO` is a single field name | 14,577 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | clayote |
import json
import re
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
class NowCanalIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-u... | Please add a match only test for a different URL pattern like https://www.nowcanal.pt/programas/frente-a-frente/detalhe/frente-a-frente-pedro-anastacio-ps-e-mario-amorim-lopes-il | from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
class NowCanalIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt(?:/[\w-]+)+/detalhe/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-spo... | @@ -0,0 +1,41 @@
+import json
+import re
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class NowCanalIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
+ _TESTS = [{
+ 'url': 'https://www.nowcanal.pt/ultimas/detalhe/ped... | yt_dlp/extractor/nowcanal.py | 21 | Python | 0.357 | suggestion | 178 | 42 | 38 | false | [ie/NowCanal] Add extractor | 14,584 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pferreir |
class NowCanalIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-sporting-daqui-a-um-ano',
'md5': '047f17cb783e66e467d703e704bbc95d',
... | use the IE helper functions
```suggestion
video_data = self._search_json(
r'videoHandler\.addBrightcoveVideoWithJson\(\[', webpage, 'video data', video_id)
```
Also can it happen that a page contains multiple videos, and do we need to deal with this? | _TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-sporting-daqui-a-um-ano',
'md5': '047f17cb783e66e467d703e704bbc95d',
'info_dict': {
'id': '6376598467112',
'ext': 'mp4',
'title': 'Pedro Sousa «Hju... | @@ -0,0 +1,41 @@
+import json
+import re
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class NowCanalIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
+ _TESTS = [{
+ 'url': 'https://www.nowcanal.pt/ultimas/detalhe/ped... | yt_dlp/extractor/nowcanal.py | 26 | Python | 1 | refactor | 275 | 36 | 32 | false | [ie/NowCanal] Add extractor | 14,584 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pferreir |
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-sporting-daqui-a-um-ano',
'md5': '047f17cb783e66e467d703e704bbc95d',
'info_dict': {
'id': '6376598467112',
'ext': 'mp4',
'title': 'Pedro Sousa «Hjulmand pode ter u... | I'd inline the bc_id, and turn the other two in to class constants | 'id': '6376598467112',
'ext': 'mp4',
'title': 'Pedro Sousa «Hjulmand pode ter uma saída limpa do Sporting daqui a um ano»',
'description': '',
'uploader_id': '6108484330001',
'duration': 65.237,
'thumbnail': r're:^https://.+\.jpg',
... | @@ -0,0 +1,41 @@
+import json
+import re
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class NowCanalIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
+ _TESTS = [{
+ 'url': 'https://www.nowcanal.pt/ultimas/detalhe/ped... | yt_dlp/extractor/nowcanal.py | 26 | Python | 0.214 | suggestion | 66 | 32 | 28 | false | [ie/NowCanal] Add extractor | 14,584 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | pferreir |
class NowCanalIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-sporting-daqui-a-um-ano',
'md5': '047f17cb783e66e467d703e704bbc95d',
... | This is the convention for Brightcove embed extractors. It has the benefit of keeping your `return` line short and sweet (and readable)
```suggestion
_BC_URL_TMPL = 'https://players.brightcove.net/chhIqzukMq/6108484330001_default/index.html?videoId={}'
``` |
class NowCanalIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt(?:/[\w-]+)+/detalhe/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-sporting-daqui-a-um-ano',
'md5': '047f17cb783e66e467d703e704bbc95d',
... | @@ -0,0 +1,41 @@
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class NowCanalIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
+ _TESTS = [{
+ 'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-t... | yt_dlp/extractor/nowcanal.py | 26 | Python | 0.857 | refactor | 263 | 39 | 35 | false | [ie/NowCanal] Add extractor | 14,584 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pferreir |
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-sporting-daqui-a-um-ano',
'md5': '047f17cb783e66e467d703e704bbc95d',
'info_dict': {
'id': '6376598467112',
'ext': 'mp4',
'title': 'Pedro Sousa «Hju... | `display_id` more appropriate here since we don't use it for anything other than display
```suggestion
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
``` | 'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-sporting-daqui-a-um-ano',
'md5': '047f17cb783e66e467d703e704bbc95d',
'info_dict': {
'id': '6376598467112',
'ext': 'mp4',
'title': 'Pedro Sousa «Hjulmand pode ter u... | @@ -0,0 +1,41 @@
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class NowCanalIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
+ _TESTS = [{
+ 'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-t... | yt_dlp/extractor/nowcanal.py | 26 | Python | 0.857 | suggestion | 209 | 35 | 31 | false | [ie/NowCanal] Add extractor | 14,584 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pferreir |
'info_dict': {
'id': '6376598467112',
'ext': 'mp4',
'title': 'Pedro Sousa «Hjulmand pode ter uma saída limpa do Sporting daqui a um ano»',
'description': '',
'uploader_id': '6108484330001',
'duration': 65.237,
'thumbnail': r're:... | we don't use `video_data` for anything else, so let's get the BC `video_id` right away
```suggestion
video_id = self._search_json(
r'videoHandler\.addBrightcoveVideoWithJson\(\[',
webpage, 'video data', display_id)['brightcoveVideoId']
``` | 'id': '6376598467112',
'ext': 'mp4',
'title': 'Pedro Sousa «Hjulmand pode ter uma saída limpa do Sporting daqui a um ano»',
'description': '',
'uploader_id': '6108484330001',
'duration': 65.237,
'thumbnail': r're:^https://.+\.jpg',
... | @@ -0,0 +1,41 @@
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class NowCanalIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
+ _TESTS = [{
+ 'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-t... | yt_dlp/extractor/nowcanal.py | 26 | Python | 1 | suggestion | 276 | 32 | 28 | false | [ie/NowCanal] Add extractor | 14,584 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pferreir |
'uploader_id': '6108484330001',
'duration': 65.237,
'thumbnail': r're:^https://.+\.jpg',
'timestamp': 1754440620,
'upload_date': '20250806',
'tags': ['now'],
},
}, {
'url': 'https://www.nowcanal.pt/programas/frente-a-frente/deta... | ```suggestion
return self.url_result(self._BC_URL_TMPL.format(video_id), BrightcoveNewIE)
``` | from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
class NowCanalIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt(?:/[\w-]+)+/detalhe/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-spo... | @@ -0,0 +1,41 @@
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class NowCanalIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
+ _TESTS = [{
+ 'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-t... | yt_dlp/extractor/nowcanal.py | 26 | Python | 0.714 | suggestion | 103 | 27 | 38 | false | [ie/NowCanal] Add extractor | 14,584 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pferreir |
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
class NowCanalIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-spor... | ```suggestion
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
``` | from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
class NowCanalIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt(?:/[\w-]+)+/detalhe/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-spo... | @@ -0,0 +1,41 @@
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor | yt_dlp/extractor/nowcanal.py | 3 | Python | 0.643 | refactor | 94 | 28 | 28 | false | [ie/NowCanal] Add extractor | 14,584 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pferreir |
from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
class NowCanalIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)'
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-spor... | ```suggestion
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt(?:/[\w-]+)+/detalhe/(?P<id>[\w-]+)'
``` | from .brightcove import BrightcoveNewIE
from .common import InfoExtractor
class NowCanalIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?nowcanal\.pt(?:/[\w-]+)+/detalhe/(?P<id>[\w-]+)'
_TESTS = [{
'url': 'https://www.nowcanal.pt/ultimas/detalhe/pedro-sousa-hjulmand-pode-ter-uma-saida-limpa-do-spo... | @@ -0,0 +1,41 @@
+
+from .brightcove import BrightcoveNewIE
+from .common import InfoExtractor
+
+
+class NowCanalIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?nowcanal\.pt/[\w\-/]+/detalhe/(?P<id>[\w\-]+)' | yt_dlp/extractor/nowcanal.py | 7 | Python | 0.714 | suggestion | 106 | 32 | 32 | false | [ie/NowCanal] Add extractor | 14,584 | yt-dlp/yt-dlp | 132,642 | Python | bashonly | pferreir |
from .common import InfoExtractor
from ..utils import traverse_obj, unified_timestamp
class IdagioTrackIE(InfoExtractor):
"""
This extractor is only used internally to extract the info about tracks contained in every recording, album or
playlist
"""
_VALID_URL = r'https?://(?:www\.)?api\.idagio\.c... | imo. we should not match the API URL, but the URL of the individual track (i.e. `https://app.idagio.com/recordings/30576934?trackId=30576943`) | from .common import InfoExtractor
from ..utils import int_or_none, unified_timestamp, url_or_none
from ..utils.traversal import traverse_obj
class IdagioTrackIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?app\.idagio\.com/recordings/\d+\?(?:[^#]+&)?trackId=(?P<id>\d+)'
_TESTS = [{
'url': 'https:... | @@ -0,0 +1,230 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, unified_timestamp
+
+
+class IdagioTrackIE(InfoExtractor):
+ """
+ This extractor is only used internally to extract the info about tracks contained in every recording, album or
+ playlist
+ """
+ _VALID_URL = r'https... | yt_dlp/extractor/idagio.py | 10 | Python | 0.571 | suggestion | 142 | 35 | 35 | false | [ie/idagio] Add extractors | 14,586 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | robin-mu |
'track_id': '30576943',
'timestamp': 1554474370029,
},
}, {
'url': 'https://api.idagio.com/v2.0/metadata/tracks/20514478',
'md5': '3acef2ea0feadf889123b70e5a1e7fa7',
'info_dict': {
'id': '20514478',
'ext': 'mp3',
'title': 'S... | yt-dlp code style would not include type information and break the lines differently. Also `track_info` is non-mandatory, right? So might as well make it non-fatal and get the `result` key below.
```suggestion
track_id = self._match_id(url)
track_info = self._download_json(
f'https://api... | }, {
'url': 'https://app.idagio.com/recordings/20514467?trackId=20514478&utm_source=pcl',
'md5': '3acef2ea0feadf889123b70e5a1e7fa7',
'info_dict': {
'id': '20514478',
'ext': 'mp3',
'title': 'I. Adagio sostenuto',
'duration': 316,
'co... | @@ -0,0 +1,230 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, unified_timestamp
+
+
+class IdagioTrackIE(InfoExtractor):
+ """
+ This extractor is only used internally to extract the info about tracks contained in every recording, album or
+ playlist
+ """
+ _VALID_URL = r'https... | yt_dlp/extractor/idagio.py | 26 | Python | 0.929 | suggestion | 663 | 51 | 51 | false | [ie/idagio] Add extractors | 14,586 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | robin-mu |
track_id: str = self._match_id(url)
track_info: dict = self._download_json(f'https://api.idagio.com/v2.0/metadata/tracks/{track_id}',
track_id).get('result')
content_info: dict = self._download_json(f'https://api.idagio.com/v1.8/content/track/{trac... | The track title should just be the actual track title and not hardcode the album/recording title. If the user wants to include this, they should adjust the output template. Timestamps should be a second based unix timestamps.. All the `traverse_obj` calls can also be combined in to a single call like so:
```suggestion... | track_id, fatal=False, expected_status=406)
if traverse_obj(track_info, 'error_code') == 'idagio.error.blocked.location':
self.raise_geo_restricted()
content_info = self._download_json(
f'https://api.idagio.com/v1.8/content/track/{track_id}', track_id,
qu... | @@ -0,0 +1,230 @@
+from .common import InfoExtractor
+from ..utils import traverse_obj, unified_timestamp
+
+
+class IdagioTrackIE(InfoExtractor):
+ """
+ This extractor is only used internally to extract the info about tracks contained in every recording, album or
+ playlist
+ """
+ _VALID_URL = r'https... | yt_dlp/extractor/idagio.py | 26 | Python | 0.857 | refactor | 1,237 | 51 | 51 | false | [ie/idagio] Add extractors | 14,586 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | robin-mu |
},
'playlist_count': 19,
}]
def _real_extract(self, url):
album_display_id: str = self._match_id(url)
album_info: dict = self._download_json(f'https://api.idagio.com/v2.0/metadata/albums/{album_display_id}',
album_display_id).get('r... | You can expand and check individual types like so
```suggestion
'tags': ('tags', ..., {str}),
``` | 'url': 'https://app.idagio.com/albums/elgar-enigma-variations-in-the-south-serenade-for-strings',
'info_dict': {
'id': 'a9f139b8-f70d-4b8a-a9a4-5fe8d35eaf9c',
'display_id': 'elgar-enigma-variations-in-the-south-serenade-for-strings',
'title': 'Elgar: Enigma Variations... | @@ -0,0 +1,239 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj, unified_timestamp, url_or_none
+
+
+class IdagioTrackIE(InfoExtractor):
+ """
+ This extractor is only used internally to extract the info about tracks contained in every recording, album or
+ playlist
+ """... | yt_dlp/extractor/idagio.py | 26 | Python | 0.857 | suggestion | 116 | 51 | 51 | false | [ie/idagio] Add extractors | 14,586 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | robin-mu |
from .common import InfoExtractor
from ..utils import int_or_none, traverse_obj, unified_timestamp, url_or_none
class IdagioTrackIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?app\.idagio\.com/recordings/[0-9]+\?trackId=(?P<id>[0-9]+)(&[a-zA-Z0-9_-]+=[a-zA-Z0-9_-]+)*'
_TESTS = [{
'url': 'https:/... | No need to match the trailing part, also should support the trackId not being the first query paramter
```suggestion
_VALID_URL = r'https?://(?:www\.)?app\.idagio\.com/recordings/\d+\?(?:[^#]+&)?trackId=(?P<id>\d+)'
``` | from .common import InfoExtractor
from ..utils import int_or_none, unified_timestamp, url_or_none
from ..utils.traversal import traverse_obj
class IdagioTrackIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?app\.idagio\.com/recordings/\d+\?(?:[^#]+&)?trackId=(?P<id>\d+)'
_TESTS = [{
'url': 'https:... | @@ -0,0 +1,259 @@
+from .common import InfoExtractor
+from ..utils import int_or_none, traverse_obj, unified_timestamp, url_or_none
+
+
+class IdagioTrackIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?app\.idagio\.com/recordings/[0-9]+\?trackId=(?P<id>[0-9]+)(&[a-zA-Z0-9_-]+=[a-zA-Z0-9_-]+)*' | yt_dlp/extractor/idagio.py | 6 | Python | 0.857 | suggestion | 226 | 31 | 31 | false | [ie/idagio] Add extractors | 14,586 | yt-dlp/yt-dlp | 132,642 | Python | seproDev | robin-mu |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.