Skip to content

Commit

Permalink
Added fix for issue #10687 in abc.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Wang authored and Wang committed Apr 20, 2020
1 parent 8ff6324 commit b466ffb
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions youtube_dl/extractor/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
update_url_query,
)


class ABCIE(InfoExtractor):
IE_NAME = 'abc.net.au'
_VALID_URL = r'https?://(?:www\.)?abc\.net\.au/news/(?:[^/]+/){1,2}(?P<id>\d+)'
Expand Down Expand Up @@ -58,7 +57,11 @@ class ABCIE(InfoExtractor):
}, {
'url': 'http://www.abc.net.au/news/2015-10-19/6866214',
'only_matching': True,
}]
}, {
'url': "https://www.abc.net.au/news/2015-08-17/warren-entsch-introduces-same-sex-marriage-bill/6702326",
'only_matching': True,
}
]

def _real_extract(self, url):
video_id = self._match_id(url)
Expand All @@ -67,8 +70,16 @@ def _real_extract(self, url):
mobj = re.search(
r'inline(?P<type>Video|Audio|YouTube)Data\.push\((?P<json_data>[^)]+)\);',
webpage)

youtube_link = self._html_search_regex(r'(?s)a href="http://www.youtube.com/(.+?)"', webpage, 'youtube_link', None)
if youtube_link:
youtube_link = "http://www.youtube.com/"+youtube_link
return self.url_result(youtube_link)

if mobj is None:
expired = self._html_search_regex(r'(?s)class="expired-(?:video|audio)".+?<span>(.+?)</span>', webpage, 'expired', None)


if expired:
raise ExtractorError('%s said: %s' % (self.IE_NAME, expired), expected=True)
raise ExtractorError('Unable to extract video urls')
Expand All @@ -79,6 +90,7 @@ def _real_extract(self, url):
if not isinstance(urls_info, list):
urls_info = [urls_info]


if mobj.group('type') == 'YouTube':
return self.playlist_result([
self.url_result(url_info['url']) for url_info in urls_info])
Expand Down

0 comments on commit b466ffb

Please sign in to comment.