]>
Commit | Line | Data |
---|---|---|
4671dd41 RB |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
c8e170b2 | 3 | |
4671dd41 | 4 | from .common import InfoExtractor |
c8e170b2 S |
5 | from .arkena import ArkenaIE |
6 | ||
7 | ||
8 | class LcpPlayIE(ArkenaIE): | |
9 | _VALID_URL = r'https?://play\.lcp\.fr/embed/(?P<id>[^/]+)/(?P<account_id>[^/]+)/[^/]+/[^/]+' | |
10 | _TESTS = [{ | |
11 | 'url': 'http://play.lcp.fr/embed/327336/131064/darkmatter/0', | |
12 | 'md5': 'b8bd9298542929c06c1c15788b1f277a', | |
13 | 'info_dict': { | |
14 | 'id': '327336', | |
15 | 'ext': 'mp4', | |
16 | 'title': '327336', | |
17 | 'timestamp': 1456391602, | |
18 | 'upload_date': '20160225', | |
19 | }, | |
20 | 'params': { | |
21 | 'skip_download': True, | |
22 | }, | |
23 | }] | |
24 | ||
4671dd41 RB |
25 | |
26 | class LcpIE(InfoExtractor): | |
c8e170b2 | 27 | _VALID_URL = r'https?://(?:www\.)?lcp\.fr/(?:[^/]+/)*(?P<id>[^/]+)' |
4671dd41 RB |
28 | |
29 | _TESTS = [{ | |
c8e170b2 | 30 | # arkena embed |
4671dd41 | 31 | 'url': 'http://www.lcp.fr/la-politique-en-video/schwartzenberg-prg-preconise-francois-hollande-de-participer-une-primaire', |
c8e170b2 | 32 | 'md5': 'b8bd9298542929c06c1c15788b1f277a', |
4671dd41 RB |
33 | 'info_dict': { |
34 | 'id': 'd56d03e9', | |
4671dd41 | 35 | 'ext': 'mp4', |
c8e170b2 S |
36 | 'title': 'Schwartzenberg (PRG) préconise à François Hollande de participer à une primaire à gauche', |
37 | 'description': 'md5:96ad55009548da9dea19f4120c6c16a8', | |
38 | 'timestamp': 1456488895, | |
4671dd41 | 39 | 'upload_date': '20160226', |
c8e170b2 S |
40 | }, |
41 | 'params': { | |
42 | 'skip_download': True, | |
43 | }, | |
4671dd41 | 44 | }, { |
c8e170b2 | 45 | # dailymotion live stream |
4671dd41 RB |
46 | 'url': 'http://www.lcp.fr/le-direct', |
47 | 'info_dict': { | |
c8e170b2 S |
48 | 'id': 'xji3qy', |
49 | 'ext': 'mp4', | |
50 | 'title': 'La Chaine Parlementaire (LCP), Live TNT', | |
51 | 'description': 'md5:5c69593f2de0f38bd9a949f2c95e870b', | |
52 | 'uploader': 'LCP', | |
53 | 'uploader_id': 'xbz33d', | |
54 | 'timestamp': 1308923058, | |
55 | 'upload_date': '20110624', | |
56 | }, | |
57 | 'params': { | |
58 | # m3u8 live stream | |
59 | 'skip_download': True, | |
4671dd41 | 60 | }, |
c8e170b2 S |
61 | }, { |
62 | 'url': 'http://www.lcp.fr/emissions/277792-les-volontaires', | |
63 | 'only_matching': True, | |
4671dd41 RB |
64 | }] |
65 | ||
66 | def _real_extract(self, url): | |
67 | display_id = self._match_id(url) | |
c8e170b2 | 68 | |
4671dd41 RB |
69 | webpage = self._download_webpage(url, display_id) |
70 | ||
c8e170b2 S |
71 | play_url = self._search_regex( |
72 | r'<iframe[^>]+src=(["\'])(?P<url>%s?(?:(?!\1).)*)\1' % LcpPlayIE._VALID_URL, | |
73 | webpage, 'play iframe', default=None, group='url') | |
74 | ||
75 | if not play_url: | |
4671dd41 RB |
76 | return self.url_result(url, 'Generic') |
77 | ||
c8e170b2 S |
78 | title = self._og_search_title(webpage, default=None) or self._html_search_meta( |
79 | 'twitter:title', webpage, fatal=True) | |
80 | description = self._html_search_meta( | |
81 | ('description', 'twitter:description'), webpage) | |
82 | ||
83 | return { | |
84 | '_type': 'url_transparent', | |
85 | 'ie_key': LcpPlayIE.ie_key(), | |
86 | 'url': play_url, | |
87 | 'display_id': display_id, | |
88 | 'title': title, | |
89 | 'description': description, | |
90 | } |