diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/(Context)/Client.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/(Context)/Client.ts index 2d5e81ae9..b57c358ab 100644 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/(Context)/Client.ts +++ b/src/proto/generated/messages/youtube/(InnertubePayload)/(Context)/Client.ts @@ -18,9 +18,17 @@ import { export declare namespace $.youtube.InnertubePayload.Context { export type Client = { - unkparam: number; + deviceMake: string; + deviceModel: string; + nameId: number; clientVersion: string; - clientName: string; + osName: string; + osVersion: string; + acceptLanguage: string; + acceptRegion: string; + androidSdkVersion: number; + windowWidthPoints: number; + windowHeightPoints: number; } } @@ -28,9 +36,17 @@ export type Type = $.youtube.InnertubePayload.Context.Client; export function getDefaultValue(): $.youtube.InnertubePayload.Context.Client { return { - unkparam: 0, + deviceMake: "", + deviceModel: "", + nameId: 0, clientVersion: "", - clientName: "", + osName: "", + osVersion: "", + acceptLanguage: "", + acceptRegion: "", + androidSdkVersion: 0, + windowWidthPoints: 0, + windowHeightPoints: 0, }; } @@ -43,24 +59,52 @@ export function createValue(partialValue: Partial<$.youtube.InnertubePayload.Con export function encodeJson(value: $.youtube.InnertubePayload.Context.Client): unknown { const result: any = {}; - if (value.unkparam !== undefined) result.unkparam = tsValueToJsonValueFns.int32(value.unkparam); + if (value.deviceMake !== undefined) result.deviceMake = tsValueToJsonValueFns.string(value.deviceMake); + if (value.deviceModel !== undefined) result.deviceModel = tsValueToJsonValueFns.string(value.deviceModel); + if (value.nameId !== undefined) result.nameId = tsValueToJsonValueFns.int32(value.nameId); if (value.clientVersion !== undefined) result.clientVersion = tsValueToJsonValueFns.string(value.clientVersion); - if (value.clientName !== undefined) result.clientName = tsValueToJsonValueFns.string(value.clientName); + if (value.osName !== undefined) result.osName = tsValueToJsonValueFns.string(value.osName); + if (value.osVersion !== undefined) result.osVersion = tsValueToJsonValueFns.string(value.osVersion); + if (value.acceptLanguage !== undefined) result.acceptLanguage = tsValueToJsonValueFns.string(value.acceptLanguage); + if (value.acceptRegion !== undefined) result.acceptRegion = tsValueToJsonValueFns.string(value.acceptRegion); + if (value.androidSdkVersion !== undefined) result.androidSdkVersion = tsValueToJsonValueFns.int32(value.androidSdkVersion); + if (value.windowWidthPoints !== undefined) result.windowWidthPoints = tsValueToJsonValueFns.int32(value.windowWidthPoints); + if (value.windowHeightPoints !== undefined) result.windowHeightPoints = tsValueToJsonValueFns.int32(value.windowHeightPoints); return result; } export function decodeJson(value: any): $.youtube.InnertubePayload.Context.Client { const result = getDefaultValue(); - if (value.unkparam !== undefined) result.unkparam = jsonValueToTsValueFns.int32(value.unkparam); + if (value.deviceMake !== undefined) result.deviceMake = jsonValueToTsValueFns.string(value.deviceMake); + if (value.deviceModel !== undefined) result.deviceModel = jsonValueToTsValueFns.string(value.deviceModel); + if (value.nameId !== undefined) result.nameId = jsonValueToTsValueFns.int32(value.nameId); if (value.clientVersion !== undefined) result.clientVersion = jsonValueToTsValueFns.string(value.clientVersion); - if (value.clientName !== undefined) result.clientName = jsonValueToTsValueFns.string(value.clientName); + if (value.osName !== undefined) result.osName = jsonValueToTsValueFns.string(value.osName); + if (value.osVersion !== undefined) result.osVersion = jsonValueToTsValueFns.string(value.osVersion); + if (value.acceptLanguage !== undefined) result.acceptLanguage = jsonValueToTsValueFns.string(value.acceptLanguage); + if (value.acceptRegion !== undefined) result.acceptRegion = jsonValueToTsValueFns.string(value.acceptRegion); + if (value.androidSdkVersion !== undefined) result.androidSdkVersion = jsonValueToTsValueFns.int32(value.androidSdkVersion); + if (value.windowWidthPoints !== undefined) result.windowWidthPoints = jsonValueToTsValueFns.int32(value.windowWidthPoints); + if (value.windowHeightPoints !== undefined) result.windowHeightPoints = jsonValueToTsValueFns.int32(value.windowHeightPoints); return result; } export function encodeBinary(value: $.youtube.InnertubePayload.Context.Client): Uint8Array { const result: WireMessage = []; - if (value.unkparam !== undefined) { - const tsValue = value.unkparam; + if (value.deviceMake !== undefined) { + const tsValue = value.deviceMake; + result.push( + [12, tsValueToWireValueFns.string(tsValue)], + ); + } + if (value.deviceModel !== undefined) { + const tsValue = value.deviceModel; + result.push( + [13, tsValueToWireValueFns.string(tsValue)], + ); + } + if (value.nameId !== undefined) { + const tsValue = value.nameId; result.push( [16, tsValueToWireValueFns.int32(tsValue)], ); @@ -71,12 +115,48 @@ export function encodeBinary(value: $.youtube.InnertubePayload.Context.Client): [17, tsValueToWireValueFns.string(tsValue)], ); } - if (value.clientName !== undefined) { - const tsValue = value.clientName; + if (value.osName !== undefined) { + const tsValue = value.osName; result.push( [18, tsValueToWireValueFns.string(tsValue)], ); } + if (value.osVersion !== undefined) { + const tsValue = value.osVersion; + result.push( + [19, tsValueToWireValueFns.string(tsValue)], + ); + } + if (value.acceptLanguage !== undefined) { + const tsValue = value.acceptLanguage; + result.push( + [21, tsValueToWireValueFns.string(tsValue)], + ); + } + if (value.acceptRegion !== undefined) { + const tsValue = value.acceptRegion; + result.push( + [22, tsValueToWireValueFns.string(tsValue)], + ); + } + if (value.androidSdkVersion !== undefined) { + const tsValue = value.androidSdkVersion; + result.push( + [34, tsValueToWireValueFns.int32(tsValue)], + ); + } + if (value.windowWidthPoints !== undefined) { + const tsValue = value.windowWidthPoints; + result.push( + [37, tsValueToWireValueFns.int32(tsValue)], + ); + } + if (value.windowHeightPoints !== undefined) { + const tsValue = value.windowHeightPoints; + result.push( + [38, tsValueToWireValueFns.int32(tsValue)], + ); + } return serialize(result); } @@ -84,12 +164,26 @@ export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.Con const result = getDefaultValue(); const wireMessage = deserialize(binary); const wireFields = new Map(wireMessage); + field: { + const wireValue = wireFields.get(12); + if (wireValue === undefined) break field; + const value = wireValueToTsValueFns.string(wireValue); + if (value === undefined) break field; + result.deviceMake = value; + } + field: { + const wireValue = wireFields.get(13); + if (wireValue === undefined) break field; + const value = wireValueToTsValueFns.string(wireValue); + if (value === undefined) break field; + result.deviceModel = value; + } field: { const wireValue = wireFields.get(16); if (wireValue === undefined) break field; const value = wireValueToTsValueFns.int32(wireValue); if (value === undefined) break field; - result.unkparam = value; + result.nameId = value; } field: { const wireValue = wireFields.get(17); @@ -103,7 +197,49 @@ export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.Con if (wireValue === undefined) break field; const value = wireValueToTsValueFns.string(wireValue); if (value === undefined) break field; - result.clientName = value; + result.osName = value; + } + field: { + const wireValue = wireFields.get(19); + if (wireValue === undefined) break field; + const value = wireValueToTsValueFns.string(wireValue); + if (value === undefined) break field; + result.osVersion = value; + } + field: { + const wireValue = wireFields.get(21); + if (wireValue === undefined) break field; + const value = wireValueToTsValueFns.string(wireValue); + if (value === undefined) break field; + result.acceptLanguage = value; + } + field: { + const wireValue = wireFields.get(22); + if (wireValue === undefined) break field; + const value = wireValueToTsValueFns.string(wireValue); + if (value === undefined) break field; + result.acceptRegion = value; + } + field: { + const wireValue = wireFields.get(34); + if (wireValue === undefined) break field; + const value = wireValueToTsValueFns.int32(wireValue); + if (value === undefined) break field; + result.androidSdkVersion = value; + } + field: { + const wireValue = wireFields.get(37); + if (wireValue === undefined) break field; + const value = wireValueToTsValueFns.int32(wireValue); + if (value === undefined) break field; + result.windowWidthPoints = value; + } + field: { + const wireValue = wireFields.get(38); + if (wireValue === undefined) break field; + const value = wireValueToTsValueFns.int32(wireValue); + if (value === undefined) break field; + result.windowHeightPoints = value; } return result; } diff --git a/src/proto/generated/messages/youtube/InnertubePayload.ts b/src/proto/generated/messages/youtube/InnertubePayload.ts index 1388e7e4a..f0f6ef51e 100644 --- a/src/proto/generated/messages/youtube/InnertubePayload.ts +++ b/src/proto/generated/messages/youtube/InnertubePayload.ts @@ -90,7 +90,7 @@ import { export declare namespace $.youtube { export type InnertubePayload = { context?: Context; - target?: string; + videoId?: string; title?: Title; description?: Description; tags?: Tags; @@ -100,6 +100,7 @@ export declare namespace $.youtube { privacy?: Privacy; madeForKids?: MadeForKids; ageRestricted?: AgeRestricted; + field83?: number; } } @@ -108,7 +109,7 @@ export type Type = $.youtube.InnertubePayload; export function getDefaultValue(): $.youtube.InnertubePayload { return { context: undefined, - target: undefined, + videoId: undefined, title: undefined, description: undefined, tags: undefined, @@ -118,6 +119,7 @@ export function getDefaultValue(): $.youtube.InnertubePayload { privacy: undefined, madeForKids: undefined, ageRestricted: undefined, + field83: undefined, }; } @@ -131,7 +133,7 @@ export function createValue(partialValue: Partial<$.youtube.InnertubePayload>): export function encodeJson(value: $.youtube.InnertubePayload): unknown { const result: any = {}; if (value.context !== undefined) result.context = encodeJson_1(value.context); - if (value.target !== undefined) result.target = tsValueToJsonValueFns.string(value.target); + if (value.videoId !== undefined) result.videoId = tsValueToJsonValueFns.string(value.videoId); if (value.title !== undefined) result.title = encodeJson_2(value.title); if (value.description !== undefined) result.description = encodeJson_3(value.description); if (value.tags !== undefined) result.tags = encodeJson_4(value.tags); @@ -141,13 +143,14 @@ export function encodeJson(value: $.youtube.InnertubePayload): unknown { if (value.privacy !== undefined) result.privacy = encodeJson_8(value.privacy); if (value.madeForKids !== undefined) result.madeForKids = encodeJson_9(value.madeForKids); if (value.ageRestricted !== undefined) result.ageRestricted = encodeJson_10(value.ageRestricted); + if (value.field83 !== undefined) result.field83 = tsValueToJsonValueFns.int32(value.field83); return result; } export function decodeJson(value: any): $.youtube.InnertubePayload { const result = getDefaultValue(); if (value.context !== undefined) result.context = decodeJson_1(value.context); - if (value.target !== undefined) result.target = jsonValueToTsValueFns.string(value.target); + if (value.videoId !== undefined) result.videoId = jsonValueToTsValueFns.string(value.videoId); if (value.title !== undefined) result.title = decodeJson_2(value.title); if (value.description !== undefined) result.description = decodeJson_3(value.description); if (value.tags !== undefined) result.tags = decodeJson_4(value.tags); @@ -157,6 +160,7 @@ export function decodeJson(value: any): $.youtube.InnertubePayload { if (value.privacy !== undefined) result.privacy = decodeJson_8(value.privacy); if (value.madeForKids !== undefined) result.madeForKids = decodeJson_9(value.madeForKids); if (value.ageRestricted !== undefined) result.ageRestricted = decodeJson_10(value.ageRestricted); + if (value.field83 !== undefined) result.field83 = jsonValueToTsValueFns.int32(value.field83); return result; } @@ -168,8 +172,8 @@ export function encodeBinary(value: $.youtube.InnertubePayload): Uint8Array { [1, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], ); } - if (value.target !== undefined) { - const tsValue = value.target; + if (value.videoId !== undefined) { + const tsValue = value.videoId; result.push( [2, tsValueToWireValueFns.string(tsValue)], ); @@ -228,6 +232,12 @@ export function encodeBinary(value: $.youtube.InnertubePayload): Uint8Array { [69, { type: WireType.LengthDelimited as const, value: encodeBinary_10(tsValue) }], ); } + if (value.field83 !== undefined) { + const tsValue = value.field83; + result.push( + [83, tsValueToWireValueFns.int32(tsValue)], + ); + } return serialize(result); } @@ -247,7 +257,7 @@ export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload { if (wireValue === undefined) break field; const value = wireValueToTsValueFns.string(wireValue); if (value === undefined) break field; - result.target = value; + result.videoId = value; } field: { const wireValue = wireFields.get(3); @@ -312,5 +322,12 @@ export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload { if (value === undefined) break field; result.ageRestricted = value; } + field: { + const wireValue = wireFields.get(83); + if (wireValue === undefined) break field; + const value = wireValueToTsValueFns.int32(wireValue); + if (value === undefined) break field; + result.field83 = value; + } return result; } diff --git a/src/proto/index.ts b/src/proto/index.ts index c7aae08cb..8f72a9042 100644 --- a/src/proto/index.ts +++ b/src/proto/index.ts @@ -240,12 +240,20 @@ export function encodeVideoMetadataPayload(video_id: string, metadata: UpdateVid const data: InnertubePayload.Type = { context: { client: { - unkparam: 14, - clientName: CLIENTS.ANDROID.NAME, - clientVersion: CLIENTS.YTSTUDIO_ANDROID.VERSION + nameId: 3, + osName: 'Android', + androidSdkVersion: CLIENTS.ANDROID.SDK_VERSION, + osVersion: '13', + acceptLanguage: 'en-US', + acceptRegion: 'US', + deviceMake: 'Google', + deviceModel: 'sdk_gphone64_x86_64', + windowHeightPoints: 840, + windowWidthPoints: 432, + clientVersion: CLIENTS.ANDROID.VERSION } }, - target: video_id + videoId: video_id }; if (Reflect.has(metadata, 'title')) @@ -302,12 +310,20 @@ export function encodeCustomThumbnailPayload(video_id: string, bytes: Uint8Array const data: InnertubePayload.Type = { context: { client: { - unkparam: 14, - clientName: CLIENTS.ANDROID.NAME, - clientVersion: CLIENTS.YTSTUDIO_ANDROID.VERSION + nameId: 3, + osName: 'Android', + androidSdkVersion: CLIENTS.ANDROID.SDK_VERSION, + osVersion: '13', + acceptLanguage: 'en-US', + acceptRegion: 'US', + deviceMake: 'Google', + deviceModel: 'sdk_gphone64_x86_64', + windowHeightPoints: 840, + windowWidthPoints: 432, + clientVersion: CLIENTS.ANDROID.VERSION } }, - target: video_id, + videoId: video_id, videoThumbnail: { type: 3, thumbnail: { diff --git a/src/proto/youtube.proto b/src/proto/youtube.proto index b9a130193..cfa271814 100644 --- a/src/proto/youtube.proto +++ b/src/proto/youtube.proto @@ -11,17 +11,24 @@ message VisitorData { message InnertubePayload { message Context { message Client { - required int32 unkparam = 16; - required string client_version = 17; - required string client_name = 18; + string deviceMake = 12; + string deviceModel = 13; + int32 nameId = 16; + string clientVersion = 17; + string osName = 18; + string osVersion = 19; + string acceptLanguage = 21; + string acceptRegion = 22; + int32 windowWidthPoints = 37; + int32 windowHeightPoints = 38; + int32 androidSdkVersion = 34; } required Client client = 1; } required Context context = 1; - // This can be either a target id or a video id. - optional string target = 2; + optional string videoId = 2; /**** YT Sudio stuff ****/