2 from __future__ import unicode_literals
6 from .common import InfoExtractor
14 class LnkGoIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:www\.)?lnkgo\.alfa\.lt/visi\-video/(?P<show>[^/]+)/ziurek\-(?P<display_id>[A-Za-z0-9\-]+)'
17 'url': 'http://lnkgo.alfa.lt/visi-video/yra-kaip-yra/ziurek-yra-kaip-yra-162',
21 'title': 'Yra kaip yra',
22 'upload_date': '20150107',
23 'description': 'md5:d82a5e36b775b7048617f263a0e3475e',
26 'thumbnail': 're:^https?://.*\.jpg$'
29 'skip_download': True, # HLS download
32 'url': 'http://lnkgo.alfa.lt/visi-video/aktualai-pratesimas/ziurek-nerdas-taiso-kompiuteri-2',
36 'title': 'Nėrdas: Kompiuterio Valymas',
37 'upload_date': '20150113',
38 'description': 'md5:7352d113a242a808676ff17e69db6a69',
41 'thumbnail': 're:^https?://.*\.jpg$'
44 'skip_download': True, # HLS download
53 def _real_extract(self, url):
54 mobj = re.match(self._VALID_URL, url)
55 display_id = mobj.group('display_id')
57 webpage = self._download_webpage(
58 url, display_id, 'Downloading player webpage')
60 video_id = self._search_regex(
61 r'data-ep="([^"]+)"', webpage, 'video ID')
62 title = self._og_search_title(webpage)
63 description = self._og_search_description(webpage)
65 thumbnail = self._og_search_thumbnail(webpage)
66 thumbnail_w = int_or_none(
67 self._og_search_property('image:width', webpage, 'thumbnail width', fatal=False))
68 thumbnail_h = int_or_none(
69 self._og_search_property('image:height', webpage, 'thumbnail height', fatal=False))
73 'height': thumbnail_h,
76 upload_date = unified_strdate(self._search_regex(
77 r'class="meta-item\sair-time">.*?<strong>([^<]+)</strong>', webpage, 'upload date', fatal=False))
78 duration = int_or_none(self._search_regex(
79 r'VideoDuration = "([^"]+)"', webpage, 'duration', fatal=False))
81 pg_rating = self._search_regex(
82 r'pgrating="([^"]+)"', webpage, 'PG rating', fatal=False, default='')
83 age_limit = self._AGE_LIMITS.get(pg_rating, 0)
85 sources_js = self._search_regex(
86 r'(?s)sources:\s(\[.*?\]),', webpage, 'sources')
87 sources = self._parse_json(
88 sources_js, video_id, transform_source=js_to_json)
91 for source in sources:
92 if source.get('provider') == 'rtmp':
93 m = re.search(r'^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<play_path>.+)$', source['file'])
99 'url': m.group('url'),
100 'play_path': m.group('play_path'),
103 elif source.get('file').endswith('.m3u8'):
106 'ext': source.get('type', 'mp4'),
107 'url': source['file'],
110 self._sort_formats(formats)
114 'display_id': display_id,
117 'thumbnails': thumbnails,
118 'duration': duration,
119 'description': description,
120 'age_limit': age_limit,
121 'upload_date': upload_date,