[bambuser] Modernize and extract more metadata

This commit is contained in:
Sergey M․ 2015-04-20 22:46:01 +06:00
parent ae8953409e
commit edf4216119

View File

@ -4,8 +4,15 @@
import itertools import itertools
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urllib_request from ..compat import (
from ..utils import ExtractorError compat_urllib_request,
compat_str,
)
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
)
class BambuserIE(InfoExtractor): class BambuserIE(InfoExtractor):
@ -24,6 +31,9 @@ class BambuserIE(InfoExtractor):
'duration': 3741, 'duration': 3741,
'uploader': 'pixelversity', 'uploader': 'pixelversity',
'uploader_id': '344706', 'uploader_id': '344706',
'timestamp': 1382976692,
'upload_date': '20131028',
'view_count': int,
}, },
'params': { 'params': {
# It doesn't respect the 'Range' header, it would download the whole video # It doesn't respect the 'Range' header, it would download the whole video
@ -51,10 +61,13 @@ def _real_extract(self, url):
'title': result['title'], 'title': result['title'],
'url': result['url'], 'url': result['url'],
'thumbnail': result.get('preview'), 'thumbnail': result.get('preview'),
'duration': int(result['length']), 'duration': int_or_none(result.get('length')),
'view_count': int(result['views_total']), 'uploader': result.get('username'),
'uploader': result['username'], 'uploader_id': compat_str(result.get('owner', {}).get('uid')),
'uploader_id': result['owner']['uid'], 'timestamp': int_or_none(result.get('created')),
'fps': float_or_none(result.get('framerate')),
'view_count': int_or_none(result.get('views_total')),
'comment_count': int_or_none(result.get('comment_count')),
} }