1 from __future__ import unicode_literals
5 from .common import InfoExtractor
14 class ABCIE(InfoExtractor):
15 IE_NAME = 'abc.net.au'
16 _VALID_URL = r'https?://www\.abc\.net\.au/news/(?:[^/]+/){1,2}(?P<id>\d+)'
19 'url': 'http://www.abc.net.au/news/2014-11-05/australia-to-staff-ebola-treatment-centre-in-sierra-leone/5868334',
20 'md5': 'cb3dd03b18455a661071ee1e28344d9f',
24 'title': 'Australia to help staff Ebola treatment centre in Sierra Leone',
25 'description': 'md5:809ad29c67a05f54eb41f2a105693a67',
27 'skip': 'this video has expired',
29 'url': 'http://www.abc.net.au/news/2015-08-17/warren-entsch-introduces-same-sex-marriage-bill/6702326',
30 'md5': 'db2a5369238b51f9811ad815b69dc086',
34 'upload_date': '20150816',
35 'uploader': 'ABC News (Australia)',
36 'description': 'Government backbencher Warren Entsch introduces a cross-party sponsored bill to legalise same-sex marriage, saying the bill is designed to promote "an inclusive Australia, not a divided one.". Read more here: http://ab.co/1Mwc6ef',
37 'uploader_id': 'NewsOnABC',
38 'title': 'Marriage Equality: Warren Entsch introduces same sex marriage bill',
40 'add_ie': ['Youtube'],
41 'skip': 'Not accessible from Travis CI server',
43 'url': 'http://www.abc.net.au/news/2015-10-23/nab-lifts-interest-rates-following-westpac-and-cba/6880080',
44 'md5': 'b96eee7c9edf4fc5a358a0252881cc1f',
48 'title': 'NAB lifts interest rates, following Westpac and CBA',
49 'description': 'md5:f13d8edc81e462fce4a0437c7dc04728',
52 'url': 'http://www.abc.net.au/news/2015-10-19/6866214',
53 'only_matching': True,
56 def _real_extract(self, url):
57 video_id = self._match_id(url)
58 webpage = self._download_webpage(url, video_id)
61 r'inline(?P<type>Video|Audio|YouTube)Data\.push\((?P<json_data>[^)]+)\);',
64 expired = self._html_search_regex(r'(?s)class="expired-(?:video|audio)".+?<span>(.+?)</span>', webpage, 'expired', None)
66 raise ExtractorError('%s said: %s' % (self.IE_NAME, expired), expected=True)
67 raise ExtractorError('Unable to extract video urls')
69 urls_info = self._parse_json(
70 mobj.group('json_data'), video_id, transform_source=js_to_json)
72 if not isinstance(urls_info, list):
73 urls_info = [urls_info]
75 if mobj.group('type') == 'YouTube':
76 return self.playlist_result([
77 self.url_result(url_info['url']) for url_info in urls_info])
80 'url': url_info['url'],
81 'vcodec': url_info.get('codec') if mobj.group('type') == 'Video' else 'none',
82 'width': int_or_none(url_info.get('width')),
83 'height': int_or_none(url_info.get('height')),
84 'tbr': int_or_none(url_info.get('bitrate')),
85 'filesize': int_or_none(url_info.get('filesize')),
86 } for url_info in urls_info]
88 self._sort_formats(formats)
92 'title': self._og_search_title(webpage),
94 'description': self._og_search_description(webpage),
95 'thumbnail': self._og_search_thumbnail(webpage),
99 class ABCIViewIE(InfoExtractor):
100 IE_NAME = 'abc.net.au:iview'
101 _VALID_URL = r'https?://iview\.abc\.net\.au/programs/[^/]+/(?P<id>[^/?#]+)'
104 'url': 'http://iview.abc.net.au/programs/gardening-australia/FA1505V024S00',
105 'md5': '979d10b2939101f0d27a06b79edad536',
107 'id': 'FA1505V024S00',
109 'title': 'Series 27 Ep 24',
110 'description': 'md5:b28baeae7504d1148e1d2f0e3ed3c15d',
111 'upload_date': '20160820',
112 'uploader_id': 'abc1',
113 'timestamp': 1471719600,
117 def _real_extract(self, url):
118 video_id = self._match_id(url)
119 webpage = self._download_webpage(url, video_id)
120 video_params = self._parse_json(self._search_regex(
121 r'videoParams\s*=\s*({.+?});', webpage, 'video params'), video_id)
122 title = video_params['title']
123 stream = next(s for s in video_params['playlist'] if s.get('type') == 'program')
125 formats = self._extract_akamai_formats(stream['hds-unmetered'], video_id)
126 self._sort_formats(formats)
129 src_vtt = stream.get('captions', {}).get('src-vtt')
139 'description': self._html_search_meta(['og:description', 'twitter:description'], webpage),
140 'thumbnail': self._html_search_meta(['og:image', 'twitter:image:src'], webpage),
141 'duration': int_or_none(video_params.get('eventDuration')),
142 'timestamp': parse_iso8601(video_params.get('pubDate'), ' '),
143 'series': video_params.get('seriesTitle'),
144 'series_id': video_params.get('seriesHouseNumber') or video_id[:7],
145 'episode_number': int_or_none(self._html_search_meta('episodeNumber', webpage)),
146 'episode': self._html_search_meta('episode_title', webpage),
147 'uploader_id': video_params.get('channel'),
149 'subtitles': subtitles,