1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-23 00:54:31 +01:00

[aftonbladet] Modernize

This commit is contained in:
Sergey M․ 2015-04-04 22:19:34 +06:00
parent 1a68d39211
commit 8e1f937473

View File

@ -2,6 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import int_or_none
class AftonbladetIE(InfoExtractor): class AftonbladetIE(InfoExtractor):
@ -43,9 +44,9 @@ class AftonbladetIE(InfoExtractor):
formats.append({ formats.append({
'url': 'http://%s:%d/%s/%s' % (p['address'], p['port'], p['path'], p['filename']), 'url': 'http://%s:%d/%s/%s' % (p['address'], p['port'], p['path'], p['filename']),
'ext': 'mp4', 'ext': 'mp4',
'width': fmt['width'], 'width': int_or_none(fmt.get('width')),
'height': fmt['height'], 'height': int_or_none(fmt.get('height')),
'tbr': fmt['bitrate'], 'tbr': int_or_none(fmt.get('bitrate')),
'protocol': 'http', 'protocol': 'http',
}) })
self._sort_formats(formats) self._sort_formats(formats)
@ -54,9 +55,9 @@ class AftonbladetIE(InfoExtractor):
'id': video_id, 'id': video_id,
'title': internal_meta_json['title'], 'title': internal_meta_json['title'],
'formats': formats, 'formats': formats,
'thumbnail': internal_meta_json['imageUrl'], 'thumbnail': internal_meta_json.get('imageUrl'),
'description': internal_meta_json['shortPreamble'], 'description': internal_meta_json.get('shortPreamble'),
'timestamp': internal_meta_json['timePublished'], 'timestamp': int_or_none(internal_meta_json.get('timePublished')),
'duration': internal_meta_json['duration'], 'duration': int_or_none(internal_meta_json.get('duration')),
'view_count': internal_meta_json['views'], 'view_count': int_or_none(internal_meta_json.get('views')),
} }