From 9766538124384b75c6b6cdfd8cb03ddce30136dc Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Sat, 8 Feb 2014 19:20:11 +0100 Subject: [jadorecettepub] Add extractor (Fixes #2148) --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/jadorecettepub.py | 49 ++++++++++++++++++++++++++++++++++ youtube_dl/extractor/youtube.py | 7 ++--- 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 youtube_dl/extractor/jadorecettepub.py (limited to 'youtube_dl') diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index bc1e57aff..4678cf06c 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -105,6 +105,7 @@ from .ivi import ( IviIE, IviCompilationIE ) +from .jadorecettepub import JadoreCettePubIE from .jeuxvideo import JeuxVideoIE from .jukebox import JukeboxIE from .justintv import JustinTVIE 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.*?)\.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'(.*?)', + webpage, 'title') + description = self._html_search_regex( + r'(?s)
(.*?)