]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/tvigle.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class TvigleIE(InfoExtractor
):
16 IE_DESC
= 'Интернет-телевидение Tvigle.ru'
17 _VALID_URL
= r
'https?://(?:www\.)?(?:tvigle\.ru/(?:[^/]+/)+(?P<display_id>[^/]+)/$|cloud\.tvigle\.ru/video/(?P<id>\d+))'
21 'url': 'http://www.tvigle.ru/video/sokrat/',
22 'md5': '36514aed3657d4f70b4b2cef8eb520cd',
25 'display_id': 'sokrat',
28 'description': 'md5:d6b92ffb7217b4b8ebad2e7665253c17',
34 'url': 'http://www.tvigle.ru/video/vladimir-vysotskii/vedushchii-teleprogrammy-60-minut-ssha-o-vladimire-vysotskom/',
35 'md5': 'e7efe5350dd5011d0de6550b53c3ba7b',
39 'title': 'Ведущий телепрограммы «60 минут» (США) о Владимире Высоцком',
40 'description': 'md5:027f7dc872948f14c96d19b4178428a4',
45 'url': 'https://cloud.tvigle.ru/video/5267604/',
46 'only_matching': True,
50 def _real_extract(self
, url
):
51 mobj
= re
.match(self
._VALID
_URL
, url
)
52 video_id
= mobj
.group('id')
53 display_id
= mobj
.group('display_id')
56 webpage
= self
._download
_webpage
(url
, display_id
)
57 video_id
= self
._html
_search
_regex
(
58 r
'class="video-preview current_playing" id="(\d+)">',
61 video_data
= self
._download
_json
(
62 'http://cloud.tvigle.ru/api/play/video/%s/' % video_id
, display_id
)
64 item
= video_data
['playlist']['items'][0]
67 description
= item
.get('description')
68 thumbnail
= item
.get('thumbnail')
69 duration
= float_or_none(item
.get('durationMilliseconds'), 1000)
70 age_limit
= parse_age_limit(item
.get('ageRestrictions'))
73 for vcodec
, fmts
in item
['videos'].items():
74 for format_id
, video_url
in fmts
.items():
75 if format_id
== 'm3u8':
76 formats
.extend(self
._extract
_m
3u8_formats
(
77 video_url
, video_id
, 'mp4', m3u8_id
=vcodec
))
79 height
= self
._search
_regex
(
80 r
'^(\d+)[pP]$', format_id
, 'height', default
=None)
83 'format_id': '%s-%s' % (vcodec
, format_id
),
85 'height': int_or_none(height
),
86 'filesize': int_or_none(item
.get('video_files_size', {}).get(vcodec, {}
).get(format_id
)),
88 self
._sort
_formats
(formats
)
92 'display_id': display_id
,
94 'description': description
,
95 'thumbnail': thumbnail
,
97 'age_limit': age_limit
,