diff --git a/protos/generated/misc/params.ts b/protos/generated/misc/params.ts index a0b7d2202..9f48eb473 100644 --- a/protos/generated/misc/params.ts +++ b/protos/generated/misc/params.ts @@ -395,6 +395,10 @@ export interface ShortsParam_Field1 { p1?: number | undefined; } +export interface NextParams { + videoId: string[]; +} + function createBaseVisitorData(): VisitorData { return { id: "", timestamp: 0 }; } @@ -3314,6 +3318,65 @@ export const ShortsParam_Field1: MessageFns = { }, }; +function createBaseNextParams(): NextParams { + return { videoId: [] }; +} + +export const NextParams: MessageFns = { + encode(message: NextParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.videoId) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NextParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNextParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + if (tag !== 42) { + break; + } + + message.videoId.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NextParams { + return { + videoId: globalThis.Array.isArray(object?.videoId) ? object.videoId.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: NextParams): unknown { + const obj: any = {}; + if (message.videoId?.length) { + obj.videoId = message.videoId; + } + return obj; + }, + + create, I>>(base?: I): NextParams { + return NextParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NextParams { + const message = createBaseNextParams(); + message.videoId = object.videoId?.map((e) => e) || []; + return message; + }, +}; + type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T diff --git a/protos/misc/params.proto b/protos/misc/params.proto index 93c04093c..31304f8c9 100644 --- a/protos/misc/params.proto +++ b/protos/misc/params.proto @@ -224,4 +224,8 @@ message ShortsParam { } optional Field1 f1 = 1; optional int32 p59 = 59; +} + +message NextParams { + repeated string video_id = 5; } \ No newline at end of file diff --git a/src/utils/ProtoUtils.ts b/src/utils/ProtoUtils.ts index 2bae974ba..94c47f833 100644 --- a/src/utils/ProtoUtils.ts +++ b/src/utils/ProtoUtils.ts @@ -1,5 +1,5 @@ import { base64ToU8, u8ToBase64 } from './Utils.js'; -import { VisitorData, PeformCommentActionParams } from '../../protos/generated/misc/params.js'; +import { VisitorData, PeformCommentActionParams, NextParams } from '../../protos/generated/misc/params.js'; export function encodeVisitorData(id: string, timestamp: number): string { const writer = VisitorData.encode({ id, timestamp }); @@ -45,4 +45,9 @@ export function encodeCommentActionParams(type: number, args: { const writer = PeformCommentActionParams.encode(data); return encodeURIComponent(u8ToBase64(writer.finish())); +} + +export function encodeNextParams(video_ids: string[]): string { + const writer = NextParams.encode({ videoId: video_ids }); + return encodeURIComponent(u8ToBase64(writer.finish()).replace(/\+/g, '-').replace(/\//g, '_')); } \ No newline at end of file