mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-27 16:48:55 +00:00
fix(PlayerEndpoint): Workaround for "The following content is not available on this app" (Android) (#624)
* chore: Update Android client version and UA * refactor: Update shorts parameter protobuf * chore: Update auto generated files * chore: Add test * chore: Update comments test id (unrelated) * chore: Update comments test again (unrelated)
This commit is contained in:
@@ -95,6 +95,7 @@ export default class HTTPClient {
|
||||
if (Platform.shim.server) {
|
||||
if (n_body.context.client.clientName === 'ANDROID' || n_body.context.client.clientName === 'ANDROID_MUSIC') {
|
||||
request_headers.set('User-Agent', Constants.CLIENTS.ANDROID.USER_AGENT);
|
||||
request_headers.set('X-GOOG-API-FORMAT-VERSION', '2');
|
||||
} else if (n_body.context.client.clientName === 'iOS') {
|
||||
request_headers.set('User-Agent', Constants.CLIENTS.iOS.USER_AGENT);
|
||||
}
|
||||
@@ -102,6 +103,14 @@ export default class HTTPClient {
|
||||
|
||||
is_web_kids = n_body.context.client.clientName === 'WEB_KIDS';
|
||||
request_body = JSON.stringify(n_body);
|
||||
} else if (content_type === 'application/x-protobuf') {
|
||||
// Assume it is always an Android request.
|
||||
if (Platform.shim.server) {
|
||||
request_headers.set('User-Agent', Constants.CLIENTS.ANDROID.USER_AGENT);
|
||||
request_headers.set('X-GOOG-API-FORMAT-VERSION', '2');
|
||||
request_headers.delete('X-Youtube-Client-Version');
|
||||
request_headers.delete('X-Origin');
|
||||
}
|
||||
}
|
||||
|
||||
// Authenticate (NOTE: YouTube Kids does not support regular bearer tokens)
|
||||
@@ -152,7 +161,7 @@ export default class HTTPClient {
|
||||
ctx.client.androidSdkVersion = Constants.CLIENTS.ANDROID.SDK_VERSION;
|
||||
ctx.client.userAgent = Constants.CLIENTS.ANDROID.USER_AGENT;
|
||||
ctx.client.osName = 'Android';
|
||||
ctx.client.osVersion = '10';
|
||||
ctx.client.osVersion = '13';
|
||||
ctx.client.platform = 'MOBILE';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user