]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/carambatv.py
1 from .common
import InfoExtractor
2 from ..compat
import compat_str
10 from .videomore
import VideomoreIE
13 class CarambaTVIE(InfoExtractor
):
14 _VALID_URL
= r
'(?:carambatv:|https?://video1\.carambatv\.ru/v/)(?P<id>\d+)'
16 'url': 'http://video1.carambatv.ru/v/191910501',
17 'md5': '2f4a81b7cfd5ab866ee2d7270cb34a2a',
21 'title': '[BadComedian] - Разборка в Маниле (Абсолютный обзор)',
22 'thumbnail': r
're:^https?://.*\.jpg',
26 'url': 'carambatv:191910501',
27 'only_matching': True,
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
33 video
= self
._download
_json
(
34 'http://video1.carambatv.ru/v/%s/videoinfo.js' % video_id
,
37 title
= video
['title']
39 base_url
= video
.get('video') or 'http://video1.carambatv.ru/v/%s/' % video_id
42 'url': base_url
+ f
['fn'],
43 'height': int_or_none(f
.get('height')),
44 'format_id': format_field(f
, 'height', '%sp'),
45 } for f
in video
['qualities'] if f
.get('fn')]
46 self
._sort
_formats
(formats
)
48 thumbnail
= video
.get('splash')
49 duration
= float_or_none(try_get(
50 video
, lambda x
: x
['annotations'][0]['end_time'], compat_str
))
55 'thumbnail': thumbnail
,
61 class CarambaTVPageIE(InfoExtractor
):
62 _VALID_URL
= r
'https?://carambatv\.ru/(?:[^/]+/)+(?P<id>[^/?#&]+)'
64 'url': 'http://carambatv.ru/movie/bad-comedian/razborka-v-manile/',
65 'md5': 'a49fb0ec2ad66503eeb46aac237d3c86',
69 'title': '[BadComedian] - Разборка в Маниле (Абсолютный обзор)',
70 'thumbnail': r
're:^https?://.*\.jpg',
71 # duration reported by videomore is incorrect
74 'add_ie': [VideomoreIE
.ie_key()],
77 def _real_extract(self
, url
):
78 video_id
= self
._match
_id
(url
)
80 webpage
= self
._download
_webpage
(url
, video_id
)
82 videomore_url
= VideomoreIE
._extract
_url
(webpage
)
84 videomore_id
= self
._search
_regex
(
85 r
'getVMCode\s*\(\s*["\']?
(\d
+)', webpage, 'videomore
id',
88 videomore_url = 'videomore
:%s' % videomore_id
90 title = self._og_search_title(webpage)
92 '_type
': 'url_transparent
',
94 'ie_key
': VideomoreIE.ie_key(),
98 video_url = self._og_search_property('video
:iframe
', webpage, default=None)
101 video_id = self._search_regex(
102 r'(?
:video_id|crmb_vuid
)\s
*[:=]\s
*["\']?(\d+)',
104 video_url = 'carambatv:%s' % video_id
106 return self.url_result(video_url, CarambaTVIE.ie_key())