aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/jadorecettepub.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-02-08 19:20:11 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-02-08 19:20:23 +0100
commit9766538124384b75c6b6cdfd8cb03ddce30136dc (patch)
treed56ae6dec3de43a0b14cd7a6a6ea14005aa430ad /youtube_dl/extractor/jadorecettepub.py
parent98dbee86815cad4d1fe1befab328033a16c56df6 (diff)
[jadorecettepub] Add extractor (Fixes #2148)
Diffstat (limited to 'youtube_dl/extractor/jadorecettepub.py')
-rw-r--r--youtube_dl/extractor/jadorecettepub.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/youtube_dl/extractor/jadorecettepub.py b/youtube_dl/extractor/jadorecettepub.py
new file mode 100644
index 000000000..d918fff81
--- /dev/null
+++ b/youtube_dl/extractor/jadorecettepub.py
@@ -0,0 +1,49 @@
+# coding: utf-8
+
+from __future__ import unicode_literals
+
+import json
+import re
+
+from .common import InfoExtractor
+from .youtube import YoutubeIE
+
+
+class JadoreCettePubIE(InfoExtractor):
+ _VALID_URL = r'http://(?:www\.)?jadorecettepub\.com/[0-9]{4}/[0-9]{2}/(?P<id>.*?)\.html'
+
+ _TEST = {
+ 'url': 'http://www.jadorecettepub.com/2010/12/star-wars-massacre-par-les-japonais.html',
+ 'md5': '401286a06067c70b44076044b66515de',
+ 'info_dict': {
+ 'id': 'jLMja3tr7a4',
+ 'ext': 'mp4',
+ 'title': 'La pire utilisation de Star Wars',
+ 'description': "Jadorecettepub.com vous a gratifié de plusieurs pubs géniales utilisant Star Wars et Dark Vador plus particulièrement... Mais l'heure est venue de vous proposer une version totalement massacrée, venue du Japon. Quand les Japonais détruisent l'image de Star Wars pour vendre du thon en boite, ça promet...",
+ },
+ }
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ display_id = mobj.group('id')
+
+ webpage = self._download_webpage(url, display_id)
+
+ title = self._html_search_regex(
+ r'<span style="font-size: x-large;"><b>(.*?)</b></span>',
+ webpage, 'title')
+ description = self._html_search_regex(
+ r'(?s)<div id="fb-root">(.*?)<script>', webpage, 'description',
+ fatal=False)
+ real_url = self._search_regex(
+ r'\[/postlink\](.*)endofvid', webpage, 'video URL')
+ video_id = YoutubeIE.extract_id(real_url)
+
+ return {
+ '_type': 'url_transparent',
+ 'url': real_url,
+ 'id': video_id,
+ 'title': title,
+ 'description': description,
+ }
+