]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/firsttv.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import int_or_none
10 class FirstTVIE(InfoExtractor
):
12 IE_DESC
= 'Видеоархив - Первый канал'
13 _VALID_URL
= r
'http://(?:www\.)?1tv\.ru/videoarchive/(?P<id>\d+)'
16 'url': 'http://www.1tv.ru/videoarchive/73390',
17 'md5': '3de6390cf0cca4a5eae1d1d83895e5ad',
21 'title': 'Олимпийские канатные дороги',
22 'description': 'md5:cc730d2bf4215463e37fff6a1e277b13',
23 'thumbnail': 'http://img1.1tv.ru/imgsize640x360/PR20140210114657.JPG',
26 'skip': 'Only works from Russia',
29 def _real_extract(self
, url
):
30 mobj
= re
.match(self
._VALID
_URL
, url
)
31 video_id
= mobj
.group('id')
33 webpage
= self
._download
_webpage
(url
, video_id
, 'Downloading page')
35 video_url
= self
._html
_search
_regex
(
36 r
'''(?s)jwplayer\('flashvideoportal_1'\)\.setup\({.*?'file': '([^']+)'.*?}\);''', webpage
, 'video URL')
38 title
= self
._html
_search
_regex
(
39 r
'<div class="tv_translation">\s*<h1><a href="[^"]+">([^<]*)</a>', webpage
, 'title')
40 description
= self
._html
_search
_regex
(
41 r
'<div class="descr">\s*<div> </div>\s*<p>([^<]*)</p></div>', webpage
, 'description', fatal
=False)
43 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
44 duration
= self
._og
_search
_property
('video:duration', webpage
, 'video duration', fatal
=False)
46 like_count
= self
._html
_search
_regex
(r
'title="Понравилось".*?/></label> \[(\d+)\]',
47 webpage
, 'like count', fatal
=False)
48 dislike_count
= self
._html
_search
_regex
(r
'title="Не понравилось".*?/></label> \[(\d+)\]',
49 webpage
, 'dislike count', fatal
=False)
54 'thumbnail': thumbnail
,
56 'description': description
,
57 'duration': int_or_none(duration
),
58 'like_count': int_or_none(like_count
),
59 'dislike_count': int_or_none(dislike_count
),