mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 09:07:58 +01:00
parent
eeb2a770f3
commit
f4ad919298
1 changed files with 23 additions and 19 deletions
|
@ -6,6 +6,7 @@
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
|
str_or_none,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
)
|
)
|
||||||
|
@ -24,6 +25,7 @@ class VeoIE(InfoExtractor):
|
||||||
'upload_date': '20201028',
|
'upload_date': '20201028',
|
||||||
'timestamp': 1603847208,
|
'timestamp': 1603847208,
|
||||||
'duration': 1916,
|
'duration': 1916,
|
||||||
|
'view_count': int,
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://app.veo.co/matches/20220313-2022-03-13_u15m-plsjq-vs-csl/',
|
'url': 'https://app.veo.co/matches/20220313-2022-03-13_u15m-plsjq-vs-csl/',
|
||||||
|
@ -39,39 +41,41 @@ def _real_extract(self, url):
|
||||||
video_data = self._download_json(
|
video_data = self._download_json(
|
||||||
'https://app.veo.co/api/app/matches/%s/videos' % video_id, video_id, 'Downloading video data')
|
'https://app.veo.co/api/app/matches/%s/videos' % video_id, video_id, 'Downloading video data')
|
||||||
|
|
||||||
title = metadata.get('title')
|
|
||||||
thumbnail = url_or_none(metadata.get('thumbnail'))
|
|
||||||
|
|
||||||
timestamp = unified_timestamp(metadata.get('created'))
|
|
||||||
duration = int_or_none(metadata.get('duration'))
|
|
||||||
view_count = int_or_none(metadata.get('view_count'))
|
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for fmt in video_data:
|
for fmt in video_data:
|
||||||
mimetype = fmt.get('mime_type')
|
mimetype = str_or_none(fmt.get('mime_type'))
|
||||||
|
format_url = url_or_none(fmt.get('url'))
|
||||||
# skip configuration file for panoramic video
|
# skip configuration file for panoramic video
|
||||||
if mimetype == 'video/mp2t':
|
if not format_url or mimetype == 'video/mp2t':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
height = int_or_none(fmt.get('height'))
|
height = int_or_none(fmt.get('height'))
|
||||||
bitrate = int_or_none(fmt.get('bit_rate'), scale=1000)
|
render_type = str_or_none(fmt.get('render_type'))
|
||||||
render_type = fmt.get('render_type')
|
format_id = f'{render_type}-{height}p' if render_type and height else None
|
||||||
|
|
||||||
|
# Veo returns panoramic video information even if panoramic video is not available.
|
||||||
|
# e.g. https://app.veo.co/matches/20201027-last-period/
|
||||||
|
if render_type == 'panorama':
|
||||||
|
if not self._is_valid_url(format_url, video_id, format_id):
|
||||||
|
continue
|
||||||
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': url_or_none(fmt.get('url')),
|
'url': format_url,
|
||||||
'format_id': '%s-%sp' % (render_type, height),
|
'format_id': format_id,
|
||||||
'ext': mimetype2ext(mimetype),
|
'ext': mimetype2ext(mimetype),
|
||||||
'width': int_or_none(fmt.get('width')),
|
'width': int_or_none(fmt.get('width')),
|
||||||
'height': height,
|
'height': height,
|
||||||
'vbr': bitrate
|
'vbr': int_or_none(fmt.get('bit_rate'), scale=1000),
|
||||||
})
|
})
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': str_or_none(metadata.get('title')),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': url_or_none(metadata.get('thumbnail')),
|
||||||
'timestamp': timestamp,
|
'timestamp': unified_timestamp(metadata.get('created')),
|
||||||
'view_count': view_count,
|
'view_count': int_or_none(metadata.get('view_count')),
|
||||||
'duration': duration
|
'duration': int_or_none(metadata.get('duration')),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue