]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/krasview.py
2 from __future__
import unicode_literals
7 from .common
import InfoExtractor
14 class KrasViewIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://krasview\.ru/video/(?P<id>\d+)'
19 'url': 'http://krasview.ru/video/512228',
20 'md5': '3b91003cf85fc5db277870c8ebd98eae',
24 'title': 'Снег, лёд, заносы',
25 'description': 'Снято в городе Нягань, в Ханты-Мансийском автономном округе.',
27 'thumbnail': 're:^https?://.*\.jpg',
31 def _real_extract(self
, url
):
32 mobj
= re
.match(self
._VALID
_URL
, url
)
33 video_id
= mobj
.group('id')
35 webpage
= self
._download
_webpage
(url
, video_id
)
37 flashvars
= json
.loads(self
._search
_regex
(
38 r
'flashvars\s*:\s*({.+?})\s*}\);', webpage
, 'flashvars'))
40 video_url
= flashvars
['url']
41 title
= unescapeHTML(flashvars
['title'])
42 description
= unescapeHTML(flashvars
.get('subtitle') or self
._og
_search
_description
(webpage
, default
=None))
43 thumbnail
= flashvars
['image']
44 duration
= int(flashvars
['duration'])
45 filesize
= int(flashvars
['size'])
46 width
= int_or_none(self
._og
_search
_property
('video:width', webpage
, 'video width'))
47 height
= int_or_none(self
._og
_search
_property
('video:height', webpage
, 'video height'))
53 'description': description
,
54 'thumbnail': thumbnail
,