]>
Commit | Line | Data |
---|---|---|
1 | # coding: utf-8 | |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .common import InfoExtractor | |
5 | from ..utils import ( | |
6 | js_to_json, | |
7 | smuggle_url, | |
8 | ) | |
9 | ||
10 | ||
11 | class LA7IE(InfoExtractor): | |
12 | IE_NAME = 'la7.it' | |
13 | _VALID_URL = r'''(?x)(https?://)?(?: | |
14 | (?:www\.)?la7\.it/([^/]+)/(?:rivedila7|video)/| | |
15 | tg\.la7\.it/repliche-tgla7\?id= | |
16 | )(?P<id>.+)''' | |
17 | ||
18 | _TESTS = [{ | |
19 | # 'src' is a plain URL | |
20 | 'url': 'http://www.la7.it/crozza/video/inccool8-02-10-2015-163722', | |
21 | 'md5': '8b613ffc0c4bf9b9e377169fc19c214c', | |
22 | 'info_dict': { | |
23 | 'id': 'inccool8-02-10-2015-163722', | |
24 | 'ext': 'mp4', | |
25 | 'title': 'Inc.Cool8', | |
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?://.*', | |
28 | 'uploader_id': 'kdla7pillole@iltrovatore.it', | |
29 | 'timestamp': 1443814869, | |
30 | 'upload_date': '20151002', | |
31 | }, | |
32 | }, { | |
33 | # 'src' is a dictionary | |
34 | 'url': 'http://tg.la7.it/repliche-tgla7?id=189080', | |
35 | 'md5': '6b0d8888d286e39870208dfeceaf456b', | |
36 | 'info_dict': { | |
37 | 'id': '189080', | |
38 | 'ext': 'mp4', | |
39 | 'title': 'TG LA7', | |
40 | }, | |
41 | }, { | |
42 | 'url': 'http://www.la7.it/omnibus/rivedila7/omnibus-news-02-07-2016-189077', | |
43 | 'only_matching': True, | |
44 | }] | |
45 | ||
46 | def _real_extract(self, url): | |
47 | video_id = self._match_id(url) | |
48 | ||
49 | webpage = self._download_webpage(url, video_id) | |
50 | ||
51 | player_data = self._parse_json( | |
52 | self._search_regex(r'videoLa7\(({[^;]+})\);', webpage, 'player data'), | |
53 | video_id, transform_source=js_to_json) | |
54 | ||
55 | return { | |
56 | '_type': 'url_transparent', | |
57 | 'url': smuggle_url('kaltura:103:%s' % player_data['vid'], { | |
58 | 'service_url': 'http://kdam.iltrovatore.it', | |
59 | }), | |
60 | 'id': video_id, | |
61 | 'title': player_data['title'], | |
62 | 'description': self._og_search_description(webpage, default=None), | |
63 | 'thumbnail': player_data.get('poster'), | |
64 | 'ie_key': 'Kaltura', | |
65 | } |