]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/atvat.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
12 class ATVAtIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?atv\.at/(?:[^/]+/){2}(?P<id>[dv]\d+)'
15 'url': 'http://atv.at/aktuell/di-210317-2005-uhr/v1698449/',
16 'md5': 'c3b6b975fb3150fc628572939df205f2',
20 'title': 'DI, 21.03.17 | 20:05 Uhr 1/1',
23 'url': 'http://atv.at/aktuell/meinrad-knapp/d8416/',
24 'only_matching': True,
27 def _real_extract(self
, url
):
28 display_id
= self
._match
_id
(url
)
29 webpage
= self
._download
_webpage
(url
, display_id
)
30 video_data
= self
._parse
_json
(unescapeHTML(self
._search
_regex
(
31 [r
'flashPlayerOptions\s*=\s*(["\'])(?P
<json
>(?
:(?
!\
1).)+)\
1',
32 r'class="[^"]*jsb_video
/FlashPlayer
[^
"]*"[^
>]+data
-jsb
="(?P<json>[^"]+)"'],
33 webpage, 'player data', group='json')),
34 display_id)['config']['initial_video']
36 video_id = video_data['id']
37 video_title = video_data['title']
40 for part in video_data.get('parts', []):
42 part_title = part['title']
45 for source in part.get('sources', []):
46 source_url = source.get('src')
49 ext = determine_ext(source_url)
51 formats.extend(self._extract_m3u8_formats(
52 source_url, part_id, 'mp4', 'm3u8_native',
53 m3u8_id='hls', fatal=False))
56 'format_id': source.get('delivery'),
59 self._sort_formats(formats)
64 'thumbnail': part.get('preview_image_url'),
65 'duration': int_or_none(part.get('duration')),
66 'is_live': part.get('is_livestream'),
71 '_type': 'multi_video',