[youtube] add self.ua

This commit is contained in:
Mort Yao 2024-08-04 19:06:56 +02:00
parent bc0e680ed5
commit 4cec20ac20
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -177,7 +177,7 @@ class YouTube(VideoExtractor):
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 @@ class YouTube(VideoExtractor):
)
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: