From 4cec20ac208b7c1a0c6433d9d9bbfaa6b77e3148 Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Sun, 4 Aug 2024 19:06:56 +0200 Subject: [PATCH] [youtube] add self.ua --- src/you_get/extractors/youtube.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/you_get/extractors/youtube.py b/src/you_get/extractors/youtube.py index 2e31e6466a..ea365a5aaf 100644 --- a/src/you_get/extractors/youtube.py +++ b/src/you_get/extractors/youtube.py @@ -177,7 +177,7 @@ def download_playlist_by_url(self, url, **kwargs): def check_playability_response(self, ytInitialPlayerResponse): STATUS_OK = "OK" - + playerResponseStatus = ytInitialPlayerResponse["playabilityStatus"]["status"] if playerResponseStatus != STATUS_OK: reason = ytInitialPlayerResponse["playabilityStatus"].get("reason", "") @@ -186,6 +186,8 @@ def check_playability_response(self, ytInitialPlayerResponse): ) def prepare(self, **kwargs): + self.ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.2651.86' + assert self.url or self.vid if not self.vid and self.url: