mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 13:35:16 +03:00
[youtube] update self.ua (fix extraction)
This commit is contained in:
parent
4cec20ac20
commit
afbadf2301
@ -186,7 +186,7 @@ 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'
|
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
|
assert self.url or self.vid
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ class YouTube(VideoExtractor):
|
|||||||
|
|
||||||
# Extract from video page
|
# Extract from video page
|
||||||
logging.debug('Extracting from the 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:
|
try:
|
||||||
jsUrl = re.search('([^"]*/base\.js)"', video_page).group(1)
|
jsUrl = re.search('([^"]*/base\.js)"', video_page).group(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user