]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tv2hu.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..utils
import int_or_none
8 class TV2HuIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?tv2\.hu/(?:[^/]+/)+(?P<id>\d+)_[^/?#]+?\.html'
12 'url': 'http://tv2.hu/ezek_megorultek/217679_ezek-megorultek---1.-adas-1.-resz.html',
13 'md5': '585e58e2e090f34603804bb2c48e98d8',
17 'title': 'Ezek megőrültek! - 1. adás 1. rész',
18 'upload_date': '20160826',
19 'thumbnail': r
're:^https?://.*\.jpg$'
22 'url': 'http://tv2.hu/ezek_megorultek/teljes_adasok/217677_ezek-megorultek---1.-adas-2.-resz.html',
25 'url': 'http://tv2.hu/musoraink/aktiv/aktiv_teljes_adas/217963_aktiv-teljes-adas---2016.08.30..html',
29 def _real_extract(self
, url
):
30 video_id
= self
._match
_id
(url
)
31 webpage
= self
._download
_webpage
(url
, video_id
)
32 json_url
= self
._search
_regex
(
33 r
'jsonUrl\s*=\s*"([^"]+)"', webpage
, 'json url')
34 json_data
= self
._download
_json
(json_url
, video_id
)
37 for b
in ('bitrates', 'backupBitrates'):
38 bitrates
= json_data
.get(b
, {})
39 m3u8_url
= bitrates
.get('hls')
41 formats
.extend(self
._extract
_wowza
_formats
(
42 m3u8_url
, video_id
, skip_protocols
=['rtmp', 'rtsp']))
44 for mp4_url
in bitrates
.get('mp4', []):
45 height
= int_or_none(self
._search
_regex
(
46 r
'\.(\d+)p\.mp4', mp4_url
, 'height', default
=None))
48 'format_id': 'http' + ('-%d' % height
if height
else ''),
51 'width': int_or_none(height
/ 9.0 * 16.0 if height
else None),
53 self
._sort
_formats
(formats
)
57 'title': self
._og
_search
_title
(webpage
).strip(),
58 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
59 'upload_date': self
._search
_regex
(
60 r
'/vod/(\d{8})/', json_url
, 'upload_date', default
=None),