2 from __future__ import unicode_literals
6 from .common import InfoExtractor
13 class LnkGoIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?lnkgo\.(?:alfa\.)?lt/visi-video/(?P<show>[^/]+)/ziurek-(?P<id>[A-Za-z0-9-]+)'
16 'url': 'http://lnkgo.alfa.lt/visi-video/yra-kaip-yra/ziurek-yra-kaip-yra-162',
20 'title': 'Yra kaip yra',
21 'upload_date': '20150107',
22 'description': 'md5:d82a5e36b775b7048617f263a0e3475e',
25 'thumbnail': r're:^https?://.*\.jpg$'
28 'skip_download': True, # HLS download
31 'url': 'http://lnkgo.alfa.lt/visi-video/aktualai-pratesimas/ziurek-nerdas-taiso-kompiuteri-2',
35 'title': 'Nėrdas: Kompiuterio Valymas',
36 'upload_date': '20150113',
37 'description': 'md5:7352d113a242a808676ff17e69db6a69',
40 'thumbnail': r're:^https?://.*\.jpg$'
43 'skip_download': True, # HLS download
46 'url': 'http://www.lnkgo.lt/visi-video/aktualai-pratesimas/ziurek-putka-trys-klausimai',
47 'only_matching': True,
55 def _real_extract(self, url):
56 display_id = self._match_id(url)
58 webpage = self._download_webpage(
59 url, display_id, 'Downloading player webpage')
61 video_id = self._search_regex(
62 r'data-ep="([^"]+)"', webpage, 'video ID')
63 title = self._og_search_title(webpage)
64 description = self._og_search_description(webpage)
65 upload_date = unified_strdate(self._search_regex(
66 r'class="[^"]*meta-item[^"]*air-time[^"]*">.*?<strong>([^<]+)</strong>', webpage, 'upload date', fatal=False))
68 thumbnail_w = int_or_none(
69 self._og_search_property('image:width', webpage, 'thumbnail width', fatal=False))
70 thumbnail_h = int_or_none(
71 self._og_search_property('image:height', webpage, 'thumbnail height', fatal=False))
73 'url': self._og_search_thumbnail(webpage),
75 if thumbnail_w and thumbnail_h:
78 'height': thumbnail_h,
81 config = self._parse_json(self._search_regex(
82 r'episodePlayer\((\{.*?\}),\s*\{', webpage, 'sources'), video_id)
84 if config.get('pGeo'):
86 'This content might not be available in your country due to copyright reasons')
91 'url': config['EpisodeVideoLink_HLS'],
94 m = re.search(r'^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<play_path>.+)$', config['EpisodeVideoLink'])
99 'url': m.group('url'),
100 'play_path': m.group('play_path'),
104 self._sort_formats(formats)
108 'display_id': display_id,
111 'thumbnails': [thumbnail],
112 'duration': int_or_none(config.get('VideoTime')),
113 'description': description,
114 'age_limit': self._AGE_LIMITS.get(config.get('PGRating'), 0),
115 'upload_date': upload_date,