2 from __future__ import unicode_literals
4 from .common import InfoExtractor
7 class TVN24IE(InfoExtractor):
8 _VALID_URL = r'http://(?:tvn24bis|(?:www|fakty)\.tvn24)\.pl/.+/(?P<id>[^/]+)\.html'
10 'url': 'http://www.tvn24.pl/wiadomosci-z-kraju,3/oredzie-artura-andrusa,702428.html',
11 'md5': 'fbdec753d7bc29d96036808275f2130c',
15 'title': '"Święta mają być wesołe, dlatego, ludziska, wszyscy pod jemiołę"',
16 'description': 'Wyjątkowe orędzie Artura Andrusa, jednego z gości "Szkła kontaktowego".',
17 'thumbnail': 're:http://.*[.]jpeg',
21 def _real_extract(self, url):
22 page_id = self._match_id(url)
23 webpage = self._download_webpage(url, page_id)
24 title = self._og_search_title(webpage)
25 description = self._og_search_description(webpage)
26 thumbnail = self._html_search_regex(r'\bdata-poster="(.+?)"', webpage, 'data-poster')
27 share_params = self._html_search_regex(r'\bdata-share-params="(.+?)"', webpage, 'data-share-params')
28 share_params = self._parse_json(share_params, page_id)
29 video_id = share_params['id']
30 quality_data = self._html_search_regex(r'\bdata-quality="(.+?)"', webpage, 'data-quality')
31 quality_data = self._parse_json(quality_data, page_id)
33 for format_id, url in quality_data.items():
35 'format_id': format_id,
36 'height': int(format_id.rstrip('p')),
40 self._sort_formats(formats)
44 'description': description,
45 'thumbnail': thumbnail,