From 4671dd41b27e39eb4682189fca44d0f4272a4751 Mon Sep 17 00:00:00 2001 From: Rob van Bekkum Date: Sat, 27 Feb 2016 18:21:42 +0100 Subject: [arkena:lcp] Add extractors --- youtube_dl/extractor/lcp.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 youtube_dl/extractor/lcp.py (limited to 'youtube_dl/extractor/lcp.py') diff --git a/youtube_dl/extractor/lcp.py b/youtube_dl/extractor/lcp.py new file mode 100644 index 000000000..38d7502df --- /dev/null +++ b/youtube_dl/extractor/lcp.py @@ -0,0 +1,39 @@ +# coding: utf-8 +from __future__ import unicode_literals +from .common import InfoExtractor + +class LcpIE(InfoExtractor): + IE_NAME = 'LCP' + _VALID_URL = r'https?://(?:www\.)?lcp\.fr/(?:[^\/]+/)*(?P[^/]+)' + + _TESTS = [{ + 'url': 'http://www.lcp.fr/la-politique-en-video/schwartzenberg-prg-preconise-francois-hollande-de-participer-une-primaire', + 'md5': 'ab96c4dae94322ece1e98d97c8dc7807', + 'info_dict': { + 'id': 'd56d03e9', + 'url': 're:http://httpod.scdn.arkena.com/11970/d56d03e9_.*', + 'ext': 'mp4', + 'title': 'd56d03e9', + 'upload_date': '20160226', + 'timestamp': 1456488895 + } + }, { + 'url': 'http://www.lcp.fr/le-direct', + 'info_dict': { + 'title': 'Le direct | LCP Assembl\xe9e nationale', + 'id': 'le-direct', + }, + 'playlist_mincount': 1 + }] + + def _real_extract(self, url): + display_id = self._match_id(url) + webpage = self._download_webpage(url, display_id) + + embed_url_regex = r'"(?P(?:https?://(?:www\.)?)?play\.lcp\.fr/embed/[A-za-z0-9]+/[A-za-z0-9]+/[A-za-z0-9]+/[A-za-z0-9]+)"' + embed_url = self._html_search_regex(embed_url_regex, webpage, 'player_url', default=None, fatal=False) + if not embed_url: + return self.url_result(url, 'Generic') + + title = self._og_search_title(webpage, default=None) + return self.url_result(embed_url, 'ArkenaPlay', video_id=display_id, video_title=title) -- cgit v1.2.3