mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 19:17:53 +01:00
[jeuxvideo] Fix extraction (fixes #5190)
This commit is contained in:
parent
3946864c8a
commit
054b99a330
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@ -15,10 +14,10 @@ class JeuxVideoIE(InfoExtractor):
|
|||||||
'url': 'http://www.jeuxvideo.com/reportages-videos-jeux/0004/00046170/tearaway-playstation-vita-gc-2013-tearaway-nous-presente-ses-papiers-d-identite-00115182.htm',
|
'url': 'http://www.jeuxvideo.com/reportages-videos-jeux/0004/00046170/tearaway-playstation-vita-gc-2013-tearaway-nous-presente-ses-papiers-d-identite-00115182.htm',
|
||||||
'md5': '046e491afb32a8aaac1f44dd4ddd54ee',
|
'md5': '046e491afb32a8aaac1f44dd4ddd54ee',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '5182',
|
'id': '114765',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'GC 2013 : Tearaway nous présente ses papiers d\'identité',
|
'title': 'Tearaway : GC 2013 : Tearaway nous présente ses papiers d\'identité',
|
||||||
'description': 'Lorsque les développeurs de LittleBigPlanet proposent un nouveau titre, on ne peut que s\'attendre à un résultat original et fort attrayant.\n',
|
'description': 'Lorsque les développeurs de LittleBigPlanet proposent un nouveau titre, on ne peut que s\'attendre à un résultat original et fort attrayant.',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,26 +25,29 @@ def _real_extract(self, url):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
title = mobj.group(1)
|
title = mobj.group(1)
|
||||||
webpage = self._download_webpage(url, title)
|
webpage = self._download_webpage(url, title)
|
||||||
xml_link = self._html_search_regex(
|
title = self._html_search_meta('name', webpage)
|
||||||
r'<param name="flashvars" value="config=(.*?)" />',
|
config_url = self._html_search_regex(
|
||||||
|
r'data-src="(/contenu/medias/video.php.*?)"',
|
||||||
webpage, 'config URL')
|
webpage, 'config URL')
|
||||||
|
config_url = 'http://www.jeuxvideo.com' + config_url
|
||||||
|
|
||||||
video_id = self._search_regex(
|
video_id = self._search_regex(
|
||||||
r'http://www\.jeuxvideo\.com/config/\w+/\d+/(.*?)/\d+_player\.xml',
|
r'id=(\d+)',
|
||||||
xml_link, 'video ID')
|
config_url, 'video ID')
|
||||||
|
|
||||||
config = self._download_xml(
|
config = self._download_json(
|
||||||
xml_link, title, 'Downloading XML config')
|
config_url, title, 'Downloading JSON config')
|
||||||
info_json = config.find('format.json').text
|
|
||||||
info = json.loads(info_json)['versions'][0]
|
|
||||||
|
|
||||||
video_url = 'http://video720.jeuxvideo.com/' + info['file']
|
formats = [{
|
||||||
|
'url': source['file'],
|
||||||
|
'format_id': source['label'],
|
||||||
|
'resolution': source['label'],
|
||||||
|
} for source in reversed(config['sources'])]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': config.find('titre_video').text,
|
'title': title,
|
||||||
'ext': 'mp4',
|
'formats': formats,
|
||||||
'url': video_url,
|
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
'thumbnail': config.find('image').text,
|
'thumbnail': config.get('image'),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user