2 from __future__ import unicode_literals
4 from .common import InfoExtractor
11 class LA7IE(InfoExtractor):
13 _VALID_URL = r'''(?x)(https?://)?(?:
14 (?:www\.)?la7\.it/([^/]+)/(?:rivedila7|video)/|
15 tg\.la7\.it/repliche-tgla7\?id=
19 # 'src' is a plain URL
20 'url': 'http://www.la7.it/crozza/video/inccool8-02-10-2015-163722',
21 'md5': '6054674766e7988d3e02f2148ff92180',
23 'id': 'inccool8-02-10-2015-163722',
26 'description': 'Benvenuti nell\'incredibile mondo della INC. COOL. 8. dove “INC.” sta per “Incorporated” “COOL” sta per “fashion” ed Eight sta per il gesto atletico',
27 'thumbnail': 're:^https?://.*',
30 # 'src' is a dictionary
31 'url': 'http://tg.la7.it/repliche-tgla7?id=189080',
32 'md5': '6b0d8888d286e39870208dfeceaf456b',
39 'url': 'http://www.la7.it/omnibus/rivedila7/omnibus-news-02-07-2016-189077',
40 'only_matching': True,
43 def _real_extract(self, url):
44 video_id = self._match_id(url)
46 webpage = self._download_webpage(url, video_id)
48 player_data = self._parse_json(
49 self._search_regex(r'videoLa7\(({[^;]+})\);', webpage, 'player data'),
50 video_id, transform_source=js_to_json)
52 source = player_data['src']
53 source_urls = source.values() if isinstance(source, dict) else [source]
56 for source_url in source_urls:
57 ext = determine_ext(source_url)
59 formats.extend(self._extract_m3u8_formats(
60 source_url, video_id, ext='mp4',
61 entry_protocol='m3u8_native', m3u8_id='hls'))
66 self._sort_formats(formats)
70 'title': player_data['title'],
71 'description': self._og_search_description(webpage, default=None),
72 'thumbnail': player_data.get('poster'),