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