[tenplay] Fix formats and modernize (Closes #5806)
This commit is contained in:
parent
4b4e1af059
commit
d41ebe146b
@ -2,6 +2,10 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
|
float_or_none,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TenPlayIE(InfoExtractor):
|
class TenPlayIE(InfoExtractor):
|
||||||
@ -49,18 +53,23 @@ class TenPlayIE(InfoExtractor):
|
|||||||
if protocol == 'rtmp':
|
if protocol == 'rtmp':
|
||||||
url = url.replace('&mp4:', '')
|
url = url.replace('&mp4:', '')
|
||||||
|
|
||||||
|
tbr = int_or_none(rendition.get('encodingRate'), 1000)
|
||||||
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': '_'.join(['rtmp', rendition['videoContainer'].lower(), rendition['videoCodec'].lower()]),
|
'format_id': '_'.join(
|
||||||
'width': rendition['frameWidth'],
|
['rtmp', rendition['videoContainer'].lower(),
|
||||||
'height': rendition['frameHeight'],
|
rendition['videoCodec'].lower(), '%sk' % tbr]),
|
||||||
'tbr': rendition['encodingRate'] / 1024,
|
'width': int_or_none(rendition['frameWidth']),
|
||||||
'filesize': rendition['size'],
|
'height': int_or_none(rendition['frameHeight']),
|
||||||
|
'tbr': tbr,
|
||||||
|
'filesize': int_or_none(rendition['size']),
|
||||||
'protocol': protocol,
|
'protocol': protocol,
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
'vcodec': rendition['videoCodec'].lower(),
|
'vcodec': rendition['videoCodec'].lower(),
|
||||||
'container': rendition['videoContainer'].lower(),
|
'container': rendition['videoContainer'].lower(),
|
||||||
'url': url,
|
'url': url,
|
||||||
})
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
@ -74,8 +83,8 @@ class TenPlayIE(InfoExtractor):
|
|||||||
'url': json['thumbnailURL']
|
'url': json['thumbnailURL']
|
||||||
}],
|
}],
|
||||||
'thumbnail': json['videoStillURL'],
|
'thumbnail': json['videoStillURL'],
|
||||||
'duration': json['length'] / 1000,
|
'duration': float_or_none(json.get('length'), 1000),
|
||||||
'timestamp': float(json['creationDate']) / 1000,
|
'timestamp': float_or_none(json.get('creationDate'), 1000),
|
||||||
'uploader': json['customFields']['production_company_distributor'] if 'production_company_distributor' in json['customFields'] else 'TENplay',
|
'uploader': json.get('customFields', {}).get('production_company_distributor') or 'TENplay',
|
||||||
'view_count': json['playsTotal']
|
'view_count': int_or_none(json.get('playsTotal')),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user