From afbadf23014b2955ce70b043930d795c68127b7e Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Sun, 18 Aug 2024 03:36:58 +0200 Subject: [PATCH] [youtube] update self.ua (fix extraction) --- src/you_get/extractors/youtube.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/you_get/extractors/youtube.py b/src/you_get/extractors/youtube.py index ea365a5a..0a93d396 100644 --- a/src/you_get/extractors/youtube.py +++ b/src/you_get/extractors/youtube.py @@ -186,7 +186,7 @@ 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' + self.ua = 'Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.103 Mobile Safari/537.36' assert self.url or self.vid @@ -202,7 +202,7 @@ class YouTube(VideoExtractor): # Extract from video page logging.debug('Extracting from the video page...') - video_page = get_content('https://www.youtube.com/watch?v=%s' % self.vid) + video_page = get_content('https://www.youtube.com/watch?v=%s' % self.vid, headers={'User-Agent': self.ua}) try: jsUrl = re.search('([^"]*/base\.js)"', video_page).group(1)