5 from .common import InfoExtractor
11 class FranceTVBaseInfoExtractor(InfoExtractor):
12 def _extract_video(self, video_id):
13 info = self._download_xml(
14 'http://www.francetvinfo.fr/appftv/webservices/video/'
15 'getInfosOeuvre.php?id-diffusion='
16 + video_id, video_id, 'Downloading XML config')
18 manifest_url = info.find('videos/video/url').text
19 video_url = manifest_url.replace('manifest.f4m', 'index_2_av.m3u8')
20 video_url = video_url.replace('/z/', '/i/')
21 thumbnail_path = info.find('image').text
23 return {'id': video_id,
26 'title': info.find('titre').text,
27 'thumbnail': compat_urlparse.urljoin('http://pluzz.francetv.fr', thumbnail_path),
28 'description': info.find('synopsis').text,
32 class PluzzIE(FranceTVBaseInfoExtractor):
33 IE_NAME = u'pluzz.francetv.fr'
34 _VALID_URL = r'https?://pluzz\.francetv\.fr/videos/(.*?)\.html'
36 # Can't use tests, videos expire in 7 days
38 def _real_extract(self, url):
39 title = re.match(self._VALID_URL, url).group(1)
40 webpage = self._download_webpage(url, title)
41 video_id = self._search_regex(
42 r'data-diffusion="(\d+)"', webpage, 'ID')
43 return self._extract_video(video_id)
46 class FranceTvInfoIE(FranceTVBaseInfoExtractor):
47 IE_NAME = u'francetvinfo.fr'
48 _VALID_URL = r'https?://www\.francetvinfo\.fr/replay.*/(?P<title>.+).html'
51 u'url': u'http://www.francetvinfo.fr/replay-jt/france-3/soir-3/jt-grand-soir-3-lundi-26-aout-2013_393427.html',
52 u'file': u'84981923.mp4',
57 u'skip_download': True,
61 def _real_extract(self, url):
62 mobj = re.match(self._VALID_URL, url)
63 page_title = mobj.group('title')
64 webpage = self._download_webpage(url, page_title)
65 video_id = self._search_regex(r'id-video=(\d+?)"', webpage, u'video id')
66 return self._extract_video(video_id)
69 class France2IE(FranceTVBaseInfoExtractor):
70 IE_NAME = u'france2.fr'
71 _VALID_URL = r'''(?x)https?://www\.france2\.fr/
73 emissions/.*?/videos/(?P<id>\d+)
74 | emission/(?P<key>[^/?]+)
78 u'url': u'http://www.france2.fr/emissions/13h15-le-samedi-le-dimanche/videos/75540104',
79 u'file': u'75540104.mp4',
81 u'title': u'13h15, le samedi...',
82 u'description': u'md5:2e5b58ba7a2d3692b35c792be081a03d',
85 u'skip_download': True,
89 def _real_extract(self, url):
90 mobj = re.match(self._VALID_URL, url)
92 webpage = self._download_webpage(url, mobj.group('key'))
93 video_id = self._html_search_regex(
94 r'''(?x)<div\s+class="video-player">\s*
95 <a\s+href="http://videos.francetv.fr/video/([0-9]+)"\s+
96 class="francetv-video-player">''',
99 video_id = mobj.group('id')
100 return self._extract_video(video_id)
103 class GenerationQuoiIE(InfoExtractor):
104 IE_NAME = u'france2.fr:generation-quoi'
105 _VALID_URL = r'https?://generation-quoi\.france2\.fr/portrait/(?P<name>.*)(\?|$)'
108 u'url': u'http://generation-quoi.france2.fr/portrait/garde-a-vous',
109 u'file': u'k7FJX8VBcvvLmX4wA5Q.mp4',
111 u'title': u'Génération Quoi - Garde à Vous',
112 u'uploader': u'Génération Quoi',
115 # It uses Dailymotion
116 u'skip_download': True,
120 def _real_extract(self, url):
121 mobj = re.match(self._VALID_URL, url)
122 name = mobj.group('name')
123 info_url = compat_urlparse.urljoin(url, '/medias/video/%s.json' % name)
124 info_json = self._download_webpage(info_url, name)
125 info = json.loads(info_json)
126 return self.url_result('http://www.dailymotion.com/video/%s' % info['id'],