]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tvigle.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class TvigleIE(InfoExtractor
):
13 IE_DESC
= 'Интернет-телевидение Tvigle.ru'
14 _VALID_URL
= r
'http://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?P<id>[^/]+)/$'
18 'url': 'http://www.tvigle.ru/video/sokrat/',
19 'md5': '36514aed3657d4f70b4b2cef8eb520cd',
22 'display_id': 'sokrat',
25 'description': 'md5:a05bd01be310074d5833efc6743be95e',
31 'url': 'http://www.tvigle.ru/video/vladimir-vysotskii/vedushchii-teleprogrammy-60-minut-ssha-o-vladimire-vysotskom/',
32 'md5': 'd9012d7c7c598fe7a11d7fb46dc1f574',
36 'title': 'Ведущий телепрограммы «60 минут» (США) о Владимире Высоцком',
37 'description': 'md5:027f7dc872948f14c96d19b4178428a4',
44 def _real_extract(self
, url
):
45 display_id
= self
._match
_id
(url
)
47 webpage
= self
._download
_webpage
(url
, display_id
)
49 video_id
= self
._html
_search
_regex
(
50 r
'<li class="video-preview current_playing" id="(\d+)">', webpage
, 'video id')
52 video_data
= self
._download
_json
(
53 'http://cloud.tvigle.ru/api/play/video/%s/' % video_id
, display_id
)
55 item
= video_data
['playlist']['items'][0]
58 description
= item
['description']
59 thumbnail
= item
['thumbnail']
60 duration
= float_or_none(item
.get('durationMilliseconds'), 1000)
61 age_limit
= parse_age_limit(item
.get('ageRestrictions'))
64 for vcodec
, fmts
in item
['videos'].items():
65 for quality
, video_url
in fmts
.items():
68 'format_id': '%s-%s' % (vcodec
, quality
),
70 'height': int(quality
[:-1]),
71 'filesize': item
['video_files_size'][vcodec
][quality
],
73 self
._sort
_formats
(formats
)
77 'display_id': display_id
,
79 'description': description
,
80 'thumbnail': thumbnail
,
82 'age_limit': age_limit
,