]>
Commit | Line | Data |
---|---|---|
1 | # coding: utf-8 | |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .telecinco import TelecincoIE | |
5 | from ..utils import ( | |
6 | int_or_none, | |
7 | parse_iso8601, | |
8 | ) | |
9 | ||
10 | ||
11 | class MiTeleIE(TelecincoIE): | |
12 | IE_DESC = 'mitele.es' | |
13 | _VALID_URL = r'https?://(?:www\.)?mitele\.es/(?:[^/]+/)+(?P<id>[^/]+)/player' | |
14 | ||
15 | _TESTS = [{ | |
16 | 'url': 'http://www.mitele.es/programas-tv/diario-de/57b0dfb9c715da65618b4afa/player', | |
17 | 'info_dict': { | |
18 | 'id': 'FhYW1iNTE6J6H7NkQRIEzfne6t2quqPg', | |
19 | 'ext': 'mp4', | |
20 | 'title': 'Diario de La redacción Programa 144', | |
21 | 'description': 'md5:07c35a7b11abb05876a6a79185b58d27', | |
22 | 'series': 'Diario de', | |
23 | 'season': 'Season 14', | |
24 | 'season_number': 14, | |
25 | 'episode': 'Tor, la web invisible', | |
26 | 'episode_number': 3, | |
27 | 'thumbnail': r're:(?i)^https?://.*\.jpg$', | |
28 | 'duration': 2913, | |
29 | 'age_limit': 16, | |
30 | 'timestamp': 1471209401, | |
31 | 'upload_date': '20160814', | |
32 | }, | |
33 | }, { | |
34 | # no explicit title | |
35 | 'url': 'http://www.mitele.es/programas-tv/cuarto-milenio/57b0de3dc915da14058b4876/player', | |
36 | 'info_dict': { | |
37 | 'id': 'oyNG1iNTE6TAPP-JmCjbwfwJqqMMX3Vq', | |
38 | 'ext': 'mp4', | |
39 | 'title': 'Cuarto Milenio Temporada 6 Programa 226', | |
40 | 'description': 'md5:5ff132013f0cd968ffbf1f5f3538a65f', | |
41 | 'series': 'Cuarto Milenio', | |
42 | 'season': 'Season 6', | |
43 | 'season_number': 6, | |
44 | 'episode': 'Episode 24', | |
45 | 'episode_number': 24, | |
46 | 'thumbnail': r're:(?i)^https?://.*\.jpg$', | |
47 | 'duration': 7313, | |
48 | 'age_limit': 12, | |
49 | 'timestamp': 1471209021, | |
50 | 'upload_date': '20160814', | |
51 | }, | |
52 | 'params': { | |
53 | 'skip_download': True, | |
54 | }, | |
55 | }, { | |
56 | 'url': 'http://www.mitele.es/series-online/la-que-se-avecina/57aac5c1c915da951a8b45ed/player', | |
57 | 'only_matching': True, | |
58 | }, { | |
59 | 'url': 'https://www.mitele.es/programas-tv/diario-de/la-redaccion/programa-144-40_1006364575251/player/', | |
60 | 'only_matching': True, | |
61 | }] | |
62 | ||
63 | def _real_extract(self, url): | |
64 | display_id = self._match_id(url) | |
65 | webpage = self._download_webpage(url, display_id) | |
66 | pre_player = self._parse_json(self._search_regex( | |
67 | r'window\.\$REACTBASE_STATE\.prePlayer_mtweb\s*=\s*({.+})', | |
68 | webpage, 'Pre Player'), display_id)['prePlayer'] | |
69 | title = pre_player['title'] | |
70 | video_info = self._parse_content(pre_player['video'], url) | |
71 | content = pre_player.get('content') or {} | |
72 | info = content.get('info') or {} | |
73 | ||
74 | video_info.update({ | |
75 | 'title': title, | |
76 | 'description': info.get('synopsis'), | |
77 | 'series': content.get('title'), | |
78 | 'season_number': int_or_none(info.get('season_number')), | |
79 | 'episode': content.get('subtitle'), | |
80 | 'episode_number': int_or_none(info.get('episode_number')), | |
81 | 'duration': int_or_none(info.get('duration')), | |
82 | 'age_limit': int_or_none(info.get('rating')), | |
83 | 'timestamp': parse_iso8601(pre_player.get('publishedTime')), | |
84 | }) | |
85 | return video_info |