]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/veo.py
1 from .common
import InfoExtractor
12 class VeoIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://app\.veo\.co/matches/(?P<id>[0-9A-Za-z-_]+)'
16 'url': 'https://app.veo.co/matches/20201027-last-period/',
18 'id': '20201027-last-period',
20 'title': 'Akidemy u11s v Bradford Boys u11s (Game 3)',
21 'thumbnail': 're:https://c.veocdn.com/.+/thumbnail.jpg',
22 'upload_date': '20201028',
23 'timestamp': 1603847208,
28 'url': 'https://app.veo.co/matches/20220313-2022-03-13_u15m-plsjq-vs-csl/',
29 'only_matching': True,
32 def _real_extract(self
, url
):
33 video_id
= self
._match
_id
(url
)
35 metadata
= self
._download
_json
(
36 'https://app.veo.co/api/app/matches/%s' % video_id
, video_id
)
38 video_data
= self
._download
_json
(
39 'https://app.veo.co/api/app/matches/%s/videos' % video_id
, video_id
, 'Downloading video data')
42 for fmt
in video_data
:
43 mimetype
= str_or_none(fmt
.get('mime_type'))
44 format_url
= url_or_none(fmt
.get('url'))
45 # skip configuration file for panoramic video
46 if not format_url
or mimetype
== 'video/mp2t':
49 height
= int_or_none(fmt
.get('height'))
50 render_type
= str_or_none(fmt
.get('render_type'))
51 format_id
= f
'{render_type}-{height}p' if render_type
and height
else None
53 # Veo returns panoramic video information even if panoramic video is not available.
54 # e.g. https://app.veo.co/matches/20201027-last-period/
55 if render_type
== 'panorama':
56 if not self
._is
_valid
_url
(format_url
, video_id
, format_id
):
61 'format_id': format_id
,
62 'ext': mimetype2ext(mimetype
),
63 'width': int_or_none(fmt
.get('width')),
65 'vbr': int_or_none(fmt
.get('bit_rate'), scale
=1000),
68 self
._sort
_formats
(formats
)
72 'title': str_or_none(metadata
.get('title')),
74 'thumbnail': url_or_none(metadata
.get('thumbnail')),
75 'timestamp': unified_timestamp(metadata
.get('created')),
76 'view_count': int_or_none(metadata
.get('view_count')),
77 'duration': int_or_none(metadata
.get('duration')),