- for t, rs in config['formats'].items():
- if not rs or not hasattr(rs, 'items'):
- self._warn('formats: {0}: no resolutions', t)
- continue
-
- for res, obj in rs.items():
- format_id = '{0}_{1}'.format(t, res)
-
- if (not obj or not obj.get('url') or
- not isinstance(obj['url'], str)):
- self._warn('formats: {0}: no url', format_id)
- continue
-
- fmt = {
- 'url': obj['url'],
- 'format_id': format_id
- }
- try:
- fmt['height'] = int(res)
- except ValueError as e:
- self._warn('formats: {0}: height: {1}', t, e)
-
- formats.append(fmt)
-
+ for source_node in doc.findall('.//{http://rss.jwpcdn.com/}source'):
+ label = source_node.attrib['label']
+ height = int_or_none(self._search_regex(
+ r'^(.*?_)?([0-9]+)p$', label, 'height', default=None))
+ video_url = source_node.attrib['file']
+ ext = determine_ext(video_url, '')
+ formats.append({
+ 'url': video_url,
+ 'format_note': label,
+ 'format_id': '%s_%s' % (ext, label),
+ 'height': height,
+ })