From be8d623455e28c69254230a73c0b87ba87ea1652 Mon Sep 17 00:00:00 2001 From: "Daniel.Zeng" Date: Sun, 20 Feb 2022 19:27:02 +0800 Subject: [PATCH] [Bilibili] Pass referer for all formats (#2834) Authored by: blackgear --- yt_dlp/extractor/bilibili.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.py index a775aa97fa..1bbf7ca1ca 100644 --- a/yt_dlp/extractor/bilibili.py +++ b/yt_dlp/extractor/bilibili.py @@ -225,10 +225,6 @@ def _real_extract(self, url): '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: formats.append({ '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, 'duration': float_or_none(durl.get('length'), 1000), 'formats': formats, + 'http_headers': { + 'Referer': url, + }, }) break