- for t, rs in config['formats'].items():
- if not rs or not hasattr(rs, 'items'):
- self._downloader.report_warning(
- 'formats: {0}: no resolutions'.format(t))
- continue
-
- for height_str, obj in rs.items():
- format_id = '{0}_{1}'.format(t, height_str)
-
- if not obj or not obj.get('url'):
- self._downloader.report_warning(
- 'formats: {0}: no url'.format(format_id))
- continue
-
- formats.append({
- 'url': obj['url'],
- 'format_id': format_id,
- 'height': self._int(height_str, 'height'),
- })
-
+ 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))
+ formats.append({
+ 'url': source_node.attrib['file'],
+ 'format_note': label,
+ 'height': height,
+ })