- r'http://www\.jeuxvideo\.com/config/\w+/\d+/(.*?)/\d+_player\.xml',
- xml_link, u'video ID')
-
- xml_config = self._download_webpage(
- xml_link, title, u'Downloading XML config')
- config = xml.etree.ElementTree.fromstring(xml_config.encode('utf-8'))
- info_json = self._search_regex(
- r'(?sm)<format\.json>(.*?)</format\.json>',
- xml_config, u'JSON information')
- info = json.loads(info_json)['versions'][0]
-
- video_url = 'http://video720.jeuxvideo.com/' + info['file']
+ r'id=(\d+)',
+ config_url, 'video ID')
+
+ config = self._download_json(
+ config_url, title, 'Downloading JSON config')
+
+ formats = [{
+ 'url': source['file'],
+ 'format_id': source['label'],
+ 'resolution': source['label'],
+ } for source in reversed(config['sources'])]