]>
Commit | Line | Data |
---|---|---|
25b51c78 PR |
1 | from .common import InfoExtractor |
2 | ||
faa6ef6b | 3 | |
25b51c78 | 4 | class JeuxVideoIE(InfoExtractor): |
df773c3d | 5 | _WORKING = False |
6 | _ENABLED = None # XXX: pass through to GenericIE | |
5886b38d | 7 | _VALID_URL = r'https?://.*?\.jeuxvideo\.com/.*/(.*?)\.htm' |
25b51c78 | 8 | |
01d115b0 | 9 | _TESTS = [{ |
98dbee86 PH |
10 | 'url': 'http://www.jeuxvideo.com/reportages-videos-jeux/0004/00046170/tearaway-playstation-vita-gc-2013-tearaway-nous-presente-ses-papiers-d-identite-00115182.htm', |
11 | 'md5': '046e491afb32a8aaac1f44dd4ddd54ee', | |
12 | 'info_dict': { | |
054b99a3 | 13 | 'id': '114765', |
98dbee86 | 14 | 'ext': 'mp4', |
054b99a3 JMF |
15 | 'title': 'Tearaway : GC 2013 : Tearaway nous présente ses papiers d\'identité', |
16 | 'description': 'Lorsque les développeurs de LittleBigPlanet proposent un nouveau titre, on ne peut que s\'attendre à un résultat original et fort attrayant.', | |
063fcc96 | 17 | }, |
01d115b0 JMF |
18 | }, { |
19 | 'url': 'http://www.jeuxvideo.com/videos/chroniques/434220/l-histoire-du-jeu-video-la-saturn.htm', | |
20 | 'only_matching': True, | |
21 | }] | |
063fcc96 | 22 | |
25b51c78 | 23 | def _real_extract(self, url): |
5ad28e7f | 24 | mobj = self._match_valid_url(url) |
f3682997 | 25 | title = mobj.group(1) |
25b51c78 | 26 | webpage = self._download_webpage(url, title) |
6744f36d | 27 | title = self._html_search_meta('name', webpage) or self._og_search_title(webpage) |
054b99a3 | 28 | config_url = self._html_search_regex( |
197224b7 | 29 | r'data-src(?:set-video)?="(/contenu/medias/video\.php.*?)"', |
98dbee86 | 30 | webpage, 'config URL') |
054b99a3 | 31 | config_url = 'http://www.jeuxvideo.com' + config_url |
5f6a1245 | 32 | |
faa6ef6b | 33 | video_id = self._search_regex( |
054b99a3 JMF |
34 | r'id=(\d+)', |
35 | config_url, 'video ID') | |
25b51c78 | 36 | |
054b99a3 JMF |
37 | config = self._download_json( |
38 | config_url, title, 'Downloading JSON config') | |
5f6a1245 | 39 | |
054b99a3 JMF |
40 | formats = [{ |
41 | 'url': source['file'], | |
42 | 'format_id': source['label'], | |
43 | 'resolution': source['label'], | |
44 | } for source in reversed(config['sources'])] | |
25b51c78 | 45 | |
faa6ef6b PH |
46 | return { |
47 | 'id': video_id, | |
054b99a3 JMF |
48 | 'title': title, |
49 | 'formats': formats, | |
faa6ef6b | 50 | 'description': self._og_search_description(webpage), |
054b99a3 | 51 | 'thumbnail': config.get('image'), |
faa6ef6b | 52 | } |