1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-23 16:26:40 +00:00

[gameone] Extract duration as float

This commit is contained in:
Sergey M․ 2014-12-24 19:18:59 +06:00
parent ed7bdc8a90
commit 39ac7c9435

View file

@ -6,7 +6,9 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
xpath_with_ns, xpath_with_ns,
parse_iso8601 parse_iso8601,
float_or_none,
int_or_none,
) )
NAMESPACE_MAP = { NAMESPACE_MAP = {
@ -47,7 +49,7 @@ class GameOneIE(InfoExtractor):
'description': 'Jet Set Radio HD, Tekken Tag Tournament 2, Source Filmmaker', 'description': 'Jet Set Radio HD, Tekken Tag Tournament 2, Source Filmmaker',
'timestamp': 1347971451, 'timestamp': 1347971451,
'title': 'Game One - Folge 220', 'title': 'Game One - Folge 220',
'duration': 896, 'duration': 896.62,
'age_limit': 16, 'age_limit': 16,
} }
} }
@ -83,13 +85,13 @@ class GameOneIE(InfoExtractor):
video_id, video_id,
'Downloading media:content') 'Downloading media:content')
rendition_items = content.findall('.//rendition') rendition_items = content.findall('.//rendition')
duration = int(rendition_items[0].get('duration').split('.')[0]) duration = float_or_none(rendition_items[0].get('duration'))
formats = [ formats = [
{ {
'url': re.sub(r'.*/(r2)', RAW_MP4_URL + r'\1', r.find('./src').text), 'url': re.sub(r'.*/(r2)', RAW_MP4_URL + r'\1', r.find('./src').text),
'width': int(r.get('width')), 'width': int_or_none(r.get('width')),
'height': int(r.get('height')), 'height': int_or_none(r.get('height')),
'tbr': int(r.get('bitrate')), 'tbr': int_or_none(r.get('bitrate')),
} }
for r in rendition_items for r in rendition_items
] ]