]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/tass.py
3 from .common
import InfoExtractor
10 class TassIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:tass\.ru|itar-tass\.com)/[^/]+/(?P<id>\d+)'
14 'url': 'http://tass.ru/obschestvo/1586870',
15 'md5': '3b4cdd011bc59174596b6145cda474a4',
19 'title': 'Посетителям московского зоопарка показали красную панду',
20 'description': 'Приехавшую из Дублина Зейну можно увидеть в павильоне "Кошки тропиков"',
21 'thumbnail': r
're:^https?://.*\.jpg$',
25 'url': 'http://itar-tass.com/obschestvo/1600009',
26 'only_matching': True,
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(url
, video_id
)
35 sources
= json
.loads(js_to_json(self
._search
_regex
(
36 r
'(?s)sources\s*:\s*(\[.+?\])', webpage
, 'sources')))
38 quality
= qualities(['sd', 'hd'])
41 for source
in sources
:
42 video_url
= source
.get('file')
43 if not video_url
or not video_url
.startswith('http') or not video_url
.endswith('.mp4'):
45 label
= source
.get('label')
49 'quality': quality(label
),
51 self
._sort
_formats
(formats
)
55 'title': self
._og
_search
_title
(webpage
),
56 'description': self
._og
_search
_description
(webpage
),
57 'thumbnail': self
._og
_search
_thumbnail
(webpage
),