about summary refs log tree commit diff
path: root/youtube_dl/extractor/lcp.py
diff options
context:
space:
mode:
authorRob van Bekkum <rob_van_bekkum@hotmail.com>2016-02-27 18:21:42 +0100
committerSergey M․ <dstftw@gmail.com>2016-07-23 17:01:09 +0700
commit4671dd41b27e39eb4682189fca44d0f4272a4751 (patch)
tree7d990d41b8110e87640ad8f081197b5aa4e4ec66 /youtube_dl/extractor/lcp.py
parentf164b97123d5b61a7dd055c888212a0dc670f04f (diff)
downloadyoutube-dl-4671dd41b27e39eb4682189fca44d0f4272a4751.tar.gz
youtube-dl-4671dd41b27e39eb4682189fca44d0f4272a4751.tar.xz
youtube-dl-4671dd41b27e39eb4682189fca44d0f4272a4751.zip
[arkena:lcp] Add extractors
Diffstat (limited to 'youtube_dl/extractor/lcp.py')
-rw-r--r--youtube_dl/extractor/lcp.py39
1 files changed, 39 insertions, 0 deletions
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<id>[^/]+)'
+
+    _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<url>(?: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)