[youtube] fix extraction for embed restricted live streams(fixes #16433)
[youtube-dl] / youtube_dl / extractor / telecinco.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .mitele import MiTeleBaseIE
5
6
7 class TelecincoIE(MiTeleBaseIE):
8     IE_DESC = 'telecinco.es, cuatro.com and mediaset.es'
9     _VALID_URL = r'https?://(?:www\.)?(?:telecinco\.es|cuatro\.com|mediaset\.es)/(?:[^/]+/)+(?P<id>.+?)\.html'
10
11     _TESTS = [{
12         'url': 'http://www.telecinco.es/robinfood/temporada-01/t01xp14/Bacalao-cocochas-pil-pil_0_1876350223.html',
13         'md5': '8d7b2d5f699ee2709d992a63d5cd1712',
14         'info_dict': {
15             'id': 'JEA5ijCnF6p5W08A1rNKn7',
16             'ext': 'mp4',
17             'title': 'Bacalao con kokotxas al pil-pil',
18             'description': 'md5:1382dacd32dd4592d478cbdca458e5bb',
19             'duration': 662,
20         },
21     }, {
22         'url': 'http://www.cuatro.com/deportes/futbol/barcelona/Leo_Messi-Champions-Roma_2_2052780128.html',
23         'md5': '284393e5387b3b947b77c613ef04749a',
24         'info_dict': {
25             'id': 'jn24Od1zGLG4XUZcnUnZB6',
26             'ext': 'mp4',
27             'title': '¿Quién es este ex futbolista con el que hablan Leo Messi y Luis Suárez?',
28             'description': 'md5:a62ecb5f1934fc787107d7b9a2262805',
29             'duration': 79,
30         },
31     }, {
32         'url': 'http://www.mediaset.es/12meses/campanas/doylacara/conlatratanohaytrato/Ayudame-dar-cara-trata-trato_2_1986630220.html',
33         'md5': '749afab6ea5a136a8806855166ae46a2',
34         'info_dict': {
35             'id': 'aywerkD2Sv1vGNqq9b85Q2',
36             'ext': 'mp4',
37             'title': '#DOYLACARA. Con la trata no hay trato',
38             'description': 'md5:2771356ff7bfad9179c5f5cd954f1477',
39             'duration': 50,
40         },
41     }, {
42         'url': 'http://www.telecinco.es/informativos/nacional/Pablo_Iglesias-Informativos_Telecinco-entrevista-Pedro_Piqueras_2_1945155182.html',
43         'only_matching': True,
44     }, {
45         'url': 'http://www.telecinco.es/espanasinirmaslejos/Espana-gran-destino-turistico_2_1240605043.html',
46         'only_matching': True,
47     }, {
48         # ooyala video
49         'url': 'http://www.cuatro.com/chesterinlove/a-carta/chester-chester_in_love-chester_edu_2_2331030022.html',
50         'only_matching': True,
51     }]
52
53     def _real_extract(self, url):
54         display_id = self._match_id(url)
55         webpage = self._download_webpage(url, display_id)
56         title = self._html_search_meta(
57             ['og:title', 'twitter:title'], webpage, 'title')
58         info = self._get_player_info(url, webpage)
59         info.update({
60             'display_id': display_id,
61             'title': title,
62             'description': self._html_search_meta(
63                 ['og:description', 'twitter:description'],
64                 webpage, 'title', fatal=False),
65         })
66         return info