[abc] add support for audio extraction
This commit is contained in:
parent
7690787553
commit
638a71d9be
@ -12,7 +12,7 @@ from ..utils import (
|
|||||||
|
|
||||||
class ABCIE(InfoExtractor):
|
class ABCIE(InfoExtractor):
|
||||||
IE_NAME = 'abc.net.au'
|
IE_NAME = 'abc.net.au'
|
||||||
_VALID_URL = r'http://www\.abc\.net\.au/news/[^/]+/[^/]+/(?P<id>\d+)'
|
_VALID_URL = r'http://www\.abc\.net\.au/news/([^/]+/){1,2}(?P<id>\d+)'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.abc.net.au/news/2014-11-05/australia-to-staff-ebola-treatment-centre-in-sierra-leone/5868334',
|
'url': 'http://www.abc.net.au/news/2014-11-05/australia-to-staff-ebola-treatment-centre-in-sierra-leone/5868334',
|
||||||
@ -36,6 +36,15 @@ class ABCIE(InfoExtractor):
|
|||||||
'title': 'Marriage Equality: Warren Entsch introduces same sex marriage bill',
|
'title': 'Marriage Equality: Warren Entsch introduces same sex marriage bill',
|
||||||
},
|
},
|
||||||
'add_ie': ['Youtube'],
|
'add_ie': ['Youtube'],
|
||||||
|
}, {
|
||||||
|
'url': 'http://www.abc.net.au/news/2015-10-23/nab-lifts-interest-rates-following-westpac-and-cba/6880080',
|
||||||
|
'md5': 'b96eee7c9edf4fc5a358a0252881cc1f',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '6880080',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'title': 'NAB lifts interest rates, following Westpac and CBA',
|
||||||
|
'description': 'md5:f13d8edc81e462fce4a0437c7dc04728',
|
||||||
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -43,7 +52,7 @@ class ABCIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
mobj = re.search(
|
mobj = re.search(
|
||||||
r'inline(?P<type>Video|YouTube)Data\.push\((?P<json_data>[^)]+)\);',
|
r'inline(?P<type>Video|Audio|YouTube)Data\.push\((?P<json_data>[^)]+)\);',
|
||||||
webpage)
|
webpage)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError('Unable to extract video urls')
|
raise ExtractorError('Unable to extract video urls')
|
||||||
@ -58,13 +67,22 @@ class ABCIE(InfoExtractor):
|
|||||||
return self.playlist_result([
|
return self.playlist_result([
|
||||||
self.url_result(url_info['url']) for url_info in urls_info])
|
self.url_result(url_info['url']) for url_info in urls_info])
|
||||||
|
|
||||||
formats = [{
|
if mobj.group('type') == 'Video':
|
||||||
'url': url_info['url'],
|
formats = [{
|
||||||
'width': int_or_none(url_info.get('width')),
|
'url': url_info['url'],
|
||||||
'height': int_or_none(url_info.get('height')),
|
'vcodec': url_info.get('codec'),
|
||||||
'tbr': int_or_none(url_info.get('bitrate')),
|
'width': int_or_none(url_info.get('width')),
|
||||||
'filesize': int_or_none(url_info.get('filesize')),
|
'height': int_or_none(url_info.get('height')),
|
||||||
} for url_info in urls_info]
|
'tbr': int_or_none(url_info.get('bitrate')),
|
||||||
|
'filesize': int_or_none(url_info.get('filesize')),
|
||||||
|
} for url_info in urls_info]
|
||||||
|
else:
|
||||||
|
formats = [{
|
||||||
|
'url': url_info['url'],
|
||||||
|
'vcodec': 'none',
|
||||||
|
'tbr': int_or_none(url_info.get('bitrate')),
|
||||||
|
'filesize': int_or_none(url_info.get('filesize')),
|
||||||
|
} for url_info in urls_info]
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user