[abc:iview] fix series name extraction

This commit is contained in:
ClosedPort22 2024-06-27 11:30:04 +08:00
parent 5701ba9873
commit 5c3a2daf6a
No known key found for this signature in database

View File

@ -302,7 +302,6 @@ def _real_extract(self, url):
video_params = self._download_json( video_params = self._download_json(
'https://iview.abc.net.au/api/programs/' + video_id, video_id, 'https://iview.abc.net.au/api/programs/' + video_id, video_id,
note='Downloading legacy API JSON') note='Downloading legacy API JSON')
title = unescapeHTML(video_params.get('title') or video_params['seriesTitle'])
stream = traverse_obj(video_params, ( stream = traverse_obj(video_params, (
('_embedded', None), 'playlist', lambda _, v: v['type'] in ('program', 'livestream')), ('_embedded', None), 'playlist', lambda _, v: v['type'] in ('program', 'livestream')),
get_all=False) get_all=False)
@ -349,6 +348,8 @@ def tokenize_url(url, token):
chapters = traverse_obj( chapters = traverse_obj(
video_params, ('cuePoints', ..., {'start_time': 'start', 'end_time': 'end', 'title': 'type'})) video_params, ('cuePoints', ..., {'start_time': 'start', 'end_time': 'end', 'title': 'type'}))
title = unescapeHTML(traverse_obj(video_params, 'title', 'seriesTitle', 'showTitle'))
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': title,
@ -357,7 +358,7 @@ def tokenize_url(url, token):
'chapters': chapters, 'chapters': chapters,
'duration': int_or_none(traverse_obj(video_params, 'duration', 'eventDuration')), 'duration': int_or_none(traverse_obj(video_params, 'duration', 'eventDuration')),
'timestamp': parse_iso8601(video_params.get('pubDate'), ' '), 'timestamp': parse_iso8601(video_params.get('pubDate'), ' '),
'series': unescapeHTML(video_params.get('seriesTitle')), 'series': unescapeHTML(traverse_obj(video_params, 'seriesTitle', 'showTitle')),
'series_id': series_id, 'series_id': series_id,
'season_number': int_or_none(self._search_regex( 'season_number': int_or_none(self._search_regex(
r'\bSeries\s+(\d+)\b', title, 'season number', default=None)), r'\bSeries\s+(\d+)\b', title, 'season number', default=None)),