Skip to content

Commit

Permalink
[extractor/youtube] Add androidSdkVersion parameter to Android Inne…
Browse files Browse the repository at this point in the history
…rtube clients

Required to prevent YouTube returning a bad player response in some cases.

See: #4593, TeamNewPipe/NewPipe#8713, iv-org/invidious#3230, Tyrrrz/YoutubeExplode#647

Authored by: coletdjnz
  • Loading branch information
coletdjnz committed Aug 8, 2022
1 parent 298d9c0 commit c7dcf0b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions yt_dlp/extractor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
'INNERTUBE_CONTEXT': {
'client': {
'clientName': 'ANDROID',
'clientVersion': '17.28.34',
'clientVersion': '17.29.34',
'androidSdkVersion': 30
}
},
'INNERTUBE_CONTEXT_CLIENT_NAME': 3,
Expand All @@ -120,7 +121,8 @@
'INNERTUBE_CONTEXT': {
'client': {
'clientName': 'ANDROID_EMBEDDED_PLAYER',
'clientVersion': '17.28.34',
'clientVersion': '17.29.34',
'androidSdkVersion': 30
},
},
'INNERTUBE_CONTEXT_CLIENT_NAME': 55,
Expand All @@ -132,6 +134,7 @@
'client': {
'clientName': 'ANDROID_MUSIC',
'clientVersion': '5.16.51',
'androidSdkVersion': 30
}
},
'INNERTUBE_CONTEXT_CLIENT_NAME': 21,
Expand All @@ -143,6 +146,7 @@
'client': {
'clientName': 'ANDROID_CREATOR',
'clientVersion': '22.28.100',
'androidSdkVersion': 30
},
},
'INNERTUBE_CONTEXT_CLIENT_NAME': 14,
Expand Down Expand Up @@ -3142,7 +3146,7 @@ def append_client(*client_names):
pr_video_id = traverse_obj(pr, ('videoDetails', 'videoId'))
if pr_video_id and pr_video_id != video_id:
self.report_warning(
f'{client} client returned a player response for "{pr_video_id}" instead of "{video_id}"' + bug_reports_message())
f'Skipping player response from {client} client (got player response for video "{pr_video_id}" instead of "{video_id}")' + bug_reports_message())
else:
prs.append(pr)

Expand Down

0 comments on commit c7dcf0b

Please sign in to comment.