Skip to content

Commit

Permalink
Update clients in YouTubeVideoUrl, thx seproDev
Browse files Browse the repository at this point in the history
From: yt-dlp/yt-dlp@637d62a

Also remove authorization in android and ios clients.
Use authorization only for age gate content.
This fix extraction for age gate content.
  • Loading branch information
Taapat committed Nov 24, 2024
1 parent c13ce06 commit f18b8cd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/YouTubeVideoUrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ def _extract_player_response(self, video_id, yt_auth, client):
if yt_auth:
headers['Authorization'] = yt_auth
if client == 5:
VERSION = '19.29.1'
USER_AGENT = 'com.google.ios.youtube/%s (iPhone16,2; U; CPU iOS 17_5_1 like Mac OS X;)' % VERSION
VERSION = '19.45.4'
USER_AGENT = 'com.google.ios.youtube/%s (iPhone16,2; U; CPU iOS 18_1_0 like Mac OS X;)' % VERSION
data['context'] = {
'client': {
'hl': config.plugins.YouTube.searchLanguage.value,
Expand All @@ -345,7 +345,7 @@ def _extract_player_response(self, video_id, yt_auth, client):
'deviceMake': 'Apple',
'deviceModel': 'iPhone16,2',
'osName': 'iPhone',
'osVersion': '17.5.1.21F90',
'osVersion': '18.1.0.22B83',
'userAgent': USER_AGENT
}
}
Expand Down Expand Up @@ -374,7 +374,7 @@ def _extract_player_response(self, video_id, yt_auth, client):
}
headers['X-YouTube-Client-Version'] = '2.0'
else:
VERSION = '19.29.37'
VERSION = '19.44.38'
USER_AGENT = 'com.google.android.youtube/%s (Linux; U; Android 11) gzip' % VERSION
data['context'] = {
'client': {
Expand Down Expand Up @@ -423,7 +423,7 @@ def _real_extract(self, video_id, yt_auth):
print('[YouTubeVideoUrl] skip DASH MP4 format')
self.use_dash_mp4 = DASHMP4_FORMAT

player_response, player_id = self._extract_player_response(video_id, yt_auth, 3)
player_response, player_id = self._extract_player_response(video_id, None, 3)
if not player_response:
raise RuntimeError('Player response not found!')

Expand All @@ -433,7 +433,7 @@ def _real_extract(self, video_id, yt_auth):
player_response, player_id = self._extract_web_response(video_id)
else:
print('[YouTubeVideoUrl] Got wrong player response, try ios client')
player_response, player_id = self._extract_player_response(video_id, yt_auth, 5)
player_response, player_id = self._extract_player_response(video_id, None, 5)

is_live = self.try_get(player_response, lambda x: x['videoDetails']['isLive'])
playability_status = player_response.get('playabilityStatus', {})
Expand Down

2 comments on commit f18b8cd

@fairbird
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need this commit to fix GoogleSuggestions
fairbird@5d8e45f

Before ...

Image

After

Image

@Taapat
Copy link
Owner Author

@Taapat Taapat commented on f18b8cd Nov 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice any problems with google suggestions.
This is not a correct fix.
It shows suggestions from the internet browser not from youtube.

However, I have noticed problems with other Google services, such as the YouTube API.
I assume there is a global problem and it will take some time for Google to resolve it.

Please sign in to comment.