]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/abc.py
debian/changelog: Annotate bugs being closed.
[youtubedl] / youtube_dl / extractor / abc.py
1 from __future__ import unicode_literals
2
3 import re
4 import json
5
6 from .common import InfoExtractor
7
8
9 class ABCIE(InfoExtractor):
10 IE_NAME = 'abc.net.au'
11 _VALID_URL = r'http://www\.abc\.net\.au/news/[^/]+/[^/]+/(?P<id>\d+)'
12
13 _TEST = {
14 'url': 'http://www.abc.net.au/news/2014-07-25/bringing-asylum-seekers-to-australia-would-give/5624716',
15 'md5': 'dad6f8ad011a70d9ddf887ce6d5d0742',
16 'info_dict': {
17 'id': '5624716',
18 'ext': 'mp4',
19 'title': 'Bringing asylum seekers to Australia would give them right to asylum claims: professor',
20 'description': 'md5:ba36fa5e27e5c9251fd929d339aea4af',
21 },
22 }
23
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
26 webpage = self._download_webpage(url, video_id)
27
28 urls_info_json = self._search_regex(
29 r'inlineVideoData\.push\((.*?)\);', webpage, 'video urls',
30 flags=re.DOTALL)
31 urls_info = json.loads(urls_info_json.replace('\'', '"'))
32 formats = [{
33 'url': url_info['url'],
34 'width': int(url_info['width']),
35 'height': int(url_info['height']),
36 'tbr': int(url_info['bitrate']),
37 'filesize': int(url_info['filesize']),
38 } for url_info in urls_info]
39 self._sort_formats(formats)
40
41 return {
42 'id': video_id,
43 'title': self._og_search_title(webpage),
44 'formats': formats,
45 'description': self._og_search_description(webpage),
46 'thumbnail': self._og_search_thumbnail(webpage),
47 }