Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BBC Sounds] Tracklist Extraction #7788

Merged
merged 4 commits into from Sep 16, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 26 additions & 15 deletions yt_dlp/extractor/bbc.py
Expand Up @@ -15,11 +15,13 @@
float_or_none,
get_element_by_class,
int_or_none,
join_nonempty,
js_to_json,
parse_duration,
parse_iso8601,
parse_qs,
strip_or_none,
traverse_obj,
try_get,
unescapeHTML,
unified_timestamp,
Expand All @@ -41,7 +43,6 @@ class BBCCoUkIE(InfoExtractor):
iplayer(?:/[^/]+)?/(?:episode/|playlist/)|
music/(?:clips|audiovideo/popular)[/#]|
radio/player/|
sounds/play/|
events/[^/]+/play/[^/]+/
)
(?P<id>%s)(?!/(?:episodes|broadcasts|clips))
Expand Down Expand Up @@ -218,20 +219,6 @@ class BBCCoUkIE(InfoExtractor):
# rtmp download
'skip_download': True,
},
}, {
'url': 'https://www.bbc.co.uk/sounds/play/m0007jzb',
'note': 'Audio',
'info_dict': {
'id': 'm0007jz9',
'ext': 'mp4',
'title': 'BBC Proms, 2019, Prom 34: West鈥揈astern Divan Orchestra',
'description': "Live BBC Proms. West鈥揈astern Divan Orchestra with Daniel Barenboim and Martha Argerich.",
'duration': 9840,
},
'params': {
# rtmp download
'skip_download': True,
}
}, {
'url': 'http://www.bbc.co.uk/iplayer/playlist/p01dvks4',
'only_matching': True,
Expand Down Expand Up @@ -844,6 +831,20 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE
'upload_date': '20190604',
'categories': ['Psychology'],
},
}, {
# BBC Sounds
'url': 'https://www.bbc.co.uk/sounds/play/m001p2jp',
'info_dict': {
'id': 'm001p2jn',
'ext': 'mp4',
'title': 'Late Junction - Bonjo Iyabinghi Noah and GAIKA in session',
'thumbnail': 'https://ichef.bbci.co.uk/images/ic/raw/p0cgqwnb.jpg',
'duration': 7200,
'chapters': 'count:24',
'description': 'md5:36f16179df6ee9992e80fea912d97ea8',
'uploader': 'Radio 3',
'uploader_id': 'bbc_radio_three',
},
}, { # onion routes
'url': 'https://www.bbcnewsd73hkzno2ini43t4gblxvycyac5aw4gnv7t2rccijh7745uqd.onion/news/av/world-europe-63208576',
'only_matching': True,
Expand Down Expand Up @@ -1118,6 +1119,15 @@ def _real_extract(self, url):
image_url = current_programme.get('image_url')
if image_url:
thumbnail = image_url.replace('{recipe}', 'raw')
tracklist = []
for track in traverse_obj(preload_state, ("tracklist", "tracks")):
tracklist.append({
"title": join_nonempty("primary", "secondary", "tertiary", delim=" - ", from_dict=track.get("titles")),
**traverse_obj(track, {
"start_time": ("offset", "start"),
"end_time": ("offset", "end"),
}),
})
return {
'id': programme_id,
'title': title,
Expand All @@ -1128,6 +1138,7 @@ def _real_extract(self, url):
'uploader_id': network.get('id'),
'formats': formats,
'subtitles': subtitles,
'chapters': tracklist,
garret1317 marked this conversation as resolved.
Show resolved Hide resolved
}

bbc3_config = self._parse_json(
Expand Down