mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 13:35:16 +03:00
[youtube] add self.ua
This commit is contained in:
parent
bc0e680ed5
commit
4cec20ac20
@ -177,7 +177,7 @@ class YouTube(VideoExtractor):
|
|||||||
|
|
||||||
def check_playability_response(self, ytInitialPlayerResponse):
|
def check_playability_response(self, ytInitialPlayerResponse):
|
||||||
STATUS_OK = "OK"
|
STATUS_OK = "OK"
|
||||||
|
|
||||||
playerResponseStatus = ytInitialPlayerResponse["playabilityStatus"]["status"]
|
playerResponseStatus = ytInitialPlayerResponse["playabilityStatus"]["status"]
|
||||||
if playerResponseStatus != STATUS_OK:
|
if playerResponseStatus != STATUS_OK:
|
||||||
reason = ytInitialPlayerResponse["playabilityStatus"].get("reason", "")
|
reason = ytInitialPlayerResponse["playabilityStatus"].get("reason", "")
|
||||||
@ -186,6 +186,8 @@ class YouTube(VideoExtractor):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def prepare(self, **kwargs):
|
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
|
assert self.url or self.vid
|
||||||
|
|
||||||
if not self.vid and self.url:
|
if not self.vid and self.url:
|
||||||
|
Loading…
Reference in New Issue
Block a user