]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/lenta.py
[extractor/youtube] Fix `uploader_id` extraction
[yt-dlp.git] / yt_dlp / extractor / lenta.py
CommitLineData
8b7340a4
S
1from .common import InfoExtractor
2
3
4class LentaIE(InfoExtractor):
5 _VALID_URL = r'https?://(?:www\.)?lenta\.ru/[^/]+/\d+/\d+/\d+/(?P<id>[^/?#&]+)'
6 _TESTS = [{
7 'url': 'https://lenta.ru/news/2018/03/22/savshenko_go/',
8 'info_dict': {
9 'id': '964400',
10 'ext': 'mp4',
11 'title': 'Надежду Савченко задержали',
12 'thumbnail': r're:^https?://.*\.jpg$',
13 'duration': 61,
14 'view_count': int,
15 },
16 'params': {
17 'skip_download': True,
18 },
19 }, {
20 # EaglePlatform iframe embed
21 'url': 'http://lenta.ru/news/2015/03/06/navalny/',
22 'info_dict': {
23 'id': '227304',
24 'ext': 'mp4',
25 'title': 'Навальный вышел на свободу',
26 'description': 'md5:d97861ac9ae77377f3f20eaf9d04b4f5',
27 'thumbnail': r're:^https?://.*\.jpg$',
28 'duration': 87,
29 'view_count': int,
30 'age_limit': 0,
31 },
32 'params': {
33 'skip_download': True,
34 },
35 }]
36
37 def _real_extract(self, url):
38 display_id = self._match_id(url)
39
40 webpage = self._download_webpage(url, display_id)
41
42 video_id = self._search_regex(
43 r'vid\s*:\s*["\']?(\d+)', webpage, 'eagleplatform id',
44 default=None)
45 if video_id:
46 return self.url_result(
47 'eagleplatform:lentaru.media.eagleplatform.com:%s' % video_id,
48 ie='EaglePlatform', video_id=video_id)
49
50 return self.url_result(url, ie='Generic')