2 from __future__ import unicode_literals
6 from .common import InfoExtractor
15 class LRTIE(InfoExtractor):
17 _VALID_URL = r'https?://(?:www\.)?lrt\.lt/mediateka/irasas/(?P<id>[0-9]+)'
20 'url': 'http://www.lrt.lt/mediateka/irasas/54391/',
21 'md5': 'fe44cf7e4ab3198055f2c598fc175cb0',
25 'title': 'Septynios Kauno dienos',
26 'description': 'md5:24d84534c7dc76581e59f5689462411a',
33 'url': 'http://www.lrt.lt/mediateka/irasas/1013074524/',
34 'md5': '389da8ca3cad0f51d12bed0c844f6a0a',
38 'title': 'Kita tema 2016-09-05 15:05',
39 'description': 'md5:1b295a8fc7219ed0d543fc228c931fb5',
46 def _real_extract(self, url):
47 video_id = self._match_id(url)
48 webpage = self._download_webpage(url, video_id)
50 title = remove_end(self._og_search_title(webpage), ' - LRT')
53 for _, file_url in re.findall(
54 r'file\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage):
55 ext = determine_ext(file_url)
56 if ext not in ('m3u8', 'mp3'):
58 # mp3 served as m3u8 produces stuttered media file
59 if ext == 'm3u8' and '.mp3' in file_url:
62 formats.extend(self._extract_m3u8_formats(
63 file_url, video_id, 'mp4', entry_protocol='m3u8_native',
70 self._sort_formats(formats)
72 thumbnail = self._og_search_thumbnail(webpage)
73 description = self._og_search_description(webpage)
74 duration = parse_duration(self._search_regex(
75 r'var\s+record_len\s*=\s*(["\'])(?P<duration>[0-9]+:[0-9]+:[0-9]+)\1',
76 webpage, 'duration', default=None, group='duration'))
78 view_count = int_or_none(self._html_search_regex(
79 r'<div[^>]+class=(["\']).*?record-desc-seen.*?\1[^>]*>(?P<count>.+?)</div>',
80 webpage, 'view count', fatal=False, group='count'))
81 like_count = int_or_none(self._search_regex(
82 r'<span[^>]+id=(["\'])flikesCount.*?\1>(?P<count>\d+)<',
83 webpage, 'like count', fatal=False, group='count'))
89 'thumbnail': thumbnail,
90 'description': description,
92 'view_count': view_count,
93 'like_count': like_count,