Skip to content

Commit

Permalink
[youtube] update self.ua (fix extraction)
Browse files Browse the repository at this point in the history
  • Loading branch information
soimort committed Aug 18, 2024
1 parent 4cec20a commit afbadf2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/you_get/extractors/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ 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'
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

Expand All @@ -202,7 +202,7 @@ def prepare(self, **kwargs):

# 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)
Expand Down

0 comments on commit afbadf2

Please sign in to comment.