]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/lcp.py
[arkena:lcp] Add extractors
[yt-dlp.git] / youtube_dl / extractor / lcp.py
CommitLineData
4671dd41
RB
1# coding: utf-8
2from __future__ import unicode_literals
3from .common import InfoExtractor
4
5class LcpIE(InfoExtractor):
6 IE_NAME = 'LCP'
7 _VALID_URL = r'https?://(?:www\.)?lcp\.fr/(?:[^\/]+/)*(?P<id>[^/]+)'
8
9 _TESTS = [{
10 'url': 'http://www.lcp.fr/la-politique-en-video/schwartzenberg-prg-preconise-francois-hollande-de-participer-une-primaire',
11 'md5': 'ab96c4dae94322ece1e98d97c8dc7807',
12 'info_dict': {
13 'id': 'd56d03e9',
14 'url': 're:http://httpod.scdn.arkena.com/11970/d56d03e9_.*',
15 'ext': 'mp4',
16 'title': 'd56d03e9',
17 'upload_date': '20160226',
18 'timestamp': 1456488895
19 }
20 }, {
21 'url': 'http://www.lcp.fr/le-direct',
22 'info_dict': {
23 'title': 'Le direct | LCP Assembl\xe9e nationale',
24 'id': 'le-direct',
25 },
26 'playlist_mincount': 1
27 }]
28
29 def _real_extract(self, url):
30 display_id = self._match_id(url)
31 webpage = self._download_webpage(url, display_id)
32
33 embed_url_regex = r'"(?P<url>(?:https?://(?:www\.)?)?play\.lcp\.fr/embed/[A-za-z0-9]+/[A-za-z0-9]+/[A-za-z0-9]+/[A-za-z0-9]+)"'
34 embed_url = self._html_search_regex(embed_url_regex, webpage, 'player_url', default=None, fatal=False)
35 if not embed_url:
36 return self.url_result(url, 'Generic')
37
38 title = self._og_search_title(webpage, default=None)
39 return self.url_result(embed_url, 'ArkenaPlay', video_id=display_id, video_title=title)