]>
Commit | Line | Data |
---|---|---|
4dc19c09 NJ |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4dc19c09 NJ |
4 | from .common import InfoExtractor |
5 | from ..utils import ( | |
4dc19c09 NJ |
6 | parse_duration, |
7 | remove_end, | |
8 | ) | |
9 | ||
10 | ||
11 | class LRTIE(InfoExtractor): | |
12 | IE_NAME = 'lrt.lt' | |
13 | _VALID_URL = r'https?://(?:www\.)?lrt\.lt/mediateka/irasas/(?P<id>[0-9]+)' | |
14 | _TEST = { | |
15 | 'url': 'http://www.lrt.lt/mediateka/irasas/54391/', | |
16 | 'info_dict': { | |
17 | 'id': '54391', | |
18 | 'ext': 'mp4', | |
19 | 'title': 'Septynios Kauno dienos', | |
9a76f416 | 20 | 'description': 'md5:24d84534c7dc76581e59f5689462411a', |
4dc19c09 NJ |
21 | 'duration': 1783, |
22 | }, | |
23 | 'params': { | |
339b1944 | 24 | 'skip_download': True, # m3u8 download |
4dc19c09 | 25 | }, |
4dc19c09 NJ |
26 | } |
27 | ||
28 | def _real_extract(self, url): | |
8112d4b2 | 29 | video_id = self._match_id(url) |
4dc19c09 NJ |
30 | webpage = self._download_webpage(url, video_id) |
31 | ||
32 | title = remove_end(self._og_search_title(webpage), ' - LRT') | |
33 | thumbnail = self._og_search_thumbnail(webpage) | |
34 | description = self._og_search_description(webpage) | |
35 | duration = parse_duration(self._search_regex( | |
85367c3a | 36 | r"var record_len = '([0-9]+:[0-9]+:[0-9]+)';", webpage, 'record_len', fatal=False, default=None)) |
4dc19c09 | 37 | |
339b1944 GS |
38 | link = self._search_regex(r'file: "(.*)" \+ location\.hash\.substring\(1\)', webpage, 'link to m3u8') |
39 | formats = self._extract_m3u8_formats(link, video_id, "mp4") | |
4dc19c09 NJ |
40 | |
41 | return { | |
42 | 'id': video_id, | |
43 | 'title': title, | |
44 | 'formats': formats, | |
45 | 'thumbnail': thumbnail, | |
46 | 'description': description, | |
47 | 'duration': duration, | |
48 | } |