From 8d8bbc9821c81e88fe15e6a4d5baa12ba3b1fe87 Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Thu, 20 Sep 2018 22:56:01 +0800 Subject: [PATCH] ABC: add support for retrieving the URL of the latest episode on a show page --- youtube_dl/extractor/abc.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/abc.py b/youtube_dl/extractor/abc.py index 4ac323bf6..a245e6584 100644 --- a/youtube_dl/extractor/abc.py +++ b/youtube_dl/extractor/abc.py @@ -105,7 +105,7 @@ class ABCIE(InfoExtractor): class ABCIViewIE(InfoExtractor): IE_NAME = 'abc.net.au:iview' - _VALID_URL = r'https?://iview\.abc\.net\.au/(?:[^/]+/)*video/(?P[^/?#]+)' + _VALID_URL = r'https?://iview\.abc\.net\.au/(?:(?:[^/]+/)*video/(?P[^/?#]+)|show/[^/]+$)' _GEO_COUNTRIES = ['AU'] # ABC iview programs are normally available for 14 days only. @@ -129,6 +129,15 @@ class ABCIViewIE(InfoExtractor): def _real_extract(self, 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( 'https://iview.abc.net.au/api/programs/' + video_id, video_id) title = unescapeHTML(video_params.get('title') or video_params['seriesTitle'])