Skip to content

Commit 17a4616

Browse files
committed
fix: resolve 500 errors on youtube mix playlists for android
This commit downgrades the Android client version from 21.02.35 to 20.01.35 and adds necessary headers (X-Goog-Visitor-Id, X-YouTube-Client-Name, and X-YouTube-Client-Version) to the resolve and search methods. Testing confirmed that version 21.02.35 (and 20.51.39) returns a 500 Internal Server Error when fetching Mix playlists via the /next endpoint. Downgrading to 20.01.35 restores functionality while remaining as current as possible.
1 parent 5bf13e1 commit 17a4616

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

src/sources/youtube/clients/Android.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export default class Android extends BaseClient {
1515
return {
1616
client: {
1717
clientName: 'ANDROID',
18-
clientVersion: '21.02.35',
18+
clientVersion: '20.01.35',
1919
userAgent:
20-
'com.google.android.youtube/21.02.35 (Linux; U; Android 14) identity',
20+
'com.google.android.youtube/20.01.35 (Linux; U; Android 14) identity',
2121
deviceMake: 'Google',
2222
deviceModel: 'Pixel 6',
2323
osName: 'Android',
@@ -60,7 +60,11 @@ export default class Android extends BaseClient {
6060
method: 'POST',
6161
headers: {
6262
'User-Agent': this.getClient(context).client.userAgent,
63-
'X-Goog-Api-Format-Version': '2'
63+
'X-Goog-Api-Format-Version': '2',
64+
'X-Goog-Visitor-Id': context.client.visitorData,
65+
'X-YouTube-Client-Name': '3',
66+
'X-YouTube-Client-Version':
67+
this.getClient(context).client.clientVersion
6468
},
6569
body: requestBody,
6670
disableBodyCompression: true
@@ -269,7 +273,13 @@ export default class Android extends BaseClient {
269273
const { body: playlistResponse, statusCode } = await makeRequest(
270274
`${apiEndpoint}/youtubei/v1/next`,
271275
{
272-
headers: { 'User-Agent': this.getClient(context).client.userAgent },
276+
headers: {
277+
'User-Agent': this.getClient(context).client.userAgent,
278+
'X-Goog-Visitor-Id': context.client.visitorData,
279+
'X-YouTube-Client-Name': '3',
280+
'X-YouTube-Client-Version':
281+
this.getClient(context).client.clientVersion
282+
},
273283
body: requestBody,
274284
method: 'POST',
275285
disableBodyCompression: true

0 commit comments

Comments
 (0)