2 from __future__ import unicode_literals
6 from .common import InfoExtractor
15 class LnkGoIE(InfoExtractor):
16 _VALID_URL = r'https?://(?:www\.)?lnk(?:go)?\.(?:alfa\.)?lt/(?:visi-video/[^/]+|video)/(?P<id>[A-Za-z0-9-]+)(?:/(?P<episode_id>\d+))?'
18 'url': 'http://www.lnkgo.lt/visi-video/aktualai-pratesimas/ziurek-putka-trys-klausimai',
22 'title': "Put'ka: Trys Klausimai",
23 'upload_date': '20161216',
24 'description': 'Seniai matytas Put’ka užduoda tris klausimėlius. Pabandykime surasti atsakymus.',
27 'thumbnail': r're:^https?://.*\.jpg$',
28 'timestamp': 1481904000,
31 'skip_download': True, # HLS download
34 'url': 'http://lnkgo.alfa.lt/visi-video/aktualai-pratesimas/ziurek-nerdas-taiso-kompiuteri-2',
38 'title': 'Nėrdas: Kompiuterio Valymas',
39 'upload_date': '20150113',
40 'description': 'md5:7352d113a242a808676ff17e69db6a69',
43 'thumbnail': r're:^https?://.*\.jpg$',
44 'timestamp': 1421164800,
47 'skip_download': True, # HLS download
50 'url': 'https://lnk.lt/video/neigalieji-tv-bokste/37413',
51 'only_matching': True,
58 _M3U8_TEMPL = 'https://vod.lnk.lt/lnk_vod/lnk/lnk/%s:%s/playlist.m3u8%s'
60 def _real_extract(self, url):
61 display_id, video_id = re.match(self._VALID_URL, url).groups()
63 video_info = self._download_json(
64 'https://lnk.lt/api/main/video-page/%s/%s/false' % (display_id, video_id or '0'),
65 display_id)['videoConfig']['videoInfo']
67 video_id = compat_str(video_info['id'])
68 title = video_info['title']
69 prefix = 'smil' if video_info.get('isQualityChangeAvailable') else 'mp4'
70 formats = self._extract_m3u8_formats(
71 self._M3U8_TEMPL % (prefix, video_info['videoUrl'], video_info.get('secureTokenParams') or ''),
72 video_id, 'mp4', 'm3u8_native')
73 self._sort_formats(formats)
75 poster_image = video_info.get('posterImage')
79 'display_id': display_id,
82 'thumbnail': 'https://lnk.lt/all-images/' + poster_image if poster_image else None,
83 'duration': int_or_none(video_info.get('duration')),
84 'description': clean_html(video_info.get('htmlDescription')),
85 'age_limit': self._AGE_LIMITS.get(video_info.get('pgRating'), 0),
86 'timestamp': parse_iso8601(video_info.get('airDate')),
87 'view_count': int_or_none(video_info.get('viewsCount')),