]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/lcp.py
d/p/remove-autoupdate-mechanism.patch: Update patch with metadata at the top.
[youtubedl] / youtube_dl / extractor / lcp.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
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
25
26 class LcpIE(InfoExtractor):
27 _VALID_URL = r'https?://(?:www\.)?lcp\.fr/(?:[^/]+/)*(?P<id>[^/]+)'
28
29 _TESTS = [{
30 # arkena embed
31 'url': 'http://www.lcp.fr/la-politique-en-video/schwartzenberg-prg-preconise-francois-hollande-de-participer-une-primaire',
32 'md5': 'b8bd9298542929c06c1c15788b1f277a',
33 'info_dict': {
34 'id': 'd56d03e9',
35 'ext': 'mp4',
36 'title': 'Schwartzenberg (PRG) préconise à François Hollande de participer à une primaire à gauche',
37 'description': 'md5:96ad55009548da9dea19f4120c6c16a8',
38 'timestamp': 1456488895,
39 'upload_date': '20160226',
40 },
41 'params': {
42 'skip_download': True,
43 },
44 }, {
45 # dailymotion live stream
46 'url': 'http://www.lcp.fr/le-direct',
47 'info_dict': {
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,
60 },
61 }, {
62 'url': 'http://www.lcp.fr/emissions/277792-les-volontaires',
63 'only_matching': True,
64 }]
65
66 def _real_extract(self, url):
67 display_id = self._match_id(url)
68
69 webpage = self._download_webpage(url, display_id)
70
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:
76 return self.url_result(url, 'Generic')
77
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 }