Merge branch 'develop' of https://github.com/URenko/you-get into URenko-develop

This commit is contained in:
Mort Yao 2023-02-09 21:56:39 +01:00
commit f4bd814c7f
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -42,6 +42,8 @@ class Bilibili(VideoExtractor):
{'id': 'jpg', 'quality': 0}, {'id': 'jpg', 'quality': 0},
] ]
codecids = {7: 'AVC', 12: 'HEVC', 13: 'AV1'}
@staticmethod @staticmethod
def height_to_quality(height, qn): def height_to_quality(height, qn):
if height <= 360 and qn <= 16: if height <= 360 and qn <= 16:
@ -70,7 +72,7 @@ class Bilibili(VideoExtractor):
@staticmethod @staticmethod
def bilibili_api(avid, cid, qn=0): def bilibili_api(avid, cid, qn=0):
return 'https://api.bilibili.com/x/player/playurl?avid=%s&cid=%s&qn=%s&type=&otype=json&fnver=0&fnval=16&fourk=1' % (avid, cid, qn) return 'https://api.bilibili.com/x/player/playurl?avid=%s&cid=%s&qn=%s&type=&otype=json&fnver=0&fnval=4048&fourk=1' % (avid, cid, qn)
@staticmethod @staticmethod
def bilibili_audio_api(sid): def bilibili_audio_api(sid):
@ -302,11 +304,10 @@ class Bilibili(VideoExtractor):
if 'dash' in playinfo['data']: if 'dash' in playinfo['data']:
audio_size_cache = {} audio_size_cache = {}
for video in playinfo['data']['dash']['video']: for video in playinfo['data']['dash']['video']:
# prefer the latter codecs!
s = self.stream_qualities[video['id']] s = self.stream_qualities[video['id']]
format_id = 'dash-' + s['id'] # prefix format_id = f"dash-{s['id']}-{self.codecids[video['codecid']]}" # prefix
container = 'mp4' # enforce MP4 container container = 'mp4' # enforce MP4 container
desc = s['desc'] desc = s['desc'] + ' ' + video['codecs']
audio_quality = s['audio_quality'] audio_quality = s['audio_quality']
baseurl = video['baseUrl'] baseurl = video['baseUrl']
size = self.url_size(baseurl, headers=self.bilibili_headers(referer=self.url)) size = self.url_size(baseurl, headers=self.bilibili_headers(referer=self.url))