]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/jeuxvideo.py
[ie/youtube] Suppress "Unavailable videos are hidden" warning (#10159)
[yt-dlp.git] / yt_dlp / extractor / jeuxvideo.py
1 from .common import InfoExtractor
2
3
4 class JeuxVideoIE(InfoExtractor):
5 _WORKING = False
6 _ENABLED = None # XXX: pass through to GenericIE
7 _VALID_URL = r'https?://.*?\.jeuxvideo\.com/.*/(.*?)\.htm'
8
9 _TESTS = [{
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': {
13 'id': '114765',
14 'ext': 'mp4',
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.',
17 },
18 }, {
19 'url': 'http://www.jeuxvideo.com/videos/chroniques/434220/l-histoire-du-jeu-video-la-saturn.htm',
20 'only_matching': True,
21 }]
22
23 def _real_extract(self, url):
24 mobj = self._match_valid_url(url)
25 title = mobj.group(1)
26 webpage = self._download_webpage(url, title)
27 title = self._html_search_meta('name', webpage) or self._og_search_title(webpage)
28 config_url = self._html_search_regex(
29 r'data-src(?:set-video)?="(/contenu/medias/video\.php.*?)"',
30 webpage, 'config URL')
31 config_url = 'http://www.jeuxvideo.com' + config_url
32
33 video_id = self._search_regex(
34 r'id=(\d+)',
35 config_url, 'video ID')
36
37 config = self._download_json(
38 config_url, title, 'Downloading JSON config')
39
40 formats = [{
41 'url': source['file'],
42 'format_id': source['label'],
43 'resolution': source['label'],
44 } for source in reversed(config['sources'])]
45
46 return {
47 'id': video_id,
48 'title': title,
49 'formats': formats,
50 'description': self._og_search_description(webpage),
51 'thumbnail': config.get('image'),
52 }