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