]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/vesti.py
[ie/floatplane] Add extractors (#8639)
[yt-dlp.git] / yt_dlp / extractor / vesti.py
CommitLineData
e125c215
S
1import re
2
3from .common import InfoExtractor
4from ..utils import ExtractorError
5from .rutv import RUTVIE
6
7
8class VestiIE(InfoExtractor):
9 IE_DESC = 'Вести.Ru'
5886b38d 10 _VALID_URL = r'https?://(?:.+?\.)?vesti\.ru/(?P<id>.+)'
e125c215
S
11
12 _TESTS = [
13 {
14 'url': 'http://www.vesti.ru/videos?vid=575582&cid=1',
15 'info_dict': {
16 'id': '765035',
17 'ext': 'mp4',
18 'title': 'Вести.net: биткоины в России не являются законными',
19 'description': 'md5:d4bb3859dc1177b28a94c5014c35a36b',
20 'duration': 302,
21 },
22 'params': {
23 # m3u8 download
24 'skip_download': True,
25 },
26 },
27 {
28 'url': 'http://www.vesti.ru/doc.html?id=1349233',
29 'info_dict': {
30 'id': '773865',
31 'ext': 'mp4',
32 'title': 'Участники митинга штурмуют Донецкую областную администрацию',
33 'description': 'md5:1a160e98b3195379b4c849f2f4958009',
34 'duration': 210,
35 },
36 'params': {
37 # m3u8 download
38 'skip_download': True,
39 },
40 },
41 {
42 'url': 'http://www.vesti.ru/only_video.html?vid=576180',
43 'info_dict': {
44 'id': '766048',
45 'ext': 'mp4',
46 'title': 'США заморозило, Британию затопило',
47 'description': 'md5:f0ed0695ec05aed27c56a70a58dc4cc1',
48 'duration': 87,
49 },
50 'params': {
51 # m3u8 download
52 'skip_download': True,
53 },
54 },
55 {
56 'url': 'http://hitech.vesti.ru/news/view/id/4000',
57 'info_dict': {
58 'id': '766888',
59 'ext': 'mp4',
60 'title': 'Вести.net: интернет-гиганты начали перетягивание программных "одеял"',
61 'description': 'md5:65ddd47f9830c4f42ed6475f8730c995',
62 'duration': 279,
63 },
64 'params': {
65 # m3u8 download
66 'skip_download': True,
67 },
68 },
69 {
70 'url': 'http://sochi2014.vesti.ru/video/index/video_id/766403',
71 'info_dict': {
72 'id': '766403',
73 'ext': 'mp4',
74 'title': 'XXII зимние Олимпийские игры. Российские хоккеисты стартовали на Олимпиаде с победы',
75 'description': 'md5:55805dfd35763a890ff50fa9e35e31b3',
76 'duration': 271,
77 },
78 'params': {
79 # m3u8 download
80 'skip_download': True,
81 },
82 'skip': 'Blocked outside Russia',
83 },
84 {
85 'url': 'http://sochi2014.vesti.ru/live/play/live_id/301',
86 'info_dict': {
87 'id': '51499',
88 'ext': 'flv',
89 'title': 'Сочи-2014. Биатлон. Индивидуальная гонка. Мужчины ',
90 'description': 'md5:9e0ed5c9d2fa1efbfdfed90c9a6d179c',
91 },
92 'params': {
93 # rtmp download
94 'skip_download': True,
95 },
96 'skip': 'Translation has finished'
97 },
98 ]
99
100 def _real_extract(self, url):
5ad28e7f 101 mobj = self._match_valid_url(url)
e125c215
S
102 video_id = mobj.group('id')
103
104 page = self._download_webpage(url, video_id, 'Downloading page')
105
106 mobj = re.search(
107 r'<meta[^>]+?property="og:video"[^>]+?content="http://www\.vesti\.ru/i/flvplayer_videoHost\.swf\?vid=(?P<id>\d+)',
108 page)
109 if mobj:
110 video_id = mobj.group('id')
111 page = self._download_webpage('http://www.vesti.ru/only_video.html?vid=%s' % video_id, video_id,
9e1a5b84 112 'Downloading video page')
e125c215
S
113
114 rutv_url = RUTVIE._extract_url(page)
115 if rutv_url:
116 return self.url_result(rutv_url, 'RUTV')
117
5f6a1245 118 raise ExtractorError('No video found', expected=True)