]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/carambatv.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_str
12 from .videomore
import VideomoreIE
15 class CarambaTVIE(InfoExtractor
):
16 _VALID_URL
= r
'(?:carambatv:|https?://video1\.carambatv\.ru/v/)(?P<id>\d+)'
18 'url': 'http://video1.carambatv.ru/v/191910501',
19 'md5': '2f4a81b7cfd5ab866ee2d7270cb34a2a',
23 'title': '[BadComedian] - Разборка в Маниле (Абсолютный обзор)',
24 'thumbnail': 're:^https?://.*\.jpg',
28 'url': 'carambatv:191910501',
29 'only_matching': True,
32 def _real_extract(self
, url
):
33 video_id
= self
._match
_id
(url
)
35 video
= self
._download
_json
(
36 'http://video1.carambatv.ru/v/%s/videoinfo.js' % video_id
,
39 title
= video
['title']
41 base_url
= video
.get('video') or 'http://video1.carambatv.ru/v/%s/' % video_id
44 'url': base_url
+ f
['fn'],
45 'height': int_or_none(f
.get('height')),
46 'format_id': '%sp' % f
['height'] if f
.get('height') else None,
47 } for f
in video
['qualities'] if f
.get('fn')]
48 self
._sort
_formats
(formats
)
50 thumbnail
= video
.get('splash')
51 duration
= float_or_none(try_get(
52 video
, lambda x
: x
['annotations'][0]['end_time'], compat_str
))
57 'thumbnail': thumbnail
,
63 class CarambaTVPageIE(InfoExtractor
):
64 _VALID_URL
= r
'https?://carambatv\.ru/(?:[^/]+/)+(?P<id>[^/?#&]+)'
66 'url': 'http://carambatv.ru/movie/bad-comedian/razborka-v-manile/',
67 'md5': 'a49fb0ec2ad66503eeb46aac237d3c86',
71 'title': '[BadComedian] - Разборка в Маниле (Абсолютный обзор)',
72 'thumbnail': 're:^https?://.*\.jpg',
73 # duration reported by videomore is incorrect
76 'add_ie': [VideomoreIE
.ie_key()],
79 def _real_extract(self
, url
):
80 video_id
= self
._match
_id
(url
)
82 webpage
= self
._download
_webpage
(url
, video_id
)
84 videomore_url
= VideomoreIE
._extract
_url
(webpage
)
86 title
= self
._og
_search
_title
(webpage
)
88 '_type': 'url_transparent',
90 'ie_key': VideomoreIE
.ie_key(),
94 video_url
= self
._og
_search
_property
('video:iframe', webpage
, default
=None)
97 video_id
= self
._search
_regex
(
98 r
'(?:video_id|crmb_vuid)\s*[:=]\s*["\']?
(\d
+)',
100 video_url = 'carambatv
:%s' % video_id
102 return self.url_result(video_url, CarambaTVIE.ie_key())