mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-24 07:11:48 +00:00
fix(Session): Incorrect session client logic
This commit is contained in:
@@ -352,11 +352,7 @@ export default class Session extends EventEmitter {
|
||||
if (client) {
|
||||
result.context.client.clientName = client.NAME;
|
||||
result.context.client.clientVersion = client.VERSION;
|
||||
} else {
|
||||
Log.warn(TAG, `Unknown client name: ${session_args.client_name}. Using default WEB client.`);
|
||||
result.context.client.clientName = ClientType.WEB;
|
||||
result.context.client.clientVersion = Constants.CLIENTS.WEB.VERSION;
|
||||
}
|
||||
} else Log.warn(TAG, `Unknown client name: ${session_args.client_name}.`);
|
||||
}
|
||||
|
||||
result.context.client.timeZone = session_args.time_zone;
|
||||
@@ -424,7 +420,7 @@ export default class Session extends EventEmitter {
|
||||
user_agent: user_agent,
|
||||
visitor_data: visitor_data || ProtoUtils.encodeVisitorData(generateRandomString(11), Math.floor(Date.now() / 1000)),
|
||||
client_name: client_name,
|
||||
client_version: Object.values(Constants.CLIENTS).filter((v) => v.NAME === client_name)[0]?.VERSION ?? Constants.CLIENTS.WEB.VERSION,
|
||||
client_version: Object.values(Constants.CLIENTS).find((v) => v.NAME === client_name)?.VERSION ?? Constants.CLIENTS.WEB.VERSION,
|
||||
device_category: device_category.toUpperCase(),
|
||||
os_name: 'Windows',
|
||||
os_version: '10.0',
|
||||
@@ -566,9 +562,9 @@ export default class Session extends EventEmitter {
|
||||
visitor_data: options.visitor_data || device_info[13],
|
||||
user_agent: options.user_agent,
|
||||
client_name: options.client_name,
|
||||
client_version: Object.values(Constants.CLIENTS).filter(
|
||||
(v) => v.NAME === options.client_name
|
||||
)[0]?.VERSION ?? device_info[16],
|
||||
client_version: options.client_name === 'WEB' ? device_info[16] : Object.values(Constants.CLIENTS).find(
|
||||
(c) => c.NAME === options.client_name
|
||||
)?.VERSION || device_info[16],
|
||||
os_name: device_info[17],
|
||||
os_version: device_info[18],
|
||||
time_zone: device_info[79] || options.time_zone,
|
||||
|
||||
Reference in New Issue
Block a user