1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2025-07-05 01:46:20 +00:00

Update from code review

This commit is contained in:
Daniel Heath 2019-08-16 17:14:08 +10:00
parent da2be542f2
commit 8f43270668

View File

@ -128,7 +128,8 @@ class ABCIViewShowIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
show_id = self._match_id(url) show_id = self._match_id(url)
show_data = self._download_json('https://api.iview.abc.net.au/v2/show/' + show_id, show_id) show_data = self._download_json(
'https://api.iview.abc.net.au/v2/show/' + show_id, show_id)
title = show_data.get('displayTitle') or show_data.get('title') or show_id title = show_data.get('displayTitle') or show_data.get('title') or show_id
description = show_data.get('description') description = show_data.get('description')
@ -137,21 +138,20 @@ class ABCIViewShowIE(InfoExtractor):
for s in show_data['_embedded']['seriesList']: for s in show_data['_embedded']['seriesList']:
series_id = s.get('id') series_id = s.get('id')
if series_id: if series_id:
url = 'https://api.iview.abc.net.au/v2/series/' + show_id + '/' + series_id series_url = 'https://api.iview.abc.net.au/v2/series/' + show_id + '/' + series_id
groupList = self._download_json( group_list = self._download_json(
url, series_url, series_id, fatal=False,
series_id, errnote="Failed to fetch series ID '%s' from '%s'" % (series_id, series_url)
fatal=False,
errnote="Failed to fetch series ID '%s' from '%s'" % (series_id, url)
) )
if type(groupList) is not list: if type(group_list) is not list:
groupList = [groupList] group_list = [group_list]
for series in groupList: for series in group_list:
for ep in series.get('_embedded', {}).get('videoEpisodes'): for ep in try_get(series, lambda x: x['_embedded']['videoEpisodes'], list):
path = ep.get('_links', {}).get('deeplink', {}).get('href') path = url_or_none(ep.get('_links', {}).get('deeplink', {}).get('href'))
if path: if path:
entries.append(self.url_result('https://iview.abc.net.au' + path)) entries.append(self.url_result(
'https://iview.abc.net.au' + path, ie="ABCIViewShow", video_id="series_id"))
return { return {
'_type': 'playlist', '_type': 'playlist',