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,
24 'ext': 'flv' if video_url.startswith('rtmp') else 'mp4',
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 FranceTVIE(FranceTVBaseInfoExtractor):
71 IE_DESC = u'France 2, 3, 4, 5 and Ô'
72 _VALID_URL = r'''(?x)https?://www\.france[2345o]\.fr/
74 emissions/.*?/(videos|emissions)/(?P<id>[^/?]+)
75 | (emissions?|jt)/(?P<key>[^/?]+)
81 u'url': u'http://www.france2.fr/emissions/13h15-le-samedi-le-dimanche/videos/75540104',
82 u'file': u'75540104.mp4',
84 u'title': u'13h15, le samedi...',
85 u'description': u'md5:2e5b58ba7a2d3692b35c792be081a03d',
89 u'skip_download': True,
94 u'url': u'http://www.france3.fr/emissions/pieces-a-conviction/diffusions/13-11-2013_145575',
96 u'id': u'000702326_CAPP_PicesconvictionExtrait313022013_120220131722_Au',
98 u'title': u'Le scandale du prix des médicaments',
99 u'description': u'md5:1384089fbee2f04fc6c9de025ee2e9ce',
103 u'skip_download': True,
108 u'url': u'http://www.france4.fr/emissions/hero-corp/videos/rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
110 u'id': u'rhozet_herocorp_bonus_1_20131106_1923_06112013172108_F4',
112 u'title': u'Hero Corp Making of - Extrait 1',
113 u'description': u'md5:c87d54871b1790679aec1197e73d650a',
117 u'skip_download': True,
122 u'url': u'http://www.france5.fr/emissions/c-a-dire/videos/92837968',
126 u'title': u'C à dire ?!',
127 u'description': u'md5:fb1db1cbad784dcce7c7a7bd177c8e2f',
131 u'skip_download': True,
136 u'url': u'http://www.franceo.fr/jt/info-afrique/04-12-2013',
140 u'title': u'Infô-Afrique',
141 u'description': u'md5:ebf346da789428841bee0fd2a935ea55',
145 u'skip_download': True,
147 u'skip': u'The id changes frequently',
151 def _real_extract(self, url):
152 mobj = re.match(self._VALID_URL, url)
153 if mobj.group('key'):
154 webpage = self._download_webpage(url, mobj.group('key'))
156 (r'''(?x)<div\s+class="video-player">\s*
157 <a\s+href="http://videos.francetv.fr/video/([0-9]+)"\s+
158 class="francetv-video-player">'''),
159 (r'<a id="player_direct" href="http://info\.francetelevisions'
160 '\.fr/\?id-video=([^"/&]+)'),
161 (r'<a class="video" id="ftv_player_(.+?)"'),
163 video_id = self._html_search_regex(id_res, webpage, u'video ID')
165 video_id = mobj.group('id')
166 return self._extract_video(video_id)
169 class GenerationQuoiIE(InfoExtractor):
170 IE_NAME = u'france2.fr:generation-quoi'
171 _VALID_URL = r'https?://generation-quoi\.france2\.fr/portrait/(?P<name>.*)(\?|$)'
174 u'url': u'http://generation-quoi.france2.fr/portrait/garde-a-vous',
175 u'file': u'k7FJX8VBcvvLmX4wA5Q.mp4',
177 u'title': u'Génération Quoi - Garde à Vous',
178 u'uploader': u'Génération Quoi',
181 # It uses Dailymotion
182 u'skip_download': True,
186 def _real_extract(self, url):
187 mobj = re.match(self._VALID_URL, url)
188 name = mobj.group('name')
189 info_url = compat_urlparse.urljoin(url, '/medias/video/%s.json' % name)
190 info_json = self._download_webpage(info_url, name)
191 info = json.loads(info_json)
192 return self.url_result('http://www.dailymotion.com/video/%s' % info['id'],
196 class CultureboxIE(FranceTVBaseInfoExtractor):
197 IE_NAME = u'culturebox.francetvinfo.fr'
198 _VALID_URL = r'https?://culturebox\.francetvinfo\.fr/(?P<name>.*?)(\?|$)'
201 u'url': u'http://culturebox.francetvinfo.fr/einstein-on-the-beach-au-theatre-du-chatelet-146813',
205 u'title': u'Einstein on the beach au Théâtre du Châtelet',
206 u'description': u'md5:9ce2888b1efefc617b5e58b3f6200eeb',
210 u'skip_download': True,
214 def _real_extract(self, url):
215 mobj = re.match(self._VALID_URL, url)
216 name = mobj.group('name')
217 webpage = self._download_webpage(url, name)
218 video_id = self._search_regex(r'"http://videos\.francetv\.fr/video/(.*?)"', webpage, u'video id')
219 return self._extract_video(video_id)