1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-11 02:57:20 +08:00

ABC: add support for retrieving the URL of the latest episode on a show page

This commit is contained in:
Paul Wise 2018-09-20 22:56:01 +08:00
parent 4ac73fc170
commit 8d8bbc9821
No known key found for this signature in database
GPG Key ID: 3116BA5E9FFA69A3

View File

@ -105,7 +105,7 @@ class ABCIE(InfoExtractor):
class ABCIViewIE(InfoExtractor): class ABCIViewIE(InfoExtractor):
IE_NAME = 'abc.net.au:iview' IE_NAME = 'abc.net.au:iview'
_VALID_URL = r'https?://iview\.abc\.net\.au/(?:[^/]+/)*video/(?P<id>[^/?#]+)' _VALID_URL = r'https?://iview\.abc\.net\.au/(?:(?:[^/]+/)*video/(?P<id>[^/?#]+)|show/[^/]+$)'
_GEO_COUNTRIES = ['AU'] _GEO_COUNTRIES = ['AU']
# ABC iview programs are normally available for 14 days only. # ABC iview programs are normally available for 14 days only.
@ -129,6 +129,15 @@ class ABCIViewIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
if video_id == 'None':
webpage = self._download_webpage(url, video_id)
webpage_data = self._search_regex(
r'window\.__INITIAL_STATE__\s*=\s*"(.+)"\s*;',
webpage, 'initial state')
json_data = unescapeHTML(webpage_data).encode('utf-8').decode('unicode_escape')
video_data = self._parse_json(json_data, video_id)
url = video_data['page']['pageData']['_embedded']['highlightVideo']['shareUrl']
video_id = self._match_id(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)
title = unescapeHTML(video_params.get('title') or video_params['seriesTitle']) title = unescapeHTML(video_params.get('title') or video_params['seriesTitle'])