X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Ffrancetv.py;h=086cafca027e3b99967f50f3220d1632f1cc8033;hb=7b2212e954a3f2ecf1c0936d7c5b90a43fa380cd;hp=6e11764704b9afbf1a25e33a62cee92a49b7a805;hpb=5d8afe69f7be840c6494333e84c46f0a1ca93147;p=youtube-dl diff --git a/youtube_dl/extractor/francetv.py b/youtube_dl/extractor/francetv.py index 6e1176470..086cafca0 100644 --- a/youtube_dl/extractor/francetv.py +++ b/youtube_dl/extractor/francetv.py @@ -1,6 +1,7 @@ # encoding: utf-8 import re import xml.etree.ElementTree +import json from .common import InfoExtractor from ..utils import ( @@ -8,32 +9,12 @@ from ..utils import ( ) -class PluzzIE(InfoExtractor): - IE_NAME = u'pluzz.francetv.fr' - _VALID_URL = r'https?://pluzz\.francetv\.fr/videos/(.*?)\.html' - - _TEST = { - u'url': u'http://pluzz.francetv.fr/videos/allo_rufo_saison5_,88439064.html', - u'file': u'88439064.mp4', - u'info_dict': { - u'title': u'Allô Rufo', - u'description': u'md5:d909f1ebdf963814b65772aea250400e', - }, - u'params': { - u'skip_download': True, - }, - } - - def _real_extract(self, url): - title = re.match(self._VALID_URL, url).group(1) - webpage = self._download_webpage(url, title) - video_id = self._search_regex( - r'data-diffusion="(\d+)"', webpage, 'ID') - +class FranceTVBaseInfoExtractor(InfoExtractor): + def _extract_video(self, video_id): xml_desc = self._download_webpage( - 'http://www.pluzz.fr/appftv/webservices/video/' + 'http://www.francetvinfo.fr/appftv/webservices/video/' 'getInfosOeuvre.php?id-diffusion=' - + video_id, title, 'Downloading XML config') + + video_id, video_id, 'Downloading XML config') info = xml.etree.ElementTree.fromstring(xml_desc.encode('utf-8')) manifest_url = info.find('videos/video/url').text @@ -45,6 +26,104 @@ class PluzzIE(InfoExtractor): 'ext': 'mp4', 'url': video_url, 'title': info.find('titre').text, - 'thumbnail': compat_urlparse.urljoin(url, thumbnail_path), + 'thumbnail': compat_urlparse.urljoin('http://pluzz.francetv.fr', thumbnail_path), 'description': info.find('synopsis').text, } + + +class PluzzIE(FranceTVBaseInfoExtractor): + IE_NAME = u'pluzz.francetv.fr' + _VALID_URL = r'https?://pluzz\.francetv\.fr/videos/(.*?)\.html' + + # Can't use tests, videos expire in 7 days + + def _real_extract(self, url): + title = re.match(self._VALID_URL, url).group(1) + webpage = self._download_webpage(url, title) + video_id = self._search_regex( + r'data-diffusion="(\d+)"', webpage, 'ID') + return self._extract_video(video_id) + + +class FranceTvInfoIE(FranceTVBaseInfoExtractor): + IE_NAME = u'francetvinfo.fr' + _VALID_URL = r'https?://www\.francetvinfo\.fr/replay.*/(?P