0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-29 03:23:02 +00:00

[Bilibili] Pass referer for all formats (#2834)

Authored by: blackgear
This commit is contained in:
Daniel.Zeng 2022-02-20 19:27:02 +08:00 committed by GitHub
parent a7d4acc018
commit be8d623455
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -225,10 +225,6 @@ def _real_extract(self, url):
'quality': -2 if 'hd.mp4' in backup_url else -3, 'quality': -2 if 'hd.mp4' in backup_url else -3,
}) })
for a_format in formats:
a_format.setdefault('http_headers', {}).update({
'Referer': url,
})
for audio in audios: for audio in audios:
formats.append({ formats.append({
'url': audio.get('baseUrl') or audio.get('base_url') or audio.get('url'), 'url': audio.get('baseUrl') or audio.get('base_url') or audio.get('url'),
@ -252,6 +248,9 @@ def _real_extract(self, url):
'id': video_id, 'id': video_id,
'duration': float_or_none(durl.get('length'), 1000), 'duration': float_or_none(durl.get('length'), 1000),
'formats': formats, 'formats': formats,
'http_headers': {
'Referer': url,
},
}) })
break break