]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/jadorecettepub.py
Add support for https for all extractors as preventive and future-proof measure
[yt-dlp.git] / youtube_dl / extractor / jadorecettepub.py
CommitLineData
97665381
PH
1# coding: utf-8
2
3from __future__ import unicode_literals
4
97665381
PH
5import re
6
7from .common import InfoExtractor
8from .youtube import YoutubeIE
9
10
11class JadoreCettePubIE(InfoExtractor):
5886b38d 12 _VALID_URL = r'https?://(?:www\.)?jadorecettepub\.com/[0-9]{4}/[0-9]{2}/(?P<id>.*?)\.html'
97665381
PH
13
14 _TEST = {
15 'url': 'http://www.jadorecettepub.com/2010/12/star-wars-massacre-par-les-japonais.html',
16 'md5': '401286a06067c70b44076044b66515de',
17 'info_dict': {
18 'id': 'jLMja3tr7a4',
19 'ext': 'mp4',
20 'title': 'La pire utilisation de Star Wars',
21 '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...",
22 },
23 }
24
25 def _real_extract(self, url):
26 mobj = re.match(self._VALID_URL, url)
27 display_id = mobj.group('id')
28
29 webpage = self._download_webpage(url, display_id)
30
31 title = self._html_search_regex(
32 r'<span style="font-size: x-large;"><b>(.*?)</b></span>',
33 webpage, 'title')
34 description = self._html_search_regex(
35 r'(?s)<div id="fb-root">(.*?)<script>', webpage, 'description',
36 fatal=False)
37 real_url = self._search_regex(
38 r'\[/postlink\](.*)endofvid', webpage, 'video URL')
39 video_id = YoutubeIE.extract_id(real_url)
40
41 return {
42 '_type': 'url_transparent',
43 'url': real_url,
44 'id': video_id,
45 'title': title,
46 'description': description,
47 }