]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/firsttv.py
6b662cc3cd78e4acf661af473f2374b5ec2af05c
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_urlparse
13 class FirstTVIE(InfoExtractor
):
15 IE_DESC
= 'Первый канал'
16 _VALID_URL
= r
'https?://(?:www\.)?1tv\.ru/(?:[^/]+/)+(?P<id>[^/?#]+)'
20 'url': 'http://www.1tv.ru/shows/naedine-so-vsemi/vypuski/gost-lyudmila-senchina-naedine-so-vsemi-vypusk-ot-12-02-2015',
21 'md5': 'a1b6b60d530ebcf8daacf4565762bbaf',
25 'title': 'Гость Людмила Сенчина. Наедине со всеми. Выпуск от 12.02.2015',
26 'description': 'md5:36a39c1d19618fec57d12efe212a8370',
27 'thumbnail': 're:^https?://.*\.(?:jpg|JPG)$',
28 'upload_date': '20150212',
33 'url': 'http://www.1tv.ru/shows/dobroe-utro/pro-zdorove/vesennyaya-allergiya-dobroe-utro-fragment-vypuska-ot-07042016',
37 'title': 'Весенняя аллергия. Доброе утро. Фрагмент выпуска от 07.04.2016',
38 'description': 'md5:a242eea0031fd180a4497d52640a9572',
39 'thumbnail': 're:^https?://.*\.(?:jpg|JPG)$',
40 'upload_date': '20160407',
42 'formats': 'mincount:3',
45 'skip_download': True,
49 def _real_extract(self
, url
):
50 display_id
= self
._match
_id
(url
)
52 webpage
= self
._download
_webpage
(url
, display_id
)
53 playlist_url
= compat_urlparse
.urljoin(url
, self
._search
_regex
(
54 r
'data-playlist-url="([^"]+)', webpage
, 'playlist url'))
56 item
= self
._download
_json
(playlist_url
, display_id
)[0]
58 quality
= qualities(('ld', 'sd', 'hd', ))
60 for f
in item
.get('mbr', []):
68 'quality': quality(fname
),
70 self
._sort
_formats
(formats
)
72 title
= self
._html
_search
_regex
(
73 (r
'<div class="tv_translation">\s*<h1><a href="[^"]+">([^<]*)</a>',
74 r
"'title'\s*:\s*'([^']+)'"),
75 webpage
, 'title', default
=None) or item
['title']
76 description
= self
._html
_search
_regex
(
77 r
'<div class="descr">\s*<div> </div>\s*<p>([^<]*)</p></div>',
78 webpage
, 'description', default
=None) or self
._html
_search
_meta
(
79 'description', webpage
, 'description')
80 duration
= int_or_none(self
._html
_search
_meta
(
81 'video:duration', webpage
, 'video duration', fatal
=False))
82 upload_date
= unified_strdate(self
._html
_search
_meta
(
83 'ya:ovs:upload_date', webpage
, 'upload date', fatal
=False))
87 'thumbnail': item
.get('poster') or self
._og
_search
_thumbnail
(webpage
),
89 'description': description
,
90 'upload_date': upload_date
,
91 'duration': int_or_none(duration
),