mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-14 16:38:29 +00:00
temp
This commit is contained in:
parent
ff3ad1f10f
commit
c2713b732d
@ -7,6 +7,8 @@
|
|||||||
float_or_none,
|
float_or_none,
|
||||||
parse_resolution,
|
parse_resolution,
|
||||||
qualities,
|
qualities,
|
||||||
|
unified_strdate,
|
||||||
|
update_url,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
urljoin,
|
urljoin,
|
||||||
)
|
)
|
||||||
@ -23,12 +25,12 @@ class AppleConnectIE(InfoExtractor):
|
|||||||
|
|
||||||
_BASE_URL = 'https://music.apple.com'
|
_BASE_URL = 'https://music.apple.com'
|
||||||
_QUALITIES = {
|
_QUALITIES = {
|
||||||
'provisionalUploadVideo': (None, None),
|
'provisionalUploadVideo': None,
|
||||||
'sdVideo': (640, 480),
|
'sdVideo': 480,
|
||||||
'sdVideoWithPlusAudio': (640, 480),
|
'sdVideoWithPlusAudio': 480,
|
||||||
'sd480pVideo': (720, 480),
|
'sd480pVideo': 480,
|
||||||
'720pHdVideo': (1280, 720),
|
'720pHdVideo': 720,
|
||||||
'1080pHdVideo': (1440, 1080),
|
'1080pHdVideo': 1080,
|
||||||
}
|
}
|
||||||
_VALID_URL = r'https?://music\.apple\.com/\w{0,2}/post/(?P<id>\d+)'
|
_VALID_URL = r'https?://music\.apple\.com/\w{0,2}/post/(?P<id>\d+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
@ -88,27 +90,28 @@ def _real_extract(self, url):
|
|||||||
for format_id, src_url in traverse_obj(attributes, (
|
for format_id, src_url in traverse_obj(attributes, (
|
||||||
'assetTokens', {dict.items}, lambda _, v: url_or_none(v[1]),
|
'assetTokens', {dict.items}, lambda _, v: url_or_none(v[1]),
|
||||||
)):
|
)):
|
||||||
formats.append({
|
height = self._QUALITIES.get(format_id)
|
||||||
|
fmt = {
|
||||||
'ext': 'm4v',
|
'ext': 'm4v',
|
||||||
'format_id': format_id,
|
'format_id': format_id,
|
||||||
|
'height': height,
|
||||||
'quality': quality(format_id),
|
'quality': quality(format_id),
|
||||||
'url': src_url,
|
'url': src_url,
|
||||||
**parse_resolution(src_url),
|
**parse_resolution(update_url(src_url, query=None), lenient=True),
|
||||||
**traverse_obj(self._QUALITIES, (format_id, {
|
}
|
||||||
'height': 1,
|
if not height:
|
||||||
'width': 0,
|
fmt['width'] = None
|
||||||
})),
|
formats.append(fmt)
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnail': self._html_search_meta(
|
'thumbnail': self._html_search_meta(
|
||||||
('og:image', 'og:image:secure_url', 'twitter:image'), webpage),
|
['og:image', 'og:image:secure_url', 'twitter:image'], webpage),
|
||||||
**traverse_obj(attributes, {
|
**traverse_obj(attributes, {
|
||||||
'title': ('name', {str}),
|
'title': ('name', {str}),
|
||||||
'duration': ('durationInMilliseconds', {float_or_none(scale=1000)}),
|
'duration': ('durationInMilliseconds', {float_or_none(scale=1000)}),
|
||||||
'upload_date': ('uploadDate', {str}, {lambda x: x.replace('-', '')}),
|
'upload_date': ('uploadDate', {unified_strdate}),
|
||||||
'uploader': (('artistName', 'uploadingArtistName'), {str}, any),
|
'uploader': (('artistName', 'uploadingArtistName'), {str}, any),
|
||||||
'webpage_url': ('postUrl', {url_or_none}),
|
'webpage_url': ('postUrl', {url_or_none}),
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user