fix: send correct UA for Android requests

Related: #322
This commit is contained in:
LuanRT
2023-02-26 19:21:41 -03:00
parent 200632f374
commit f4e0f30e6e
2 changed files with 12 additions and 2 deletions

View File

@@ -49,8 +49,9 @@ export const CLIENTS = Object.freeze({
},
ANDROID: {
NAME: 'ANDROID',
VERSION: '17.34.35',
SDK_VERSION: '29'
VERSION: '18.06.35',
SDK_VERSION: '29',
USER_AGENT: 'com.google.android.youtube/18.06.35 (Linux; U; Android 10; US)'
},
YTSTUDIO_ANDROID: {
NAME: 'ANDROID_CREATOR',

View File

@@ -91,6 +91,13 @@ export default class HTTPClient {
delete n_body.client;
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);
}
}
is_web_kids = n_body.context.client.clientName === 'WEB_KIDS';
request_body = JSON.stringify(n_body);
}
@@ -146,12 +153,14 @@ export default class HTTPClient {
ctx.client.clientFormFactor = 'SMALL_FORM_FACTOR';
ctx.client.clientName = Constants.CLIENTS.ANDROID.NAME;
ctx.client.androidSdkVersion = Constants.CLIENTS.ANDROID.SDK_VERSION;
ctx.client.platform = 'MOBILE';
break;
case 'YTMUSIC_ANDROID':
ctx.client.clientVersion = Constants.CLIENTS.YTMUSIC_ANDROID.VERSION;
ctx.client.clientFormFactor = 'SMALL_FORM_FACTOR';
ctx.client.clientName = Constants.CLIENTS.YTMUSIC_ANDROID.NAME;
ctx.client.androidSdkVersion = Constants.CLIENTS.ANDROID.SDK_VERSION;
ctx.client.platform = 'MOBILE';
break;
case 'YTSTUDIO_ANDROID':
ctx.client.clientVersion = Constants.CLIENTS.YTSTUDIO_ANDROID.VERSION;