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