]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tvigle.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class TvigleIE(InfoExtractor
):
15 IE_DESC
= 'Интернет-телевидение Tvigle.ru'
16 _VALID_URL
= r
'https?://(?:www\.)?(?:tvigle\.ru/(?:[^/]+/)+(?P<display_id>[^/]+)/$|cloud\.tvigle\.ru/video/(?P<id>\d+))'
20 'url': 'http://www.tvigle.ru/video/sokrat/',
21 'md5': '36514aed3657d4f70b4b2cef8eb520cd',
24 'display_id': 'sokrat',
27 'description': 'md5:a05bd01be310074d5833efc6743be95e',
33 'url': 'http://www.tvigle.ru/video/vladimir-vysotskii/vedushchii-teleprogrammy-60-minut-ssha-o-vladimire-vysotskom/',
34 'md5': 'd9012d7c7c598fe7a11d7fb46dc1f574',
38 'title': 'Ведущий телепрограммы «60 минут» (США) о Владимире Высоцком',
39 'description': 'md5:027f7dc872948f14c96d19b4178428a4',
44 'url': 'https://cloud.tvigle.ru/video/5267604/',
45 'only_matching': True,
49 def _real_extract(self
, url
):
50 mobj
= re
.match(self
._VALID
_URL
, url
)
51 video_id
= mobj
.group('id')
52 display_id
= mobj
.group('display_id')
55 webpage
= self
._download
_webpage
(url
, display_id
)
56 video_id
= self
._html
_search
_regex
(
57 r
'<li class="video-preview current_playing" id="(\d+)">',
60 video_data
= self
._download
_json
(
61 'http://cloud.tvigle.ru/api/play/video/%s/' % video_id
, display_id
)
63 item
= video_data
['playlist']['items'][0]
66 description
= item
['description']
67 thumbnail
= item
['thumbnail']
68 duration
= float_or_none(item
.get('durationMilliseconds'), 1000)
69 age_limit
= parse_age_limit(item
.get('ageRestrictions'))
72 for vcodec
, fmts
in item
['videos'].items():
73 for quality
, video_url
in fmts
.items():
76 'format_id': '%s-%s' % (vcodec
, quality
),
78 'height': int(quality
[:-1]),
79 'filesize': item
['video_files_size'][vcodec
][quality
],
81 self
._sort
_formats
(formats
)
85 'display_id': display_id
,
87 'description': description
,
88 'thumbnail': thumbnail
,
90 'age_limit': age_limit
,