UI/UX: Adiciona campo opcional para colagem manual de transcrição no VideoMind

This commit is contained in:
2026-06-05 22:19:33 +00:00
parent 281005a8bc
commit 3781c848da
2395 changed files with 242184 additions and 20 deletions
+143
View File
@@ -0,0 +1,143 @@
{
"name": "youtubei.js",
"version": "17.0.1",
"description": "A JavaScript client for YouTube's private API, known as InnerTube.",
"type": "module",
"types": "./dist/src/platform/lib.d.ts",
"typesVersions": {
"*": {
"agnostic": [
"./dist/src/platform/lib.d.ts"
],
"web": [
"./dist/src/platform/lib.d.ts"
],
"react-native": [
"./dist/src/platform/lib.d.ts"
],
"web.bundle": [
"./dist/src/platform/lib.d.ts"
],
"web.bundle.min": [
"./dist/src/platform/lib.d.ts"
],
"cf-worker": [
"./dist/src/platform/lib.d.ts"
]
}
},
"exports": {
".": {
"deno": "./dist/src/platform/deno.js",
"node": {
"import": "./dist/src/platform/node.js",
"default": "./dist/src/platform/node.js"
},
"types": "./dist/src/platform/lib.d.ts",
"browser": "./dist/src/platform/web.js",
"react-native": "./dist/src/platform/react-native.js",
"default": "./dist/src/platform/web.js"
},
"./package.json": "./package.json",
"./agnostic": {
"types": "./dist/src/platform/lib.d.ts",
"default": "./dist/src/platform/lib.js"
},
"./web": {
"types": "./dist/src/platform/lib.d.ts",
"default": "./dist/src/platform/web.js"
},
"./react-native": {
"types": "./dist/src/platform/lib.d.ts",
"default": "./dist/src/platform/react-native.js"
},
"./web.bundle": {
"types": "./dist/src/platform/lib.d.ts",
"default": "./bundle/browser.js"
},
"./cf-worker": {
"types": "./dist/src/platform/lib.d.ts",
"default": "./dist/src/platform/cf-worker.js"
}
},
"author": "LuanRT <luan.lrt4@gmail.com> (https://github.com/LuanRT)",
"funding": [
"https://github.com/sponsors/LuanRT"
],
"contributors": [
"Wykerd (https://github.com/wykerd/)",
"MasterOfBob777 (https://github.com/MasterOfBob777)",
"patrickkfkan (https://github.com/patrickkfkan)",
"akkadaska (https://github.com/akkadaska)",
"Absidue (https://github.com/absidue)"
],
"scripts": {
"test": "vitest run --reporter verbose",
"lint": "eslint ./src",
"lint:fix": "eslint --fix ./src",
"clean:source-maps": "rimraf ./bundle/browser.js.map ./bundle/cf-worker.js.map ./bundle/react-native.js.map",
"clean:build-output": "rimraf ./dist ./bundle/browser.js ./bundle/cf-worker.js ./bundle/react-native.js ./deno",
"build": "npm run clean:build-output && npm run clean:source-maps && npm run build:parser-map && npm run build:esm && npm run bundle:browser && npm run bundle:cf-worker && npm run bundle:react-native",
"build:esm": "tspc",
"build:deno": "cpy ./src ./deno && cpy ./protos ./deno && esbuild ./src/utils/DashManifest.tsx --keep-names --format=esm --platform=neutral --target=es2020 --outfile=./deno/src/utils/DashManifest.js && cpy ./package.json ./deno && replace \".js';\" \".ts';\" ./deno -r && replace '.js\";' '.ts\";' ./deno -r && replace \"'./DashManifest.ts';\" \"'./DashManifest.js';\" ./deno -r && replace \"'jintr';\" \"'jsr:@luanrt/jintr';\" ./deno -r && replace \"@bufbuild/protobuf/wire\" \"https://esm.sh/@bufbuild/protobuf@2.0.0/wire\" ./deno -r",
"build:proto": "rimraf ./protos/generated && node ./dev-scripts/generate-proto.mjs",
"build:parser-map": "node ./dev-scripts/gen-parser-map.mjs",
"bundle:browser": "esbuild ./dist/src/platform/web.js --banner:js=\"/* eslint-disable */\" --bundle --sourcemap --target=chrome70 --keep-names --format=esm --define:global=globalThis --conditions=module --outfile=./bundle/browser.js --platform=browser",
"bundle:react-native": "esbuild ./dist/src/platform/react-native.js --bundle --sourcemap --target=es2020 --keep-names --format=esm --platform=neutral --define:global=globalThis --conditions=module --outfile=./bundle/react-native.js",
"bundle:cf-worker": "esbuild ./dist/src/platform/cf-worker.js --banner:js=\"/* eslint-disable */\" --bundle --sourcemap --target=es2020 --keep-names --format=esm --define:global=globalThis --conditions=module --outfile=./bundle/cf-worker.js --platform=node",
"build:docs": "typedoc",
"prepare": "npm run build",
"watch": "tspc --watch"
},
"repository": {
"type": "git",
"url": "git+https://github.com/LuanRT/YouTube.js.git"
},
"files": [
"dist/",
"bundle/",
"package.json",
"README.md",
"LICENSE"
],
"license": "MIT",
"dependencies": {
"@bufbuild/protobuf": "^2.0.0",
"meriyah": "^6.1.4"
},
"devDependencies": {
"@eslint/js": "^9.37.0",
"@types/estree": "^1.0.6",
"@types/node": "^25.0.3",
"@typescript-eslint/eslint-plugin": "^8.46.0",
"@typescript-eslint/parser": "^8.46.0",
"cpy-cli": "^6.0.0",
"esbuild": "^0.25.6",
"eslint": "^9.37.0",
"globals": "^17.0.0",
"replace": "^1.2.2",
"rimraf": "^6.0.1",
"ts-patch": "^3.0.2",
"ts-proto": "^2.2.0",
"typedoc": "^0.28.14",
"typedoc-plugin-markdown": "^4.9.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.0",
"vitest": "^3.2.4"
},
"bugs": {
"url": "https://github.com/LuanRT/YouTube.js/issues"
},
"homepage": "https://github.com/LuanRT/YouTube.js#readme",
"keywords": [
"api",
"youtube",
"innertube",
"livechat",
"youtube-music",
"ytdl",
"youtube-studio",
"downloader",
"ytmusic"
]
}
+36
View File
@@ -0,0 +1,36 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "misc";
export interface HttpHeader {
name?: string | undefined;
value?: string | undefined;
}
export interface FormatId {
itag?: number | undefined;
lastModified?: number | undefined;
xtags?: string | undefined;
}
export interface InitRange {
start?: number | undefined;
end?: number | undefined;
}
export interface IndexRange {
start?: number | undefined;
end?: number | undefined;
}
export interface KeyValuePair {
key?: string | undefined;
value?: string | undefined;
}
export interface FormatXTags {
xtags: KeyValuePair[];
}
export declare const HttpHeader: MessageFns<HttpHeader>;
export declare const FormatId: MessageFns<FormatId>;
export declare const InitRange: MessageFns<InitRange>;
export declare const IndexRange: MessageFns<IndexRange>;
export declare const KeyValuePair: MessageFns<KeyValuePair>;
export declare const FormatXTags: MessageFns<FormatXTags>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
+277
View File
@@ -0,0 +1,277 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: misc/common.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "misc";
function createBaseHttpHeader() {
return { name: undefined, value: undefined };
}
export const HttpHeader = {
encode(message, writer = new BinaryWriter()) {
if (message.name !== undefined) {
writer.uint32(10).string(message.name);
}
if (message.value !== undefined) {
writer.uint32(18).string(message.value);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseHttpHeader();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseFormatId() {
return { itag: undefined, lastModified: undefined, xtags: undefined };
}
export const FormatId = {
encode(message, writer = new BinaryWriter()) {
if (message.itag !== undefined) {
writer.uint32(8).int32(message.itag);
}
if (message.lastModified !== undefined) {
writer.uint32(16).uint64(message.lastModified);
}
if (message.xtags !== undefined) {
writer.uint32(26).string(message.xtags);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFormatId();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.itag = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.lastModified = longToNumber(reader.uint64());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.xtags = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseInitRange() {
return { start: undefined, end: undefined };
}
export const InitRange = {
encode(message, writer = new BinaryWriter()) {
if (message.start !== undefined) {
writer.uint32(8).int32(message.start);
}
if (message.end !== undefined) {
writer.uint32(16).int32(message.end);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseInitRange();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.start = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.end = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseIndexRange() {
return { start: undefined, end: undefined };
}
export const IndexRange = {
encode(message, writer = new BinaryWriter()) {
if (message.start !== undefined) {
writer.uint32(8).int32(message.start);
}
if (message.end !== undefined) {
writer.uint32(16).int32(message.end);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseIndexRange();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.start = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.end = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseKeyValuePair() {
return { key: undefined, value: undefined };
}
export const KeyValuePair = {
encode(message, writer = new BinaryWriter()) {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
if (message.value !== undefined) {
writer.uint32(18).string(message.value);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseKeyValuePair();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.key = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.value = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseFormatXTags() {
return { xtags: [] };
}
export const FormatXTags = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.xtags) {
KeyValuePair.encode(v, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseFormatXTags();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.xtags.push(KeyValuePair.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function longToNumber(int64) {
const num = globalThis.Number(int64.toString());
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
}
return num;
}
//# sourceMappingURL=common.js.map
File diff suppressed because one or more lines are too long
+266
View File
@@ -0,0 +1,266 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "misc";
export interface VisitorData {
id: string;
timestamp: number;
}
export interface SearchFilter {
prioritize?: SearchFilter_Prioritize | undefined;
filters?: SearchFilter_Filters | undefined;
}
export declare enum SearchFilter_Prioritize {
RELEVANCE = 0,
POPULARITY = 3,
UNRECOGNIZED = -1
}
export interface SearchFilter_Filters {
uploadDate?: SearchFilter_Filters_UploadDate | undefined;
type?: SearchFilter_Filters_SearchType | undefined;
duration?: SearchFilter_Filters_Duration | undefined;
musicSearchType?: SearchFilter_Filters_MusicSearchType | undefined;
featuresHd?: boolean | undefined;
featuresSubtitles?: boolean | undefined;
featuresCreativeCommons?: boolean | undefined;
features3d?: boolean | undefined;
featuresLive?: boolean | undefined;
featuresPurchased?: boolean | undefined;
features4k?: boolean | undefined;
features360?: boolean | undefined;
featuresLocation?: boolean | undefined;
featuresHdr?: boolean | undefined;
featuresVr180?: boolean | undefined;
}
export declare enum SearchFilter_Filters_UploadDate {
ANY_DATE = 0,
TODAY = 2,
WEEK = 3,
MONTH = 4,
YEAR = 5,
UNRECOGNIZED = -1
}
export declare enum SearchFilter_Filters_SearchType {
ANY_TYPE = 0,
VIDEO = 1,
CHANNEL = 2,
PLAYLIST = 3,
MOVIE = 4,
SHORTS = 9,
UNRECOGNIZED = -1
}
export declare enum SearchFilter_Filters_Duration {
ANY_DURATION = 0,
OVER_TWENTY_MINS = 2,
UNDER_THREE_MINS = 4,
THREE_TO_TWENTY_MINS = 5,
UNRECOGNIZED = -1
}
export interface SearchFilter_Filters_MusicSearchType {
song?: boolean | undefined;
video?: boolean | undefined;
album?: boolean | undefined;
artist?: boolean | undefined;
playlist?: boolean | undefined;
}
export interface ChannelAnalytics {
params: ChannelAnalytics_Params | undefined;
}
export interface ChannelAnalytics_Params {
channelId: string;
}
export interface SoundInfoParams {
sound: SoundInfoParams_Sound | undefined;
}
export interface SoundInfoParams_Sound {
params: SoundInfoParams_Sound_Params | undefined;
}
export interface SoundInfoParams_Sound_Params {
ids: SoundInfoParams_Sound_Params_Ids | undefined;
}
export interface SoundInfoParams_Sound_Params_Ids {
id1: string;
id2: string;
id3: string;
}
export interface NotificationPreferences {
channelId: string;
prefId: NotificationPreferences_Preference | undefined;
number0?: number | undefined;
number1?: number | undefined;
}
export interface NotificationPreferences_Preference {
index: number;
}
export interface LiveMessageParams {
params: LiveMessageParams_Params | undefined;
number0?: number | undefined;
number1?: number | undefined;
}
export interface LiveMessageParams_Params {
ids: LiveMessageParams_Params_Ids | undefined;
}
export interface LiveMessageParams_Params_Ids {
channelId: string;
videoId: string;
}
export interface GetCommentsSectionParams {
ctx: GetCommentsSectionParams_Context | undefined;
unkParam: number;
params: GetCommentsSectionParams_Params | undefined;
}
export interface GetCommentsSectionParams_Context {
videoId: string;
}
export interface GetCommentsSectionParams_Params {
unkToken?: string | undefined;
opts?: GetCommentsSectionParams_Params_Options | undefined;
repliesOpts?: GetCommentsSectionParams_Params_RepliesOptions | undefined;
page?: number | undefined;
target: string;
}
export interface GetCommentsSectionParams_Params_Options {
videoId: string;
sortBy: number;
type: number;
commentId?: string | undefined;
}
export interface GetCommentsSectionParams_Params_RepliesOptions {
commentId: string;
unkopts: GetCommentsSectionParams_Params_RepliesOptions_UnkOpts | undefined;
channelId?: string | undefined;
videoId: string;
unkParam1: number;
unkParam2: number;
}
export interface GetCommentsSectionParams_Params_RepliesOptions_UnkOpts {
unkParam: number;
}
export interface CreateCommentParams {
videoId: string;
params: CreateCommentParams_Params | undefined;
number: number;
}
export interface CreateCommentParams_Params {
index: number;
}
export interface PeformCommentActionParams {
type: number;
commentId: string;
videoId: string;
unkNum?: number | undefined;
channelId?: string | undefined;
translateCommentParams?: PeformCommentActionParams_TranslateCommentParams | undefined;
}
export interface PeformCommentActionParams_TranslateCommentParams {
params: PeformCommentActionParams_TranslateCommentParams_Params | undefined;
commentId: string;
targetLanguage: string;
}
export interface PeformCommentActionParams_TranslateCommentParams_Params {
comment: PeformCommentActionParams_TranslateCommentParams_Params_Comment | undefined;
}
export interface PeformCommentActionParams_TranslateCommentParams_Params_Comment {
text: string;
}
export interface Hashtag {
params: Hashtag_Params | undefined;
}
export interface Hashtag_Params {
hashtag: string;
type: number;
}
export interface ReelSequence {
shortId: string;
params: ReelSequence_Params | undefined;
feature2: number;
feature3: number;
}
export interface ReelSequence_Params {
number: number;
}
export interface ShortsParam {
f1?: ShortsParam_Field1 | undefined;
p59?: number | undefined;
}
export interface ShortsParam_Field1 {
p1?: number | undefined;
}
export interface NextParams {
videoId: string[];
playlistTitle?: string | undefined;
}
export interface CommunityPostParams {
f1: CommunityPostParams_Field1 | undefined;
}
export interface CommunityPostParams_Field1 {
ucid1: string;
postId: string;
ucid2: string;
}
export interface CommunityPostCommentsParamContainer {
f0: CommunityPostCommentsParamContainer_Container | undefined;
}
export interface CommunityPostCommentsParamContainer_Container {
location: string;
protoData: string;
}
export interface CommunityPostCommentsParam {
title: string;
commentDataContainer: CommunityPostCommentsParam_CommentDataContainer | undefined;
}
export interface CommunityPostCommentsParam_CommentDataContainer {
commentData: CommunityPostCommentsParam_CommentDataContainer_CommentData | undefined;
f0: number;
title: string;
}
export interface CommunityPostCommentsParam_CommentDataContainer_CommentData {
sortBy: number;
f0: number;
f1: number;
postId: string;
channelId: string;
}
export declare const VisitorData: MessageFns<VisitorData>;
export declare const SearchFilter: MessageFns<SearchFilter>;
export declare const SearchFilter_Filters: MessageFns<SearchFilter_Filters>;
export declare const SearchFilter_Filters_MusicSearchType: MessageFns<SearchFilter_Filters_MusicSearchType>;
export declare const ChannelAnalytics: MessageFns<ChannelAnalytics>;
export declare const ChannelAnalytics_Params: MessageFns<ChannelAnalytics_Params>;
export declare const SoundInfoParams: MessageFns<SoundInfoParams>;
export declare const SoundInfoParams_Sound: MessageFns<SoundInfoParams_Sound>;
export declare const SoundInfoParams_Sound_Params: MessageFns<SoundInfoParams_Sound_Params>;
export declare const SoundInfoParams_Sound_Params_Ids: MessageFns<SoundInfoParams_Sound_Params_Ids>;
export declare const NotificationPreferences: MessageFns<NotificationPreferences>;
export declare const NotificationPreferences_Preference: MessageFns<NotificationPreferences_Preference>;
export declare const LiveMessageParams: MessageFns<LiveMessageParams>;
export declare const LiveMessageParams_Params: MessageFns<LiveMessageParams_Params>;
export declare const LiveMessageParams_Params_Ids: MessageFns<LiveMessageParams_Params_Ids>;
export declare const GetCommentsSectionParams: MessageFns<GetCommentsSectionParams>;
export declare const GetCommentsSectionParams_Context: MessageFns<GetCommentsSectionParams_Context>;
export declare const GetCommentsSectionParams_Params: MessageFns<GetCommentsSectionParams_Params>;
export declare const GetCommentsSectionParams_Params_Options: MessageFns<GetCommentsSectionParams_Params_Options>;
export declare const GetCommentsSectionParams_Params_RepliesOptions: MessageFns<GetCommentsSectionParams_Params_RepliesOptions>;
export declare const GetCommentsSectionParams_Params_RepliesOptions_UnkOpts: MessageFns<GetCommentsSectionParams_Params_RepliesOptions_UnkOpts>;
export declare const CreateCommentParams: MessageFns<CreateCommentParams>;
export declare const CreateCommentParams_Params: MessageFns<CreateCommentParams_Params>;
export declare const PeformCommentActionParams: MessageFns<PeformCommentActionParams>;
export declare const PeformCommentActionParams_TranslateCommentParams: MessageFns<PeformCommentActionParams_TranslateCommentParams>;
export declare const PeformCommentActionParams_TranslateCommentParams_Params: MessageFns<PeformCommentActionParams_TranslateCommentParams_Params>;
export declare const PeformCommentActionParams_TranslateCommentParams_Params_Comment: MessageFns<PeformCommentActionParams_TranslateCommentParams_Params_Comment>;
export declare const Hashtag: MessageFns<Hashtag>;
export declare const Hashtag_Params: MessageFns<Hashtag_Params>;
export declare const ReelSequence: MessageFns<ReelSequence>;
export declare const ReelSequence_Params: MessageFns<ReelSequence_Params>;
export declare const ShortsParam: MessageFns<ShortsParam>;
export declare const ShortsParam_Field1: MessageFns<ShortsParam_Field1>;
export declare const NextParams: MessageFns<NextParams>;
export declare const CommunityPostParams: MessageFns<CommunityPostParams>;
export declare const CommunityPostParams_Field1: MessageFns<CommunityPostParams_Field1>;
export declare const CommunityPostCommentsParamContainer: MessageFns<CommunityPostCommentsParamContainer>;
export declare const CommunityPostCommentsParamContainer_Container: MessageFns<CommunityPostCommentsParamContainer_Container>;
export declare const CommunityPostCommentsParam: MessageFns<CommunityPostCommentsParam>;
export declare const CommunityPostCommentsParam_CommentDataContainer: MessageFns<CommunityPostCommentsParam_CommentDataContainer>;
export declare const CommunityPostCommentsParam_CommentDataContainer_CommentData: MessageFns<CommunityPostCommentsParam_CommentDataContainer_CommentData>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,20 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface AttestationResponseData {
challenge?: string | undefined;
webResponse?: string | undefined;
androidResponse?: string | undefined;
iosResponse?: Uint8Array | undefined;
error?: number | undefined;
adblockReporting?: AttestationResponseData_AdblockReporting | undefined;
}
export interface AttestationResponseData_AdblockReporting {
reportingStatus?: number | undefined;
broadSpectrumDetectionResult?: number | undefined;
}
export declare const AttestationResponseData: MessageFns<AttestationResponseData>;
export declare const AttestationResponseData_AdblockReporting: MessageFns<AttestationResponseData_AdblockReporting>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,152 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/attestation_response_data.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBaseAttestationResponseData() {
return {
challenge: undefined,
webResponse: undefined,
androidResponse: undefined,
iosResponse: undefined,
error: undefined,
adblockReporting: undefined,
};
}
export const AttestationResponseData = {
encode(message, writer = new BinaryWriter()) {
if (message.challenge !== undefined) {
writer.uint32(10).string(message.challenge);
}
if (message.webResponse !== undefined) {
writer.uint32(18).string(message.webResponse);
}
if (message.androidResponse !== undefined) {
writer.uint32(26).string(message.androidResponse);
}
if (message.iosResponse !== undefined) {
writer.uint32(34).bytes(message.iosResponse);
}
if (message.error !== undefined) {
writer.uint32(40).int32(message.error);
}
if (message.adblockReporting !== undefined) {
AttestationResponseData_AdblockReporting.encode(message.adblockReporting, writer.uint32(50).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAttestationResponseData();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.challenge = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.webResponse = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.androidResponse = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.iosResponse = reader.bytes();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.error = reader.int32();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.adblockReporting = AttestationResponseData_AdblockReporting.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseAttestationResponseData_AdblockReporting() {
return { reportingStatus: undefined, broadSpectrumDetectionResult: undefined };
}
export const AttestationResponseData_AdblockReporting = {
encode(message, writer = new BinaryWriter()) {
if (message.reportingStatus !== undefined) {
writer.uint32(8).uint64(message.reportingStatus);
}
if (message.broadSpectrumDetectionResult !== undefined) {
writer.uint32(16).uint64(message.broadSpectrumDetectionResult);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAttestationResponseData_AdblockReporting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.reportingStatus = longToNumber(reader.uint64());
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.broadSpectrumDetectionResult = longToNumber(reader.uint64());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function longToNumber(int64) {
const num = globalThis.Number(int64.toString());
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
}
return num;
}
//# sourceMappingURL=attestation_response_data.js.map
@@ -0,0 +1 @@
{"version":3,"file":"attestation_response_data.js","sourceRoot":"","sources":["../../../../../../protos/generated/youtube/api/pfiinnertube/attestation_response_data.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,mEAAmE;AAEnE,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAgB1D,SAAS,iCAAiC;IACxC,OAAO;QACL,SAAS,EAAE,SAAS;QACpB,WAAW,EAAE,SAAS;QACtB,eAAe,EAAE,SAAS;QAC1B,WAAW,EAAE,SAAS;QACtB,KAAK,EAAE,SAAS;QAChB,gBAAgB,EAAE,SAAS;KAC5B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAwC;IAC1E,MAAM,CAAC,OAAgC,EAAE,SAAuB,IAAI,YAAY,EAAE;QAChF,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9C,CAAC;QACD,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACtC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,OAAO,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YAC1C,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACtC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OA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AAC;oBAED,OAAO,CAAC,4BAA4B,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;oBACrE,SAAS;gBACX,CAAC;YACH,CAAC;YACD,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;gBACjC,MAAM;YACR,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC;AAEF,SAAS,YAAY,CAAC,KAA6B;IACjD,MAAM,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChD,IAAI,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC7C,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC7E,CAAC;IACD,IAAI,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC7C,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,19 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface CapabilityInfo {
profile?: string | undefined;
supportedCapabilities: InnerTubeCapability[];
disabledCapabilities: InnerTubeCapability[];
snapshot?: string | undefined;
}
export interface InnerTubeCapability {
capability?: number | undefined;
features?: number | undefined;
experimentFlags?: string | undefined;
}
export declare const CapabilityInfo: MessageFns<CapabilityInfo>;
export declare const InnerTubeCapability: MessageFns<InnerTubeCapability>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,125 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/capability_info.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBaseCapabilityInfo() {
return { profile: undefined, supportedCapabilities: [], disabledCapabilities: [], snapshot: undefined };
}
export const CapabilityInfo = {
encode(message, writer = new BinaryWriter()) {
if (message.profile !== undefined) {
writer.uint32(10).string(message.profile);
}
for (const v of message.supportedCapabilities) {
InnerTubeCapability.encode(v, writer.uint32(18).fork()).join();
}
for (const v of message.disabledCapabilities) {
InnerTubeCapability.encode(v, writer.uint32(26).fork()).join();
}
if (message.snapshot !== undefined) {
writer.uint32(42).string(message.snapshot);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCapabilityInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.profile = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.supportedCapabilities.push(InnerTubeCapability.decode(reader, reader.uint32()));
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.disabledCapabilities.push(InnerTubeCapability.decode(reader, reader.uint32()));
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.snapshot = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseInnerTubeCapability() {
return { capability: undefined, features: undefined, experimentFlags: undefined };
}
export const InnerTubeCapability = {
encode(message, writer = new BinaryWriter()) {
if (message.capability !== undefined) {
writer.uint32(8).uint32(message.capability);
}
if (message.features !== undefined) {
writer.uint32(16).uint32(message.features);
}
if (message.experimentFlags !== undefined) {
writer.uint32(50).string(message.experimentFlags);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseInnerTubeCapability();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.capability = reader.uint32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.features = reader.uint32();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.experimentFlags = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=capability_info.js.map
@@ -0,0 +1 @@
{"version":3,"file":"capability_info.js","sourceRoot":"","sources":["../../../../../../protos/generated/youtube/api/pfiinnertube/capability_info.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,yDAAyD;AAEzD,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAe1D,SAAS,wBAAwB;IAC/B,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,EAAE,EAAE,oBAAoB,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAC1G,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAA+B;IACxD,MAAM,CAAC,OAAuB,EAAE,SAAuB,IAAI,YAAY,EAAE;QACvE,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAC9C,mBAAmB,CAAC,MAAM,CAAC,CAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAA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AAI,GAAG,KAAK,EAAE,EAAE,CAAC;wBACf,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;oBAC1C,SAAS;gBACX,CAAC;YACH,CAAC;YACD,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;gBACjC,MAAM;YACR,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
@@ -0,0 +1,330 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface ClientInfo {
hl?: string | undefined;
gl?: string | undefined;
remoteHost?: string | undefined;
deviceId?: string | undefined;
debugDeviceIdOverride?: string | undefined;
carrierGeo?: string | undefined;
crackedHl?: boolean | undefined;
deviceMake?: string | undefined;
deviceModel?: string | undefined;
visitorData?: string | undefined;
userAgent?: string | undefined;
clientName?: number | undefined;
clientVersion?: string | undefined;
osName?: string | undefined;
osVersion?: string | undefined;
projectId?: string | undefined;
acceptLanguage?: string | undefined;
acceptRegion?: string | undefined;
originalUrl?: string | undefined;
rawDeviceId?: string | undefined;
configData?: string | undefined;
spacecastToken?: string | undefined;
internalGeo?: string | undefined;
screenWidthPoints?: number | undefined;
screenHeightPoints?: number | undefined;
screenWidthInches?: number | undefined;
screenHeightInches?: number | undefined;
screenPixelDensity?: number | undefined;
platform?: number | undefined;
spacecastClientInfo?: ClientInfo_SpacecastClientInfo | undefined;
clientFormFactor?: ClientInfo_ClientFormFactor | undefined;
forwardedFor?: string | undefined;
mobileDataPlanInfo?: ClientInfo_MobileDataPlanInfo | undefined;
/** e.g. 241757026 */
gmscoreVersionCode?: number | undefined;
webpSupport?: boolean | undefined;
cameraType?: ClientInfo_CameraType | undefined;
experimentsToken?: string | undefined;
windowWidthPoints?: number | undefined;
windowHeightPoints?: number | undefined;
configInfo?: ClientInfo_ConfigGroupsClientInfo | undefined;
unpluggedLocationInfo?: ClientInfo_UnpluggedLocationInfo | undefined;
androidSdkVersion?: number | undefined;
screenDensityFloat?: number | undefined;
firstTimeSignInExperimentIds?: number | undefined;
utcOffsetMinutes?: number | undefined;
animatedWebpSupport?: boolean | undefined;
kidsAppInfo?: ClientInfo_KidsAppInfo | undefined;
musicAppInfo?: ClientInfo_MusicAppInfo | undefined;
tvAppInfo?: ClientInfo_TvAppInfo | undefined;
internalGeoIp?: string | undefined;
unpluggedAppInfo?: ClientInfo_UnpluggedAppInfo | undefined;
locationInfo?: ClientInfo_LocationInfo | undefined;
contentSizeCategory?: string | undefined;
fontScale?: number | undefined;
userInterfaceTheme?: ClientInfo_UserInterfaceTheme | undefined;
timeZone?: string | undefined;
homeGroupInfo?: ClientInfo_HomeGroupInfo | undefined;
emlTemplateContext?: Uint8Array | undefined;
coldAppBundleConfigData?: Uint8Array | undefined;
/** repeated ExperimentsHeterodyne.ExperimentIds heterodyne_ids = 86; */
browserName?: string | undefined;
browserVersion?: string | undefined;
locationPlayabilityToken?: string | undefined;
/** e.g. "qcom;taro" */
chipset?: string | undefined;
firmwareVersion?: string | undefined;
memoryTotalKbytes?: number | undefined;
mainAppWebInfo?: ClientInfo_MainAppWebInfo | undefined;
notificationPermissionInfo?: ClientInfo_NotificationPermissionInfo | undefined;
deviceBrand?: string | undefined;
/**
* optional ClientStoreInfo client_store_info = 99;
* optional SRSDataPushVersion srs_datapush_build_ids = 100;
* optional PlayerDataPushVersion player_datapush_build_ids = 101;
*/
glDeviceInfo?: ClientInfo_GLDeviceInfo | undefined;
}
export declare enum ClientInfo_ClientFormFactor {
/** UNKNOWN_FORM_FACTOR - @TODO: Check these. */
UNKNOWN_FORM_FACTOR = 0,
FORM_FACTOR_VAL1 = 1,
FORM_FACTOR_VAL2 = 2,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_CameraType {
UNKNOWN_CAMERA_TYPE = 0,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_UserInterfaceTheme {
USER_INTERFACE_THEME_DARK = 0,
USER_INTERFACE_THEME_LIGHT = 1,
UNRECOGNIZED = -1
}
export interface ClientInfo_MainAppWebInfo {
graftUrl?: string | undefined;
pwaInstallabilityStatus?: ClientInfo_MainAppWebInfo_PwaInstallabilityStatus | undefined;
webDisplayMode?: ClientInfo_MainAppWebInfo_WebDisplayMode | undefined;
isWebNativeShareAvailable?: boolean | undefined;
storeDigitalGoodsApiSupportStatus?: ClientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatus | undefined;
}
export declare enum ClientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatus {
STORE_DIGITAL_GOODS_API_SUPPORT_STATUS_VAL0 = 0,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_MainAppWebInfo_PwaInstallabilityStatus {
PWA_INSTALLABILITY_STATUS_UNKNOWN = 0,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_MainAppWebInfo_WebDisplayMode {
WEB_DISPLAY_MODE_UNKNOWN = 0,
UNRECOGNIZED = -1
}
export interface ClientInfo_NotificationPermissionInfo {
notificationsSetting?: ClientInfo_NotificationPermissionInfo_NotificationsSetting | undefined;
lastDeviceOptInChangeTimeAgoSec?: number | undefined;
}
export declare enum ClientInfo_NotificationPermissionInfo_NotificationsSetting {
NOTIFICATIONS_SETTING_UNKNOWN = 0,
UNRECOGNIZED = -1
}
export interface ClientInfo_GLDeviceInfo {
glRenderer?: string | undefined;
glEsVersionMajor?: number | undefined;
glEsVersionMinor?: number | undefined;
}
export interface ClientInfo_SpacecastClientInfo {
appliances?: ClientInfo_SpacecastClientInfo_SpacecastAppliance | undefined;
interactionLevel?: ClientInfo_SpacecastClientInfo_SpacecastInteractionLevel | undefined;
}
export declare enum ClientInfo_SpacecastClientInfo_SpacecastInteractionLevel {
UNKNOWN = 0,
UNRECOGNIZED = -1
}
export interface ClientInfo_SpacecastClientInfo_SpacecastAppliance {
contentProfileToken?: Uint8Array | undefined;
status?: ClientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatus | undefined;
hostname?: string | undefined;
active?: boolean | undefined;
deviceId?: string | undefined;
}
export declare enum ClientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatus {
UNKNOWN = 0,
UNRECOGNIZED = -1
}
export interface ClientInfo_MobileDataPlanInfo {
cpid?: string | undefined;
serializedDataPlanStatus?: string | undefined;
dataSavingQualityPickerEnabled?: boolean | undefined;
mccmnc?: string | undefined;
}
export interface ClientInfo_ConfigGroupsClientInfo {
coldConfigData?: string | undefined;
coldHashData?: string | undefined;
hotHashData?: string | undefined;
appInstallData?: string | undefined;
}
export interface ClientInfo_UnpluggedLocationInfo {
latitudeE7?: number | undefined;
longitudeE7?: number | undefined;
localTimestampMs?: number | undefined;
ipAddress?: string | undefined;
timezone?: string | undefined;
prefer24HourTime?: boolean | undefined;
locationRadiusMeters?: number | undefined;
isInitialLoad?: boolean | undefined;
browserPermissionGranted?: boolean | undefined;
clientPermissionState?: number | undefined;
locationOverrideToken?: string | undefined;
}
export interface ClientInfo_KidsAppInfo {
contentSettings?: ClientInfo_KidsAppInfo_KidsContentSettings | undefined;
parentCurationMode?: ClientInfo_KidsAppInfo_KidsParentCurationMode | undefined;
categorySettings?: ClientInfo_KidsAppInfo_KidsCategorySettings | undefined;
userEducationSettings?: ClientInfo_KidsAppInfo_KidsUserEducationSettings | undefined;
}
export declare enum ClientInfo_KidsAppInfo_KidsParentCurationMode {
KPCM_UNKNOWN = 0,
UNRECOGNIZED = -1
}
export interface ClientInfo_KidsAppInfo_KidsContentSettings {
kidsNoSearchMode?: ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode | undefined;
ageUpMode?: ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode | undefined;
contentDensity?: ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity | undefined;
}
export declare enum ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode {
YT_KIDS_NO_SEARCH_MODE_OFF = 0,
YT_KIDS_NO_SEARCH_MODE_ON = 1,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode {
YT_KIDS_AGE_UP_MODE_OFF = 0,
YT_KIDS_AGE_UP_MODE_ON = 1,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity {
/** YT_KIDS_CONTENT_DENSITY_VAL1 - @TODO: Check these. */
YT_KIDS_CONTENT_DENSITY_VAL1 = 0,
YT_KIDS_CONTENT_DENSITY_VAL2 = 1,
YT_KIDS_CONTENT_DENSITY_VAL3 = 2,
UNRECOGNIZED = -1
}
export interface ClientInfo_KidsAppInfo_KidsCategorySettings {
enabledCategories?: string | undefined;
}
export interface ClientInfo_KidsAppInfo_KidsUserEducationSettings {
hasSeenHomeChipBarUserEducation?: boolean | undefined;
hasSeenHomePivotBarUserEducation?: boolean | undefined;
hasSeenParentMuirUserEducation?: boolean | undefined;
}
export interface ClientInfo_MusicAppInfo {
playBackMode?: ClientInfo_MusicAppInfo_MusicPlayBackMode | undefined;
musicLocationMasterSwitch?: ClientInfo_MusicAppInfo_MusicLocationMasterSwitch | undefined;
musicActivityMasterSwitch?: ClientInfo_MusicAppInfo_MusicActivityMasterSwitch | undefined;
offlineMixtapeEnabled?: boolean | undefined;
autoOfflineEnabled?: boolean | undefined;
iosBackgroundRefreshStatus?: ClientInfo_MusicAppInfo_IosBackgroundRefreshStatus | undefined;
smartDownloadsSongLimit?: number | undefined;
transitionedFromMixtapeToSmartDownloads?: boolean | undefined;
pwaInstallabilityStatus?: ClientInfo_MusicAppInfo_PwaInstallabilityStatus | undefined;
webDisplayMode?: ClientInfo_MusicAppInfo_WebDisplayMode | undefined;
musicTier?: ClientInfo_MusicAppInfo_MusicTier | undefined;
storeDigitalGoodsApiSupportStatus?: ClientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatus | undefined;
smartDownloadsTimeSinceLastOptOutSec?: number | undefined;
}
export declare enum ClientInfo_MusicAppInfo_MusicPlayBackMode {
MPBM_UNKNOWN = 0,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_MusicAppInfo_MusicLocationMasterSwitch {
MLMS_UNKNOWN = 0,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_MusicAppInfo_MusicActivityMasterSwitch {
MAMS_UNKNOWN = 0,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_MusicAppInfo_IosBackgroundRefreshStatus {
UNKNOWN_STATUS = 0,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_MusicAppInfo_PwaInstallabilityStatus {
PIS_UNKNOWN = 0,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_MusicAppInfo_WebDisplayMode {
WDM_UNKNOWN = 0,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_MusicAppInfo_MusicTier {
UNKNOWN_TIER = 0,
UNRECOGNIZED = -1
}
export declare enum ClientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatus {
SDGAS_UNKNOWN = 0,
UNRECOGNIZED = -1
}
export interface ClientInfo_TvAppInfo {
mdxImpactedSessionsServerEvents?: string | undefined;
enablePrivacyFilter?: boolean | undefined;
zylonLeftNav?: boolean | undefined;
certificationScope?: string | undefined;
livingRoomPoTokenId?: string | undefined;
jsEngineString?: string | undefined;
voiceCapability?: ClientInfo_TvAppInfo_VoiceCapability | undefined;
systemIntegrator?: string | undefined;
androidBuildFingerprint?: string | undefined;
cobaltAppVersion?: string | undefined;
cobaltStarboardVersion?: string | undefined;
useStartPlaybackPreviewCommand?: boolean | undefined;
shouldShowPersistentSigninOnHome?: boolean | undefined;
androidPlayServicesVersion?: string | undefined;
}
export interface ClientInfo_TvAppInfo_VoiceCapability {
hasSoftMicSupport?: boolean | undefined;
hasHardMicSupport?: boolean | undefined;
}
export interface ClientInfo_UnpluggedAppInfo {
enableFilterMode?: boolean | undefined;
iosNotificationPermission?: boolean | undefined;
forceEnableEpg3?: boolean | undefined;
}
export interface ClientInfo_LocationInfo {
locationInfoStatus?: number | undefined;
ulrStatus?: ClientInfo_LocationInfo_UrlStatus | undefined;
latitudeE7?: string | undefined;
longitudeE7?: string | undefined;
horizontalAccuracyMeters?: string | undefined;
locationFreshnessMs?: string | undefined;
locationPermissionAuthorizationStatus?: number | undefined;
locationOverrideToken?: string | undefined;
forceLocationPlayabilityTokenRefresh?: boolean | undefined;
}
export interface ClientInfo_LocationInfo_UrlStatus {
reportingEnabledSetting?: number | undefined;
historyEnabledSetting?: number | undefined;
isAllowed?: boolean | undefined;
isActive?: boolean | undefined;
}
export interface ClientInfo_HomeGroupInfo {
isPartOfGroup?: boolean | undefined;
isGroup?: boolean | undefined;
}
export declare const ClientInfo: MessageFns<ClientInfo>;
export declare const ClientInfo_MainAppWebInfo: MessageFns<ClientInfo_MainAppWebInfo>;
export declare const ClientInfo_NotificationPermissionInfo: MessageFns<ClientInfo_NotificationPermissionInfo>;
export declare const ClientInfo_GLDeviceInfo: MessageFns<ClientInfo_GLDeviceInfo>;
export declare const ClientInfo_SpacecastClientInfo: MessageFns<ClientInfo_SpacecastClientInfo>;
export declare const ClientInfo_SpacecastClientInfo_SpacecastAppliance: MessageFns<ClientInfo_SpacecastClientInfo_SpacecastAppliance>;
export declare const ClientInfo_MobileDataPlanInfo: MessageFns<ClientInfo_MobileDataPlanInfo>;
export declare const ClientInfo_ConfigGroupsClientInfo: MessageFns<ClientInfo_ConfigGroupsClientInfo>;
export declare const ClientInfo_UnpluggedLocationInfo: MessageFns<ClientInfo_UnpluggedLocationInfo>;
export declare const ClientInfo_KidsAppInfo: MessageFns<ClientInfo_KidsAppInfo>;
export declare const ClientInfo_KidsAppInfo_KidsContentSettings: MessageFns<ClientInfo_KidsAppInfo_KidsContentSettings>;
export declare const ClientInfo_KidsAppInfo_KidsCategorySettings: MessageFns<ClientInfo_KidsAppInfo_KidsCategorySettings>;
export declare const ClientInfo_KidsAppInfo_KidsUserEducationSettings: MessageFns<ClientInfo_KidsAppInfo_KidsUserEducationSettings>;
export declare const ClientInfo_MusicAppInfo: MessageFns<ClientInfo_MusicAppInfo>;
export declare const ClientInfo_TvAppInfo: MessageFns<ClientInfo_TvAppInfo>;
export declare const ClientInfo_TvAppInfo_VoiceCapability: MessageFns<ClientInfo_TvAppInfo_VoiceCapability>;
export declare const ClientInfo_UnpluggedAppInfo: MessageFns<ClientInfo_UnpluggedAppInfo>;
export declare const ClientInfo_LocationInfo: MessageFns<ClientInfo_LocationInfo>;
export declare const ClientInfo_LocationInfo_UrlStatus: MessageFns<ClientInfo_LocationInfo_UrlStatus>;
export declare const ClientInfo_HomeGroupInfo: MessageFns<ClientInfo_HomeGroupInfo>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,17 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InnerTubeContext } from "./innertube_context.js";
import { PlayerRequest } from "./player_request.js";
import { ReelItemWatchRequest } from "./reel_item_watch_request.js";
import { WatchNextRequest } from "./watch_next_request.js";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface GetWatchRequest {
context?: InnerTubeContext | undefined;
playerRequest?: PlayerRequest | undefined;
watchNextRequest?: WatchNextRequest | undefined;
reelItemWatchRequest?: ReelItemWatchRequest | undefined;
}
export declare const GetWatchRequest: MessageFns<GetWatchRequest>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,76 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/get_watch_request.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InnerTubeContext } from "./innertube_context.js";
import { PlayerRequest } from "./player_request.js";
import { ReelItemWatchRequest } from "./reel_item_watch_request.js";
import { WatchNextRequest } from "./watch_next_request.js";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBaseGetWatchRequest() {
return { context: undefined, playerRequest: undefined, watchNextRequest: undefined, reelItemWatchRequest: undefined };
}
export const GetWatchRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.context !== undefined) {
InnerTubeContext.encode(message.context, writer.uint32(10).fork()).join();
}
if (message.playerRequest !== undefined) {
PlayerRequest.encode(message.playerRequest, writer.uint32(18).fork()).join();
}
if (message.watchNextRequest !== undefined) {
WatchNextRequest.encode(message.watchNextRequest, writer.uint32(26).fork()).join();
}
if (message.reelItemWatchRequest !== undefined) {
ReelItemWatchRequest.encode(message.reelItemWatchRequest, writer.uint32(34).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetWatchRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.context = InnerTubeContext.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.playerRequest = PlayerRequest.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.watchNextRequest = WatchNextRequest.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.reelItemWatchRequest = ReelItemWatchRequest.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=get_watch_request.js.map
@@ -0,0 +1 @@
{"version":3,"file":"get_watch_request.js","sourceRoot":"","sources":["../../../../../../protos/generated/youtube/api/pfiinnertube/get_watch_request.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC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,CAAC,CAAC;oBACP,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;wBACf,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;oBAC5E,SAAS;gBACX,CAAC;gBACD,KAAK,CAAC,CAAC,CAAC,CAAC;oBACP,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;wBACf,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,oBAAoB,GAAG,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;oBACpF,SAAS;gBACX,CAAC;YACH,CAAC;YACD,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;gBACjC,MAAM;YACR,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
@@ -0,0 +1,48 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { KeyValuePair } from "../../../misc/common.js";
import { CapabilityInfo } from "./capability_info.js";
import { ClientInfo } from "./client_info.js";
import { RequestInfo } from "./request_info.js";
import { ThirdPartyInfo } from "./third_party_info.js";
import { UserInfo } from "./user_info.js";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface InnerTubeContext {
client?: ClientInfo | undefined;
user?: UserInfo | undefined;
capabilities?: CapabilityInfo | undefined;
request?: RequestInfo | undefined;
clickTracking?: InnerTubeContext_ClickTrackingInfo | undefined;
thirdParty?: ThirdPartyInfo | undefined;
remoteClient?: ClientInfo | undefined;
adSignalsInfo?: InnerTubeContext_AdSignalsInfo | undefined;
experimentalData?: InnerTubeContext_ExperimentalData | undefined;
clientScreenNonce?: string | undefined;
activePlayers: InnerTubeContext_ActivePlayerInfo[];
}
export interface InnerTubeContext_ExperimentalData {
params: KeyValuePair[];
}
export interface InnerTubeContext_ActivePlayerInfo {
playerContextParams?: Uint8Array | undefined;
}
export interface InnerTubeContext_ClickTrackingInfo {
clickTrackingParams?: Uint8Array | undefined;
}
export interface InnerTubeContext_AdSignalsInfo {
params: KeyValuePair[];
bid?: string | undefined;
mutsuId?: string | undefined;
consentBumpState?: string | undefined;
advertisingId?: string | undefined;
limitAdTracking?: boolean | undefined;
attributionOsSupportedVersion?: string | undefined;
}
export declare const InnerTubeContext: MessageFns<InnerTubeContext>;
export declare const InnerTubeContext_ExperimentalData: MessageFns<InnerTubeContext_ExperimentalData>;
export declare const InnerTubeContext_ActivePlayerInfo: MessageFns<InnerTubeContext_ActivePlayerInfo>;
export declare const InnerTubeContext_ClickTrackingInfo: MessageFns<InnerTubeContext_ClickTrackingInfo>;
export declare const InnerTubeContext_AdSignalsInfo: MessageFns<InnerTubeContext_AdSignalsInfo>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,360 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/innertube_context.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { KeyValuePair } from "../../../misc/common.js";
import { CapabilityInfo } from "./capability_info.js";
import { ClientInfo } from "./client_info.js";
import { RequestInfo } from "./request_info.js";
import { ThirdPartyInfo } from "./third_party_info.js";
import { UserInfo } from "./user_info.js";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBaseInnerTubeContext() {
return {
client: undefined,
user: undefined,
capabilities: undefined,
request: undefined,
clickTracking: undefined,
thirdParty: undefined,
remoteClient: undefined,
adSignalsInfo: undefined,
experimentalData: undefined,
clientScreenNonce: undefined,
activePlayers: [],
};
}
export const InnerTubeContext = {
encode(message, writer = new BinaryWriter()) {
if (message.client !== undefined) {
ClientInfo.encode(message.client, writer.uint32(10).fork()).join();
}
if (message.user !== undefined) {
UserInfo.encode(message.user, writer.uint32(26).fork()).join();
}
if (message.capabilities !== undefined) {
CapabilityInfo.encode(message.capabilities, writer.uint32(34).fork()).join();
}
if (message.request !== undefined) {
RequestInfo.encode(message.request, writer.uint32(42).fork()).join();
}
if (message.clickTracking !== undefined) {
InnerTubeContext_ClickTrackingInfo.encode(message.clickTracking, writer.uint32(50).fork()).join();
}
if (message.thirdParty !== undefined) {
ThirdPartyInfo.encode(message.thirdParty, writer.uint32(58).fork()).join();
}
if (message.remoteClient !== undefined) {
ClientInfo.encode(message.remoteClient, writer.uint32(66).fork()).join();
}
if (message.adSignalsInfo !== undefined) {
InnerTubeContext_AdSignalsInfo.encode(message.adSignalsInfo, writer.uint32(74).fork()).join();
}
if (message.experimentalData !== undefined) {
InnerTubeContext_ExperimentalData.encode(message.experimentalData, writer.uint32(82).fork()).join();
}
if (message.clientScreenNonce !== undefined) {
writer.uint32(90).string(message.clientScreenNonce);
}
for (const v of message.activePlayers) {
InnerTubeContext_ActivePlayerInfo.encode(v, writer.uint32(98).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseInnerTubeContext();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.client = ClientInfo.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.user = UserInfo.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.capabilities = CapabilityInfo.decode(reader, reader.uint32());
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.request = RequestInfo.decode(reader, reader.uint32());
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.clickTracking = InnerTubeContext_ClickTrackingInfo.decode(reader, reader.uint32());
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.thirdParty = ThirdPartyInfo.decode(reader, reader.uint32());
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.remoteClient = ClientInfo.decode(reader, reader.uint32());
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.adSignalsInfo = InnerTubeContext_AdSignalsInfo.decode(reader, reader.uint32());
continue;
}
case 10: {
if (tag !== 82) {
break;
}
message.experimentalData = InnerTubeContext_ExperimentalData.decode(reader, reader.uint32());
continue;
}
case 11: {
if (tag !== 90) {
break;
}
message.clientScreenNonce = reader.string();
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.activePlayers.push(InnerTubeContext_ActivePlayerInfo.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseInnerTubeContext_ExperimentalData() {
return { params: [] };
}
export const InnerTubeContext_ExperimentalData = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.params) {
KeyValuePair.encode(v, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseInnerTubeContext_ExperimentalData();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.params.push(KeyValuePair.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseInnerTubeContext_ActivePlayerInfo() {
return { playerContextParams: undefined };
}
export const InnerTubeContext_ActivePlayerInfo = {
encode(message, writer = new BinaryWriter()) {
if (message.playerContextParams !== undefined) {
writer.uint32(10).bytes(message.playerContextParams);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseInnerTubeContext_ActivePlayerInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.playerContextParams = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseInnerTubeContext_ClickTrackingInfo() {
return { clickTrackingParams: undefined };
}
export const InnerTubeContext_ClickTrackingInfo = {
encode(message, writer = new BinaryWriter()) {
if (message.clickTrackingParams !== undefined) {
writer.uint32(18).bytes(message.clickTrackingParams);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseInnerTubeContext_ClickTrackingInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2: {
if (tag !== 18) {
break;
}
message.clickTrackingParams = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseInnerTubeContext_AdSignalsInfo() {
return {
params: [],
bid: undefined,
mutsuId: undefined,
consentBumpState: undefined,
advertisingId: undefined,
limitAdTracking: undefined,
attributionOsSupportedVersion: undefined,
};
}
export const InnerTubeContext_AdSignalsInfo = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.params) {
KeyValuePair.encode(v, writer.uint32(10).fork()).join();
}
if (message.bid !== undefined) {
writer.uint32(18).string(message.bid);
}
if (message.mutsuId !== undefined) {
writer.uint32(26).string(message.mutsuId);
}
if (message.consentBumpState !== undefined) {
writer.uint32(34).string(message.consentBumpState);
}
if (message.advertisingId !== undefined) {
writer.uint32(58).string(message.advertisingId);
}
if (message.limitAdTracking !== undefined) {
writer.uint32(72).bool(message.limitAdTracking);
}
if (message.attributionOsSupportedVersion !== undefined) {
writer.uint32(82).string(message.attributionOsSupportedVersion);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseInnerTubeContext_AdSignalsInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.params.push(KeyValuePair.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.bid = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.mutsuId = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.consentBumpState = reader.string();
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.advertisingId = reader.string();
continue;
}
case 9: {
if (tag !== 72) {
break;
}
message.limitAdTracking = reader.bool();
continue;
}
case 10: {
if (tag !== 82) {
break;
}
message.attributionOsSupportedVersion = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=innertube_context.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,80 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InnerTubeContext } from "./innertube_context.js";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface MetadataUpdateRequest {
context?: InnerTubeContext | undefined;
encryptedVideoId?: string | undefined;
title?: MetadataUpdateRequest_MdeTitleUpdateRequest | undefined;
description?: MetadataUpdateRequest_MdeDescriptionUpdateRequest | undefined;
privacy?: MetadataUpdateRequest_MdePrivacyUpdateRequest | undefined;
tags?: MetadataUpdateRequest_MdeTagsUpdateRequest | undefined;
category?: MetadataUpdateRequest_MdeCategoryUpdateRequest | undefined;
license?: MetadataUpdateRequest_MdeLicenseUpdateRequest | undefined;
ageRestriction?: MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest | undefined;
videoStill?: MetadataUpdateRequest_MdeVideoStillRequestParams | undefined;
madeForKids?: MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams | undefined;
racy?: MetadataUpdateRequest_MdeRacyRequestParams | undefined;
}
export interface MetadataUpdateRequest_MdeTitleUpdateRequest {
newTitle?: string | undefined;
}
export interface MetadataUpdateRequest_MdeDescriptionUpdateRequest {
newDescription?: string | undefined;
}
export interface MetadataUpdateRequest_MdePrivacyUpdateRequest {
newPrivacy?: number | undefined;
clearPrivacyDraft?: boolean | undefined;
}
export interface MetadataUpdateRequest_MdeTagsUpdateRequest {
newTags: string[];
}
export interface MetadataUpdateRequest_MdeCategoryUpdateRequest {
newCategoryId?: number | undefined;
}
export interface MetadataUpdateRequest_MdeLicenseUpdateRequest {
newLicenseId?: string | undefined;
}
export interface MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams {
operation?: number | undefined;
newMfk?: number | undefined;
}
export interface MetadataUpdateRequest_MdeRacyRequestParams {
operation?: number | undefined;
newRacy?: number | undefined;
}
export interface MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest {
newIsAgeRestricted?: boolean | undefined;
}
export interface MetadataUpdateRequest_MdeVideoStillRequestParams {
operation?: number | undefined;
newStillId?: number | undefined;
image?: MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage | undefined;
testImage?: MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage | undefined;
experimentImage: MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData[];
}
export interface MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData {
image?: MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage | undefined;
}
export interface MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage {
rawBytes?: Uint8Array | undefined;
dataUri?: string | undefined;
frameTimestampUs?: number | undefined;
isVertical?: boolean | undefined;
}
export declare const MetadataUpdateRequest: MessageFns<MetadataUpdateRequest>;
export declare const MetadataUpdateRequest_MdeTitleUpdateRequest: MessageFns<MetadataUpdateRequest_MdeTitleUpdateRequest>;
export declare const MetadataUpdateRequest_MdeDescriptionUpdateRequest: MessageFns<MetadataUpdateRequest_MdeDescriptionUpdateRequest>;
export declare const MetadataUpdateRequest_MdePrivacyUpdateRequest: MessageFns<MetadataUpdateRequest_MdePrivacyUpdateRequest>;
export declare const MetadataUpdateRequest_MdeTagsUpdateRequest: MessageFns<MetadataUpdateRequest_MdeTagsUpdateRequest>;
export declare const MetadataUpdateRequest_MdeCategoryUpdateRequest: MessageFns<MetadataUpdateRequest_MdeCategoryUpdateRequest>;
export declare const MetadataUpdateRequest_MdeLicenseUpdateRequest: MessageFns<MetadataUpdateRequest_MdeLicenseUpdateRequest>;
export declare const MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams: MessageFns<MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams>;
export declare const MetadataUpdateRequest_MdeRacyRequestParams: MessageFns<MetadataUpdateRequest_MdeRacyRequestParams>;
export declare const MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest: MessageFns<MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest>;
export declare const MetadataUpdateRequest_MdeVideoStillRequestParams: MessageFns<MetadataUpdateRequest_MdeVideoStillRequestParams>;
export declare const MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData: MessageFns<MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData>;
export declare const MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage: MessageFns<MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,675 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/metadata_update_request.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InnerTubeContext } from "./innertube_context.js";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBaseMetadataUpdateRequest() {
return {
context: undefined,
encryptedVideoId: undefined,
title: undefined,
description: undefined,
privacy: undefined,
tags: undefined,
category: undefined,
license: undefined,
ageRestriction: undefined,
videoStill: undefined,
madeForKids: undefined,
racy: undefined,
};
}
export const MetadataUpdateRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.context !== undefined) {
InnerTubeContext.encode(message.context, writer.uint32(10).fork()).join();
}
if (message.encryptedVideoId !== undefined) {
writer.uint32(18).string(message.encryptedVideoId);
}
if (message.title !== undefined) {
MetadataUpdateRequest_MdeTitleUpdateRequest.encode(message.title, writer.uint32(26).fork()).join();
}
if (message.description !== undefined) {
MetadataUpdateRequest_MdeDescriptionUpdateRequest.encode(message.description, writer.uint32(34).fork()).join();
}
if (message.privacy !== undefined) {
MetadataUpdateRequest_MdePrivacyUpdateRequest.encode(message.privacy, writer.uint32(42).fork()).join();
}
if (message.tags !== undefined) {
MetadataUpdateRequest_MdeTagsUpdateRequest.encode(message.tags, writer.uint32(50).fork()).join();
}
if (message.category !== undefined) {
MetadataUpdateRequest_MdeCategoryUpdateRequest.encode(message.category, writer.uint32(58).fork()).join();
}
if (message.license !== undefined) {
MetadataUpdateRequest_MdeLicenseUpdateRequest.encode(message.license, writer.uint32(66).fork()).join();
}
if (message.ageRestriction !== undefined) {
MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest.encode(message.ageRestriction, writer.uint32(90).fork())
.join();
}
if (message.videoStill !== undefined) {
MetadataUpdateRequest_MdeVideoStillRequestParams.encode(message.videoStill, writer.uint32(162).fork()).join();
}
if (message.madeForKids !== undefined) {
MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams.encode(message.madeForKids, writer.uint32(546).fork())
.join();
}
if (message.racy !== undefined) {
MetadataUpdateRequest_MdeRacyRequestParams.encode(message.racy, writer.uint32(554).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.context = InnerTubeContext.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.encryptedVideoId = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.title = MetadataUpdateRequest_MdeTitleUpdateRequest.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.description = MetadataUpdateRequest_MdeDescriptionUpdateRequest.decode(reader, reader.uint32());
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.privacy = MetadataUpdateRequest_MdePrivacyUpdateRequest.decode(reader, reader.uint32());
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.tags = MetadataUpdateRequest_MdeTagsUpdateRequest.decode(reader, reader.uint32());
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.category = MetadataUpdateRequest_MdeCategoryUpdateRequest.decode(reader, reader.uint32());
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.license = MetadataUpdateRequest_MdeLicenseUpdateRequest.decode(reader, reader.uint32());
continue;
}
case 11: {
if (tag !== 90) {
break;
}
message.ageRestriction = MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest.decode(reader, reader.uint32());
continue;
}
case 20: {
if (tag !== 162) {
break;
}
message.videoStill = MetadataUpdateRequest_MdeVideoStillRequestParams.decode(reader, reader.uint32());
continue;
}
case 68: {
if (tag !== 546) {
break;
}
message.madeForKids = MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams.decode(reader, reader.uint32());
continue;
}
case 69: {
if (tag !== 554) {
break;
}
message.racy = MetadataUpdateRequest_MdeRacyRequestParams.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeTitleUpdateRequest() {
return { newTitle: undefined };
}
export const MetadataUpdateRequest_MdeTitleUpdateRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.newTitle !== undefined) {
writer.uint32(10).string(message.newTitle);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeTitleUpdateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.newTitle = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeDescriptionUpdateRequest() {
return { newDescription: undefined };
}
export const MetadataUpdateRequest_MdeDescriptionUpdateRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.newDescription !== undefined) {
writer.uint32(10).string(message.newDescription);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeDescriptionUpdateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.newDescription = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdePrivacyUpdateRequest() {
return { newPrivacy: undefined, clearPrivacyDraft: undefined };
}
export const MetadataUpdateRequest_MdePrivacyUpdateRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.newPrivacy !== undefined) {
writer.uint32(8).int32(message.newPrivacy);
}
if (message.clearPrivacyDraft !== undefined) {
writer.uint32(16).bool(message.clearPrivacyDraft);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdePrivacyUpdateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.newPrivacy = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.clearPrivacyDraft = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeTagsUpdateRequest() {
return { newTags: [] };
}
export const MetadataUpdateRequest_MdeTagsUpdateRequest = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.newTags) {
writer.uint32(10).string(v);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeTagsUpdateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.newTags.push(reader.string());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeCategoryUpdateRequest() {
return { newCategoryId: undefined };
}
export const MetadataUpdateRequest_MdeCategoryUpdateRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.newCategoryId !== undefined) {
writer.uint32(8).int32(message.newCategoryId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeCategoryUpdateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.newCategoryId = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeLicenseUpdateRequest() {
return { newLicenseId: undefined };
}
export const MetadataUpdateRequest_MdeLicenseUpdateRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.newLicenseId !== undefined) {
writer.uint32(10).string(message.newLicenseId);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeLicenseUpdateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.newLicenseId = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams() {
return { operation: undefined, newMfk: undefined };
}
export const MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams = {
encode(message, writer = new BinaryWriter()) {
if (message.operation !== undefined) {
writer.uint32(8).int32(message.operation);
}
if (message.newMfk !== undefined) {
writer.uint32(16).int32(message.newMfk);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.operation = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.newMfk = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeRacyRequestParams() {
return { operation: undefined, newRacy: undefined };
}
export const MetadataUpdateRequest_MdeRacyRequestParams = {
encode(message, writer = new BinaryWriter()) {
if (message.operation !== undefined) {
writer.uint32(8).int32(message.operation);
}
if (message.newRacy !== undefined) {
writer.uint32(16).int32(message.newRacy);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeRacyRequestParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.operation = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.newRacy = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeAgeRestrictionUpdateRequest() {
return { newIsAgeRestricted: undefined };
}
export const MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.newIsAgeRestricted !== undefined) {
writer.uint32(8).bool(message.newIsAgeRestricted);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeAgeRestrictionUpdateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.newIsAgeRestricted = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeVideoStillRequestParams() {
return { operation: undefined, newStillId: undefined, image: undefined, testImage: undefined, experimentImage: [] };
}
export const MetadataUpdateRequest_MdeVideoStillRequestParams = {
encode(message, writer = new BinaryWriter()) {
if (message.operation !== undefined) {
writer.uint32(8).int32(message.operation);
}
if (message.newStillId !== undefined) {
writer.uint32(16).int32(message.newStillId);
}
if (message.image !== undefined) {
MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.encode(message.image, writer.uint32(26).fork()).join();
}
if (message.testImage !== undefined) {
MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.encode(message.testImage, writer.uint32(34).fork()).join();
}
for (const v of message.experimentImage) {
MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData.encode(v, writer.uint32(50).fork())
.join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeVideoStillRequestParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.operation = reader.int32();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.newStillId = reader.int32();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.image = MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.testImage = MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.decode(reader, reader.uint32());
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.experimentImage.push(MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData() {
return { image: undefined };
}
export const MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData = {
encode(message, writer = new BinaryWriter()) {
if (message.image !== undefined) {
MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.encode(message.image, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.image = MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseMetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage() {
return { rawBytes: undefined, dataUri: undefined, frameTimestampUs: undefined, isVertical: undefined };
}
export const MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage = {
encode(message, writer = new BinaryWriter()) {
if (message.rawBytes !== undefined) {
writer.uint32(10).bytes(message.rawBytes);
}
if (message.dataUri !== undefined) {
writer.uint32(18).string(message.dataUri);
}
if (message.frameTimestampUs !== undefined) {
writer.uint32(32).int64(message.frameTimestampUs);
}
if (message.isVertical !== undefined) {
writer.uint32(40).bool(message.isVertical);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.rawBytes = reader.bytes();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.dataUri = reader.string();
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.frameTimestampUs = longToNumber(reader.int64());
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.isVertical = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function longToNumber(int64) {
const num = globalThis.Number(int64.toString());
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
}
return num;
}
//# sourceMappingURL=metadata_update_request.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,61 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface PlaybackContext {
contentPlaybackContext?: PlaybackContext_ContentPlaybackContext | undefined;
}
export interface PlaybackContext_ContentPlaybackContext {
deviceSignals?: string | undefined;
revShareClientId?: string | undefined;
timeSinceLastAdSeconds?: number | undefined;
lactMilliseconds?: number | undefined;
autoplaysSinceLastAd?: number | undefined;
vis?: number | undefined;
fling?: boolean | undefined;
splay?: boolean | undefined;
autoplay?: boolean | undefined;
timeOfLastInstreamPrerollAd?: number | undefined;
currentUrl?: string | undefined;
referer?: string | undefined;
loadAnnotationsByDemand?: boolean | undefined;
autoCaptionsDefaultOn?: boolean | undefined;
/** optional ForceAdParameters force_ad_parameters = 25; */
slicedBread?: boolean | undefined;
autonav?: boolean | undefined;
trailer?: boolean | undefined;
/**
* optional MdxPlaybackContext mdx_context = 31;
* optional LivePlaybackContext live_context = 32;
*/
playerWidthPixels?: number | undefined;
playerHeightPixels?: number | undefined;
/** optional Html5Preference html5_preference = 36; */
snd?: number | undefined;
vnd?: number | undefined;
/** optional UnpluggedContentPlaybackContext unplugged_context = 40; */
uao?: number | undefined;
mutedAutoplay?: boolean | undefined;
/** optional AutonavSettingsState autonav_state = 45; */
enablePrivacyFilter?: boolean | undefined;
isLivingRoomDeeplink?: boolean | undefined;
signatureTimestamp?: number | undefined;
/** optional TrailerPlaybackContext trailer_context = 49; */
isInlinePlaybackNoAd?: boolean | undefined;
isInlineUnmutedPlayback?: boolean | undefined;
/**
* optional CustomTabContext custom_tab_context = 52;
* optional VideoPlaybackPosition player_playback_position = 54;
*/
playPackageVersion?: number | undefined;
/**
* optional CoWatchPlaybackContext co_watch_context = 56;
* optional WatchAmbientModePlaybackContext watch_ambient_mode_context = 57;
* optional CompositeVideoPlaybackContext composite_video_context = 58;
*/
isSequenceEntry?: boolean | undefined;
}
export declare const PlaybackContext: MessageFns<PlaybackContext>;
export declare const PlaybackContext_ContentPlaybackContext: MessageFns<PlaybackContext_ContentPlaybackContext>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,406 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/playback_context.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBasePlaybackContext() {
return { contentPlaybackContext: undefined };
}
export const PlaybackContext = {
encode(message, writer = new BinaryWriter()) {
if (message.contentPlaybackContext !== undefined) {
PlaybackContext_ContentPlaybackContext.encode(message.contentPlaybackContext, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePlaybackContext();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.contentPlaybackContext = PlaybackContext_ContentPlaybackContext.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBasePlaybackContext_ContentPlaybackContext() {
return {
deviceSignals: undefined,
revShareClientId: undefined,
timeSinceLastAdSeconds: undefined,
lactMilliseconds: undefined,
autoplaysSinceLastAd: undefined,
vis: undefined,
fling: undefined,
splay: undefined,
autoplay: undefined,
timeOfLastInstreamPrerollAd: undefined,
currentUrl: undefined,
referer: undefined,
loadAnnotationsByDemand: undefined,
autoCaptionsDefaultOn: undefined,
slicedBread: undefined,
autonav: undefined,
trailer: undefined,
playerWidthPixels: undefined,
playerHeightPixels: undefined,
snd: undefined,
vnd: undefined,
uao: undefined,
mutedAutoplay: undefined,
enablePrivacyFilter: undefined,
isLivingRoomDeeplink: undefined,
signatureTimestamp: undefined,
isInlinePlaybackNoAd: undefined,
isInlineUnmutedPlayback: undefined,
playPackageVersion: undefined,
isSequenceEntry: undefined,
};
}
export const PlaybackContext_ContentPlaybackContext = {
encode(message, writer = new BinaryWriter()) {
if (message.deviceSignals !== undefined) {
writer.uint32(10).string(message.deviceSignals);
}
if (message.revShareClientId !== undefined) {
writer.uint32(26).string(message.revShareClientId);
}
if (message.timeSinceLastAdSeconds !== undefined) {
writer.uint32(32).uint32(message.timeSinceLastAdSeconds);
}
if (message.lactMilliseconds !== undefined) {
writer.uint32(40).int64(message.lactMilliseconds);
}
if (message.autoplaysSinceLastAd !== undefined) {
writer.uint32(48).uint32(message.autoplaysSinceLastAd);
}
if (message.vis !== undefined) {
writer.uint32(64).uint32(message.vis);
}
if (message.fling !== undefined) {
writer.uint32(72).bool(message.fling);
}
if (message.splay !== undefined) {
writer.uint32(80).bool(message.splay);
}
if (message.autoplay !== undefined) {
writer.uint32(88).bool(message.autoplay);
}
if (message.timeOfLastInstreamPrerollAd !== undefined) {
writer.uint32(104).uint64(message.timeOfLastInstreamPrerollAd);
}
if (message.currentUrl !== undefined) {
writer.uint32(122).string(message.currentUrl);
}
if (message.referer !== undefined) {
writer.uint32(130).string(message.referer);
}
if (message.loadAnnotationsByDemand !== undefined) {
writer.uint32(184).bool(message.loadAnnotationsByDemand);
}
if (message.autoCaptionsDefaultOn !== undefined) {
writer.uint32(192).bool(message.autoCaptionsDefaultOn);
}
if (message.slicedBread !== undefined) {
writer.uint32(216).bool(message.slicedBread);
}
if (message.autonav !== undefined) {
writer.uint32(232).bool(message.autonav);
}
if (message.trailer !== undefined) {
writer.uint32(240).bool(message.trailer);
}
if (message.playerWidthPixels !== undefined) {
writer.uint32(272).int32(message.playerWidthPixels);
}
if (message.playerHeightPixels !== undefined) {
writer.uint32(280).int32(message.playerHeightPixels);
}
if (message.snd !== undefined) {
writer.uint32(296).int32(message.snd);
}
if (message.vnd !== undefined) {
writer.uint32(304).int32(message.vnd);
}
if (message.uao !== undefined) {
writer.uint32(328).int32(message.uao);
}
if (message.mutedAutoplay !== undefined) {
writer.uint32(352).bool(message.mutedAutoplay);
}
if (message.enablePrivacyFilter !== undefined) {
writer.uint32(368).bool(message.enablePrivacyFilter);
}
if (message.isLivingRoomDeeplink !== undefined) {
writer.uint32(376).bool(message.isLivingRoomDeeplink);
}
if (message.signatureTimestamp !== undefined) {
writer.uint32(384).uint32(message.signatureTimestamp);
}
if (message.isInlinePlaybackNoAd !== undefined) {
writer.uint32(400).bool(message.isInlinePlaybackNoAd);
}
if (message.isInlineUnmutedPlayback !== undefined) {
writer.uint32(408).bool(message.isInlineUnmutedPlayback);
}
if (message.playPackageVersion !== undefined) {
writer.uint32(440).int64(message.playPackageVersion);
}
if (message.isSequenceEntry !== undefined) {
writer.uint32(480).bool(message.isSequenceEntry);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePlaybackContext_ContentPlaybackContext();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.deviceSignals = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.revShareClientId = reader.string();
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.timeSinceLastAdSeconds = reader.uint32();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.lactMilliseconds = longToNumber(reader.int64());
continue;
}
case 6: {
if (tag !== 48) {
break;
}
message.autoplaysSinceLastAd = reader.uint32();
continue;
}
case 8: {
if (tag !== 64) {
break;
}
message.vis = reader.uint32();
continue;
}
case 9: {
if (tag !== 72) {
break;
}
message.fling = reader.bool();
continue;
}
case 10: {
if (tag !== 80) {
break;
}
message.splay = reader.bool();
continue;
}
case 11: {
if (tag !== 88) {
break;
}
message.autoplay = reader.bool();
continue;
}
case 13: {
if (tag !== 104) {
break;
}
message.timeOfLastInstreamPrerollAd = longToNumber(reader.uint64());
continue;
}
case 15: {
if (tag !== 122) {
break;
}
message.currentUrl = reader.string();
continue;
}
case 16: {
if (tag !== 130) {
break;
}
message.referer = reader.string();
continue;
}
case 23: {
if (tag !== 184) {
break;
}
message.loadAnnotationsByDemand = reader.bool();
continue;
}
case 24: {
if (tag !== 192) {
break;
}
message.autoCaptionsDefaultOn = reader.bool();
continue;
}
case 27: {
if (tag !== 216) {
break;
}
message.slicedBread = reader.bool();
continue;
}
case 29: {
if (tag !== 232) {
break;
}
message.autonav = reader.bool();
continue;
}
case 30: {
if (tag !== 240) {
break;
}
message.trailer = reader.bool();
continue;
}
case 34: {
if (tag !== 272) {
break;
}
message.playerWidthPixels = reader.int32();
continue;
}
case 35: {
if (tag !== 280) {
break;
}
message.playerHeightPixels = reader.int32();
continue;
}
case 37: {
if (tag !== 296) {
break;
}
message.snd = reader.int32();
continue;
}
case 38: {
if (tag !== 304) {
break;
}
message.vnd = reader.int32();
continue;
}
case 41: {
if (tag !== 328) {
break;
}
message.uao = reader.int32();
continue;
}
case 44: {
if (tag !== 352) {
break;
}
message.mutedAutoplay = reader.bool();
continue;
}
case 46: {
if (tag !== 368) {
break;
}
message.enablePrivacyFilter = reader.bool();
continue;
}
case 47: {
if (tag !== 376) {
break;
}
message.isLivingRoomDeeplink = reader.bool();
continue;
}
case 48: {
if (tag !== 384) {
break;
}
message.signatureTimestamp = reader.uint32();
continue;
}
case 50: {
if (tag !== 400) {
break;
}
message.isInlinePlaybackNoAd = reader.bool();
continue;
}
case 51: {
if (tag !== 408) {
break;
}
message.isInlineUnmutedPlayback = reader.bool();
continue;
}
case 55: {
if (tag !== 440) {
break;
}
message.playPackageVersion = longToNumber(reader.int64());
continue;
}
case 60: {
if (tag !== 480) {
break;
}
message.isSequenceEntry = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function longToNumber(int64) {
const num = globalThis.Number(int64.toString());
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
}
return num;
}
//# sourceMappingURL=playback_context.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,15 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface PlayerAttestationRequestData {
iosguardRequest?: PlayerAttestationRequestData_IosguardChallengeRequestData | undefined;
omitBotguardData?: boolean | undefined;
}
export interface PlayerAttestationRequestData_IosguardChallengeRequestData {
challengeRequest?: Uint8Array | undefined;
}
export declare const PlayerAttestationRequestData: MessageFns<PlayerAttestationRequestData>;
export declare const PlayerAttestationRequestData_IosguardChallengeRequestData: MessageFns<PlayerAttestationRequestData_IosguardChallengeRequestData>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,85 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/player_attestation_request_data.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBasePlayerAttestationRequestData() {
return { iosguardRequest: undefined, omitBotguardData: undefined };
}
export const PlayerAttestationRequestData = {
encode(message, writer = new BinaryWriter()) {
if (message.iosguardRequest !== undefined) {
PlayerAttestationRequestData_IosguardChallengeRequestData.encode(message.iosguardRequest, writer.uint32(10).fork()).join();
}
if (message.omitBotguardData !== undefined) {
writer.uint32(16).bool(message.omitBotguardData);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePlayerAttestationRequestData();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.iosguardRequest = PlayerAttestationRequestData_IosguardChallengeRequestData.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.omitBotguardData = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBasePlayerAttestationRequestData_IosguardChallengeRequestData() {
return { challengeRequest: undefined };
}
export const PlayerAttestationRequestData_IosguardChallengeRequestData = {
encode(message, writer = new BinaryWriter()) {
if (message.challengeRequest !== undefined) {
writer.uint32(10).bytes(message.challengeRequest);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePlayerAttestationRequestData_IosguardChallengeRequestData();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.challengeRequest = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=player_attestation_request_data.js.map
@@ -0,0 +1 @@
{"version":3,"file":"player_attestation_request_data.js","sourceRoot":"","sources":["../../../../../../protos/generated/youtube/api/pfiinnertube/player_attestation_request_data.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,yEAAyE;AAEzE,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAW1D,SAAS,sCAAsC;IAC7C,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC;AACrE,CAAC;AAED,MAAM,CAAC,MAAM,4BAA4B,GAA6C;IACpF,MAAM,CAAC,OAAqC,EAAE,SAAuB,IAAI,YAAY,EAAE;QACrF,IAAI,OAAO,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YAC1C,yDAAyD,CAAC,MAAM,CAC9D,OAAO,CAAC,eAAe,EACvB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CACzB,CAAC,IAAI,EAAE,CAAC;QACX,CAAC;QACD,IAAI,OAAO,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;YAC3C,MAAM,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M,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
@@ -0,0 +1,39 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InnerTubeContext } from "./innertube_context.js";
import { PlaybackContext } from "./playback_context.js";
import { PlayerAttestationRequestData } from "./player_attestation_request_data.js";
import { PlayerRequestCaptionParams } from "./player_request_caption_params.js";
import { ServiceIntegrityDimensions } from "./service_integrity_dimensions.js";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface PlayerRequest {
context?: InnerTubeContext | undefined;
videoId?: string | undefined;
contentCheckOk?: boolean | undefined;
playbackContext?: PlaybackContext | undefined;
racyCheckOk?: boolean | undefined;
id?: string | undefined;
t?: string | undefined;
forOffline?: boolean | undefined;
playlistId?: string | undefined;
playlistIndex?: number | undefined;
startTimeSecs?: number | undefined;
params?: string | undefined;
offlineSharingWrappedKey?: Uint8Array | undefined;
attestationRequest?: PlayerAttestationRequestData | undefined;
referringApp?: string | undefined;
referrer?: string | undefined;
serializedThirdPartyEmbedConfig?: string | undefined;
proxiedByOnesie?: boolean | undefined;
hostAppToken?: string | undefined;
cpn?: string | undefined;
overrideMutedAtStart?: boolean | undefined;
captionParams?: PlayerRequestCaptionParams | undefined;
serviceIntegrityDimensions?: ServiceIntegrityDimensions | undefined;
/** optional VideoQualitySetting video_quality_setting_params = 28; */
deferredPlayerToken?: Uint8Array | undefined;
}
export declare const PlayerRequest: MessageFns<PlayerRequest>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,302 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/player_request.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InnerTubeContext } from "./innertube_context.js";
import { PlaybackContext } from "./playback_context.js";
import { PlayerAttestationRequestData } from "./player_attestation_request_data.js";
import { PlayerRequestCaptionParams } from "./player_request_caption_params.js";
import { ServiceIntegrityDimensions } from "./service_integrity_dimensions.js";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBasePlayerRequest() {
return {
context: undefined,
videoId: undefined,
contentCheckOk: undefined,
playbackContext: undefined,
racyCheckOk: undefined,
id: undefined,
t: undefined,
forOffline: undefined,
playlistId: undefined,
playlistIndex: undefined,
startTimeSecs: undefined,
params: undefined,
offlineSharingWrappedKey: undefined,
attestationRequest: undefined,
referringApp: undefined,
referrer: undefined,
serializedThirdPartyEmbedConfig: undefined,
proxiedByOnesie: undefined,
hostAppToken: undefined,
cpn: undefined,
overrideMutedAtStart: undefined,
captionParams: undefined,
serviceIntegrityDimensions: undefined,
deferredPlayerToken: undefined,
};
}
export const PlayerRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.context !== undefined) {
InnerTubeContext.encode(message.context, writer.uint32(10).fork()).join();
}
if (message.videoId !== undefined) {
writer.uint32(18).string(message.videoId);
}
if (message.contentCheckOk !== undefined) {
writer.uint32(24).bool(message.contentCheckOk);
}
if (message.playbackContext !== undefined) {
PlaybackContext.encode(message.playbackContext, writer.uint32(34).fork()).join();
}
if (message.racyCheckOk !== undefined) {
writer.uint32(40).bool(message.racyCheckOk);
}
if (message.id !== undefined) {
writer.uint32(50).string(message.id);
}
if (message.t !== undefined) {
writer.uint32(58).string(message.t);
}
if (message.forOffline !== undefined) {
writer.uint32(64).bool(message.forOffline);
}
if (message.playlistId !== undefined) {
writer.uint32(74).string(message.playlistId);
}
if (message.playlistIndex !== undefined) {
writer.uint32(80).int32(message.playlistIndex);
}
if (message.startTimeSecs !== undefined) {
writer.uint32(88).uint32(message.startTimeSecs);
}
if (message.params !== undefined) {
writer.uint32(98).string(message.params);
}
if (message.offlineSharingWrappedKey !== undefined) {
writer.uint32(114).bytes(message.offlineSharingWrappedKey);
}
if (message.attestationRequest !== undefined) {
PlayerAttestationRequestData.encode(message.attestationRequest, writer.uint32(130).fork()).join();
}
if (message.referringApp !== undefined) {
writer.uint32(138).string(message.referringApp);
}
if (message.referrer !== undefined) {
writer.uint32(146).string(message.referrer);
}
if (message.serializedThirdPartyEmbedConfig !== undefined) {
writer.uint32(154).string(message.serializedThirdPartyEmbedConfig);
}
if (message.proxiedByOnesie !== undefined) {
writer.uint32(160).bool(message.proxiedByOnesie);
}
if (message.hostAppToken !== undefined) {
writer.uint32(178).string(message.hostAppToken);
}
if (message.cpn !== undefined) {
writer.uint32(186).string(message.cpn);
}
if (message.overrideMutedAtStart !== undefined) {
writer.uint32(200).bool(message.overrideMutedAtStart);
}
if (message.captionParams !== undefined) {
PlayerRequestCaptionParams.encode(message.captionParams, writer.uint32(210).fork()).join();
}
if (message.serviceIntegrityDimensions !== undefined) {
ServiceIntegrityDimensions.encode(message.serviceIntegrityDimensions, writer.uint32(218).fork()).join();
}
if (message.deferredPlayerToken !== undefined) {
writer.uint32(234).bytes(message.deferredPlayerToken);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePlayerRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.context = InnerTubeContext.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.videoId = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.contentCheckOk = reader.bool();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.playbackContext = PlaybackContext.decode(reader, reader.uint32());
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.racyCheckOk = reader.bool();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.id = reader.string();
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.t = reader.string();
continue;
}
case 8: {
if (tag !== 64) {
break;
}
message.forOffline = reader.bool();
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.playlistId = reader.string();
continue;
}
case 10: {
if (tag !== 80) {
break;
}
message.playlistIndex = reader.int32();
continue;
}
case 11: {
if (tag !== 88) {
break;
}
message.startTimeSecs = reader.uint32();
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.params = reader.string();
continue;
}
case 14: {
if (tag !== 114) {
break;
}
message.offlineSharingWrappedKey = reader.bytes();
continue;
}
case 16: {
if (tag !== 130) {
break;
}
message.attestationRequest = PlayerAttestationRequestData.decode(reader, reader.uint32());
continue;
}
case 17: {
if (tag !== 138) {
break;
}
message.referringApp = reader.string();
continue;
}
case 18: {
if (tag !== 146) {
break;
}
message.referrer = reader.string();
continue;
}
case 19: {
if (tag !== 154) {
break;
}
message.serializedThirdPartyEmbedConfig = reader.string();
continue;
}
case 20: {
if (tag !== 160) {
break;
}
message.proxiedByOnesie = reader.bool();
continue;
}
case 22: {
if (tag !== 178) {
break;
}
message.hostAppToken = reader.string();
continue;
}
case 23: {
if (tag !== 186) {
break;
}
message.cpn = reader.string();
continue;
}
case 25: {
if (tag !== 200) {
break;
}
message.overrideMutedAtStart = reader.bool();
continue;
}
case 26: {
if (tag !== 210) {
break;
}
message.captionParams = PlayerRequestCaptionParams.decode(reader, reader.uint32());
continue;
}
case 27: {
if (tag !== 218) {
break;
}
message.serviceIntegrityDimensions = ServiceIntegrityDimensions.decode(reader, reader.uint32());
continue;
}
case 29: {
if (tag !== 234) {
break;
}
message.deferredPlayerToken = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=player_request.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface PlayerRequestCaptionParams {
deviceCaptionsOn?: boolean | undefined;
deviceCaptionsLangPref?: string | undefined;
viewerSelectedCaptionLangs?: string | undefined;
ccLangPref?: string | undefined;
ccLoadPolicyOn?: boolean | undefined;
}
export declare const PlayerRequestCaptionParams: MessageFns<PlayerRequestCaptionParams>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,88 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/player_request_caption_params.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBasePlayerRequestCaptionParams() {
return {
deviceCaptionsOn: undefined,
deviceCaptionsLangPref: undefined,
viewerSelectedCaptionLangs: undefined,
ccLangPref: undefined,
ccLoadPolicyOn: undefined,
};
}
export const PlayerRequestCaptionParams = {
encode(message, writer = new BinaryWriter()) {
if (message.deviceCaptionsOn !== undefined) {
writer.uint32(8).bool(message.deviceCaptionsOn);
}
if (message.deviceCaptionsLangPref !== undefined) {
writer.uint32(18).string(message.deviceCaptionsLangPref);
}
if (message.viewerSelectedCaptionLangs !== undefined) {
writer.uint32(26).string(message.viewerSelectedCaptionLangs);
}
if (message.ccLangPref !== undefined) {
writer.uint32(34).string(message.ccLangPref);
}
if (message.ccLoadPolicyOn !== undefined) {
writer.uint32(40).bool(message.ccLoadPolicyOn);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePlayerRequestCaptionParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.deviceCaptionsOn = reader.bool();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.deviceCaptionsLangPref = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.viewerSelectedCaptionLangs = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.ccLangPref = reader.string();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.ccLoadPolicyOn = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=player_request_caption_params.js.map
@@ -0,0 +1 @@
{"version":3,"file":"player_request_caption_params.js","sourceRoot":"","sources":["../../../../../../protos/generated/youtube/api/pfiinnertube/player_request_caption_params.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,uEAAuE;AAEvE,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAU1D,SAAS,oCAAoC;IAC3C,OAAO;QACL,gBAAgB,EAAE,SAAS;QAC3B,sBAAsB,EAAE,SAAS;QACjC,0BAA0B,EAAE,SAAS;QACrC,UAAU,EAAE,SAAS;QACrB,cAAc,EAAE,SAAS;KAC1B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,0BAA0B,GAA2C;IAChF,MAAM,CAAC,OAAmC,EAAE,SAAuB,IAAI,YAAY,EAAE;QACnF,IAAI,OAAO,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;YAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,OAAO,CAAC,sBAAsB,KAAK,SAAS,EAAE,CAAC;YACjD,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAC3D,CAAC;QACD,IAAI,OAAO,CAAC,0BAA0B,KAAK,SAAS,EAAE,CAAC;YACrD,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,C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C,MAAM,EAAE,CAAC;oBACjD,SAAS;gBACX,CAAC;gBACD,KAAK,CAAC,CAAC,CAAC,CAAC;oBACP,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;wBACf,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;oBACrD,SAAS;gBACX,CAAC;gBACD,KAAK,CAAC,CAAC,CAAC,CAAC;oBACP,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;wBACf,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;oBACrC,SAAS;gBACX,CAAC;gBACD,KAAK,CAAC,CAAC,CAAC,CAAC;oBACP,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;wBACf,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,cAAc,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;oBACvC,SAAS;gBACX,CAAC;YACH,CAAC;YACD,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;gBACjC,MAAM;YACR,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
@@ -0,0 +1,15 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InnerTubeContext } from "./innertube_context.js";
import { PlayerRequest } from "./player_request.js";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface ReelItemWatchRequest {
context?: InnerTubeContext | undefined;
playerRequest?: PlayerRequest | undefined;
params?: string | undefined;
disablePlayerResponse?: boolean | undefined;
}
export declare const ReelItemWatchRequest: MessageFns<ReelItemWatchRequest>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,74 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/reel_item_watch_request.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InnerTubeContext } from "./innertube_context.js";
import { PlayerRequest } from "./player_request.js";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBaseReelItemWatchRequest() {
return { context: undefined, playerRequest: undefined, params: undefined, disablePlayerResponse: undefined };
}
export const ReelItemWatchRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.context !== undefined) {
InnerTubeContext.encode(message.context, writer.uint32(10).fork()).join();
}
if (message.playerRequest !== undefined) {
PlayerRequest.encode(message.playerRequest, writer.uint32(18).fork()).join();
}
if (message.params !== undefined) {
writer.uint32(26).string(message.params);
}
if (message.disablePlayerResponse !== undefined) {
writer.uint32(32).bool(message.disablePlayerResponse);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseReelItemWatchRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.context = InnerTubeContext.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.playerRequest = PlayerRequest.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.params = reader.string();
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.disablePlayerResponse = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=reel_item_watch_request.js.map
@@ -0,0 +1 @@
{"version":3,"file":"reel_item_watch_request.js","sourceRoot":"","sources":["../../../../../../protos/generated/youtube/api/pfiinnertube/reel_item_watch_request.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ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C;oBACP,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;wBACf,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,qBAAqB,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;oBAC9C,SAAS;gBACX,CAAC;YACH,CAAC;YACD,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;gBACjC,MAAM;YACR,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
@@ -0,0 +1,56 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { KeyValuePair } from "../../../misc/common.js";
import { AttestationResponseData } from "./attestation_response_data.js";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface RequestInfo {
thirdPartyDigest?: string | undefined;
useSsl?: boolean | undefined;
returnErrorDetail?: boolean | undefined;
/** "If-None-Match" HTTP header? */
ifNoneMatch?: string | undefined;
returnLogEntry?: boolean | undefined;
isPrefetch?: boolean | undefined;
internalExperimentFlags: KeyValuePair[];
returnDebugData?: boolean | undefined;
innertubez?: string | undefined;
traceProto?: boolean | undefined;
returnLogEntryJson?: boolean | undefined;
sherlogUsername?: string | undefined;
/** repeated ConsistencyTokenJar consistency_token_jars = 26; */
reauthRequestInfo?: RequestInfo_ReauthRequestInfo | undefined;
sessionInfo?: RequestInfo_SessionInfo | undefined;
returnLogEntryProto?: boolean | undefined;
/** External pre-request context as a string */
externalPrequestContext?: string | undefined;
/**
* repeated InnerTubeTokenJar innertube_token_jar = 33;
* Would a botguard/droidguard response here allow playback?
*/
attestationResponseData?: AttestationResponseData | undefined;
eats?: Uint8Array | undefined;
requestQos?: RequestInfo_RequestQoS | undefined;
}
export declare enum RequestInfo_Criticality {
CRITICALITY_UNSPECIFIED = 0,
CRITICALITY_CRITICAL = 1,
CRITICALITY_NON_CRITICAL = 2,
UNRECOGNIZED = -1
}
/** Quality of Service? */
export interface RequestInfo_RequestQoS {
criticality?: RequestInfo_Criticality | undefined;
}
export interface RequestInfo_SessionInfo {
token?: string | undefined;
}
export interface RequestInfo_ReauthRequestInfo {
encodedReauthProofToken?: string | undefined;
}
export declare const RequestInfo: MessageFns<RequestInfo>;
export declare const RequestInfo_RequestQoS: MessageFns<RequestInfo_RequestQoS>;
export declare const RequestInfo_SessionInfo: MessageFns<RequestInfo_SessionInfo>;
export declare const RequestInfo_ReauthRequestInfo: MessageFns<RequestInfo_ReauthRequestInfo>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,349 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/request_info.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { KeyValuePair } from "../../../misc/common.js";
import { AttestationResponseData } from "./attestation_response_data.js";
export const protobufPackage = "youtube.api.pfiinnertube";
export const RequestInfo_Criticality = {
CRITICALITY_UNSPECIFIED: 0, 0: "CRITICALITY_UNSPECIFIED",
CRITICALITY_CRITICAL: 1, 1: "CRITICALITY_CRITICAL",
CRITICALITY_NON_CRITICAL: 2, 2: "CRITICALITY_NON_CRITICAL",
UNRECOGNIZED: -1, "-1": "UNRECOGNIZED"
};
function createBaseRequestInfo() {
return {
thirdPartyDigest: undefined,
useSsl: undefined,
returnErrorDetail: undefined,
ifNoneMatch: undefined,
returnLogEntry: undefined,
isPrefetch: undefined,
internalExperimentFlags: [],
returnDebugData: undefined,
innertubez: undefined,
traceProto: undefined,
returnLogEntryJson: undefined,
sherlogUsername: undefined,
reauthRequestInfo: undefined,
sessionInfo: undefined,
returnLogEntryProto: undefined,
externalPrequestContext: undefined,
attestationResponseData: undefined,
eats: undefined,
requestQos: undefined,
};
}
export const RequestInfo = {
encode(message, writer = new BinaryWriter()) {
if (message.thirdPartyDigest !== undefined) {
writer.uint32(50).string(message.thirdPartyDigest);
}
if (message.useSsl !== undefined) {
writer.uint32(56).bool(message.useSsl);
}
if (message.returnErrorDetail !== undefined) {
writer.uint32(72).bool(message.returnErrorDetail);
}
if (message.ifNoneMatch !== undefined) {
writer.uint32(98).string(message.ifNoneMatch);
}
if (message.returnLogEntry !== undefined) {
writer.uint32(104).bool(message.returnLogEntry);
}
if (message.isPrefetch !== undefined) {
writer.uint32(112).bool(message.isPrefetch);
}
for (const v of message.internalExperimentFlags) {
KeyValuePair.encode(v, writer.uint32(122).fork()).join();
}
if (message.returnDebugData !== undefined) {
writer.uint32(128).bool(message.returnDebugData);
}
if (message.innertubez !== undefined) {
writer.uint32(146).string(message.innertubez);
}
if (message.traceProto !== undefined) {
writer.uint32(184).bool(message.traceProto);
}
if (message.returnLogEntryJson !== undefined) {
writer.uint32(192).bool(message.returnLogEntryJson);
}
if (message.sherlogUsername !== undefined) {
writer.uint32(202).string(message.sherlogUsername);
}
if (message.reauthRequestInfo !== undefined) {
RequestInfo_ReauthRequestInfo.encode(message.reauthRequestInfo, writer.uint32(234).fork()).join();
}
if (message.sessionInfo !== undefined) {
RequestInfo_SessionInfo.encode(message.sessionInfo, writer.uint32(242).fork()).join();
}
if (message.returnLogEntryProto !== undefined) {
writer.uint32(248).bool(message.returnLogEntryProto);
}
if (message.externalPrequestContext !== undefined) {
writer.uint32(258).string(message.externalPrequestContext);
}
if (message.attestationResponseData !== undefined) {
AttestationResponseData.encode(message.attestationResponseData, writer.uint32(274).fork()).join();
}
if (message.eats !== undefined) {
writer.uint32(282).bytes(message.eats);
}
if (message.requestQos !== undefined) {
RequestInfo_RequestQoS.encode(message.requestQos, writer.uint32(290).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 6: {
if (tag !== 50) {
break;
}
message.thirdPartyDigest = reader.string();
continue;
}
case 7: {
if (tag !== 56) {
break;
}
message.useSsl = reader.bool();
continue;
}
case 9: {
if (tag !== 72) {
break;
}
message.returnErrorDetail = reader.bool();
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.ifNoneMatch = reader.string();
continue;
}
case 13: {
if (tag !== 104) {
break;
}
message.returnLogEntry = reader.bool();
continue;
}
case 14: {
if (tag !== 112) {
break;
}
message.isPrefetch = reader.bool();
continue;
}
case 15: {
if (tag !== 122) {
break;
}
message.internalExperimentFlags.push(KeyValuePair.decode(reader, reader.uint32()));
continue;
}
case 16: {
if (tag !== 128) {
break;
}
message.returnDebugData = reader.bool();
continue;
}
case 18: {
if (tag !== 146) {
break;
}
message.innertubez = reader.string();
continue;
}
case 23: {
if (tag !== 184) {
break;
}
message.traceProto = reader.bool();
continue;
}
case 24: {
if (tag !== 192) {
break;
}
message.returnLogEntryJson = reader.bool();
continue;
}
case 25: {
if (tag !== 202) {
break;
}
message.sherlogUsername = reader.string();
continue;
}
case 29: {
if (tag !== 234) {
break;
}
message.reauthRequestInfo = RequestInfo_ReauthRequestInfo.decode(reader, reader.uint32());
continue;
}
case 30: {
if (tag !== 242) {
break;
}
message.sessionInfo = RequestInfo_SessionInfo.decode(reader, reader.uint32());
continue;
}
case 31: {
if (tag !== 248) {
break;
}
message.returnLogEntryProto = reader.bool();
continue;
}
case 32: {
if (tag !== 258) {
break;
}
message.externalPrequestContext = reader.string();
continue;
}
case 34: {
if (tag !== 274) {
break;
}
message.attestationResponseData = AttestationResponseData.decode(reader, reader.uint32());
continue;
}
case 35: {
if (tag !== 282) {
break;
}
message.eats = reader.bytes();
continue;
}
case 36: {
if (tag !== 290) {
break;
}
message.requestQos = RequestInfo_RequestQoS.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseRequestInfo_RequestQoS() {
return { criticality: undefined };
}
export const RequestInfo_RequestQoS = {
encode(message, writer = new BinaryWriter()) {
if (message.criticality !== undefined) {
writer.uint32(8).int32(message.criticality);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestInfo_RequestQoS();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.criticality = reader.int32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseRequestInfo_SessionInfo() {
return { token: undefined };
}
export const RequestInfo_SessionInfo = {
encode(message, writer = new BinaryWriter()) {
if (message.token !== undefined) {
writer.uint32(10).string(message.token);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestInfo_SessionInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.token = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseRequestInfo_ReauthRequestInfo() {
return { encodedReauthProofToken: undefined };
}
export const RequestInfo_ReauthRequestInfo = {
encode(message, writer = new BinaryWriter()) {
if (message.encodedReauthProofToken !== undefined) {
writer.uint32(10).string(message.encodedReauthProofToken);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseRequestInfo_ReauthRequestInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.encodedReauthProofToken = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=request_info.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface ServiceIntegrityDimensions {
poToken?: Uint8Array | undefined;
}
export declare const ServiceIntegrityDimensions: MessageFns<ServiceIntegrityDimensions>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,42 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/service_integrity_dimensions.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBaseServiceIntegrityDimensions() {
return { poToken: undefined };
}
export const ServiceIntegrityDimensions = {
encode(message, writer = new BinaryWriter()) {
if (message.poToken !== undefined) {
writer.uint32(10).bytes(message.poToken);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseServiceIntegrityDimensions();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.poToken = reader.bytes();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=service_integrity_dimensions.js.map
@@ -0,0 +1 @@
{"version":3,"file":"service_integrity_dimensions.js","sourceRoot":"","sources":["../../../../../../protos/generated/youtube/api/pfiinnertube/service_integrity_dimensions.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,sEAAsE;AAEtE,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAy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D,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
@@ -0,0 +1,21 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface ThirdPartyInfo {
developerKey?: string | undefined;
appName?: string | undefined;
appPublisher?: string | undefined;
embedUrl?: string | undefined;
appVersion?: string | undefined;
embeddedPlayerContext?: ThirdPartyInfo_EmbeddedPlayerContext | undefined;
}
export interface ThirdPartyInfo_EmbeddedPlayerContext {
ancestorOrigins?: string | undefined;
embeddedPlayerEncryptedContext?: string | undefined;
ancestorOriginsSupported?: boolean | undefined;
}
export declare const ThirdPartyInfo: MessageFns<ThirdPartyInfo>;
export declare const ThirdPartyInfo_EmbeddedPlayerContext: MessageFns<ThirdPartyInfo_EmbeddedPlayerContext>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,152 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/third_party_info.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBaseThirdPartyInfo() {
return {
developerKey: undefined,
appName: undefined,
appPublisher: undefined,
embedUrl: undefined,
appVersion: undefined,
embeddedPlayerContext: undefined,
};
}
export const ThirdPartyInfo = {
encode(message, writer = new BinaryWriter()) {
if (message.developerKey !== undefined) {
writer.uint32(10).string(message.developerKey);
}
if (message.appName !== undefined) {
writer.uint32(18).string(message.appName);
}
if (message.appPublisher !== undefined) {
writer.uint32(26).string(message.appPublisher);
}
if (message.embedUrl !== undefined) {
writer.uint32(34).string(message.embedUrl);
}
if (message.appVersion !== undefined) {
writer.uint32(50).string(message.appVersion);
}
if (message.embeddedPlayerContext !== undefined) {
ThirdPartyInfo_EmbeddedPlayerContext.encode(message.embeddedPlayerContext, writer.uint32(58).fork()).join();
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseThirdPartyInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.developerKey = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.appName = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.appPublisher = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.embedUrl = reader.string();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.appVersion = reader.string();
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.embeddedPlayerContext = ThirdPartyInfo_EmbeddedPlayerContext.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseThirdPartyInfo_EmbeddedPlayerContext() {
return { ancestorOrigins: undefined, embeddedPlayerEncryptedContext: undefined, ancestorOriginsSupported: undefined };
}
export const ThirdPartyInfo_EmbeddedPlayerContext = {
encode(message, writer = new BinaryWriter()) {
if (message.ancestorOrigins !== undefined) {
writer.uint32(10).string(message.ancestorOrigins);
}
if (message.embeddedPlayerEncryptedContext !== undefined) {
writer.uint32(18).string(message.embeddedPlayerEncryptedContext);
}
if (message.ancestorOriginsSupported !== undefined) {
writer.uint32(24).bool(message.ancestorOriginsSupported);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseThirdPartyInfo_EmbeddedPlayerContext();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.ancestorOrigins = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.embeddedPlayerEncryptedContext = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.ancestorOriginsSupported = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=third_party_info.js.map
@@ -0,0 +1 @@
{"version":3,"file":"third_party_info.js","sourceRoot":"","sources":["../../../../../../protos/generated/youtube/api/pfiinnertube/third_party_info.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,0DAA0D;AAE1D,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAiB1D,SAAS,wBAAwB;IAC/B,OAAO;QACL,YAAY,EAAE,SAAS;QACvB,OAAO,EAAE,SAAS;QAClB,YAAY,EAAE,SAAS;QACvB,QAAQ,EAAE,SAAS;QACnB,UAAU,EAAE,SAAS;QACrB,qBAAqB,EAAE,SAAS;KACjC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAA+B;IACxD,MAAM,CAAC,OAAuB,EAAE,SAAuB,IAAI,YAAY,EAAE;QACvE,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,CAAC,MAAM,CAAC,EAAE,CAA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,MAAM,EAAE,CAAC;YAC5B,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC;gBAClB,KAAK,CAAC,CAAC,CAAC,CAAC;oBACP,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;wBACf,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;oBAC1C,SAAS;gBACX,CAAC;gBACD,KAAK,CAAC,CAAC,CAAC,CAAC;oBACP,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;wBACf,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,8BAA8B,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;oBACzD,SAAS;gBACX,CAAC;gBACD,KAAK,CAAC,CAAC,CAAC,CAAC;oBACP,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;wBACf,MAAM;oBACR,CAAC;oBAED,OAAO,CAAC,wBAAwB,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;oBACjD,SAAS;gBACX,CAAC;YACH,CAAC;YACD,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;gBACjC,MAAM;YACR,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
@@ -0,0 +1,30 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface UserInfo {
onBehalfOfUser?: string | undefined;
enableSafetyMode?: boolean | undefined;
credentialTransferTokens: UserInfo_CredentialTransferToken[];
delegatePurchases?: UserInfo_DelegatePurchases | undefined;
kidsParent?: UserInfo_KidsParent | undefined;
isIncognito?: boolean | undefined;
lockedSafetyMode?: boolean | undefined;
delegationContext?: UserInfo_DelegationContext | undefined;
serializedDelegationContext?: string | undefined;
}
export interface UserInfo_KidsParent {
}
export interface UserInfo_DelegatePurchases {
}
export interface UserInfo_DelegationContext {
}
export interface UserInfo_CredentialTransferToken {
}
export declare const UserInfo: MessageFns<UserInfo>;
export declare const UserInfo_KidsParent: MessageFns<UserInfo_KidsParent>;
export declare const UserInfo_DelegatePurchases: MessageFns<UserInfo_DelegatePurchases>;
export declare const UserInfo_DelegationContext: MessageFns<UserInfo_DelegationContext>;
export declare const UserInfo_CredentialTransferToken: MessageFns<UserInfo_CredentialTransferToken>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,224 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/user_info.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBaseUserInfo() {
return {
onBehalfOfUser: undefined,
enableSafetyMode: undefined,
credentialTransferTokens: [],
delegatePurchases: undefined,
kidsParent: undefined,
isIncognito: undefined,
lockedSafetyMode: undefined,
delegationContext: undefined,
serializedDelegationContext: undefined,
};
}
export const UserInfo = {
encode(message, writer = new BinaryWriter()) {
if (message.onBehalfOfUser !== undefined) {
writer.uint32(26).string(message.onBehalfOfUser);
}
if (message.enableSafetyMode !== undefined) {
writer.uint32(56).bool(message.enableSafetyMode);
}
for (const v of message.credentialTransferTokens) {
UserInfo_CredentialTransferToken.encode(v, writer.uint32(98).fork()).join();
}
if (message.delegatePurchases !== undefined) {
UserInfo_DelegatePurchases.encode(message.delegatePurchases, writer.uint32(106).fork()).join();
}
if (message.kidsParent !== undefined) {
UserInfo_KidsParent.encode(message.kidsParent, writer.uint32(114).fork()).join();
}
if (message.isIncognito !== undefined) {
writer.uint32(120).bool(message.isIncognito);
}
if (message.lockedSafetyMode !== undefined) {
writer.uint32(128).bool(message.lockedSafetyMode);
}
if (message.delegationContext !== undefined) {
UserInfo_DelegationContext.encode(message.delegationContext, writer.uint32(138).fork()).join();
}
if (message.serializedDelegationContext !== undefined) {
writer.uint32(146).string(message.serializedDelegationContext);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUserInfo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3: {
if (tag !== 26) {
break;
}
message.onBehalfOfUser = reader.string();
continue;
}
case 7: {
if (tag !== 56) {
break;
}
message.enableSafetyMode = reader.bool();
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.credentialTransferTokens.push(UserInfo_CredentialTransferToken.decode(reader, reader.uint32()));
continue;
}
case 13: {
if (tag !== 106) {
break;
}
message.delegatePurchases = UserInfo_DelegatePurchases.decode(reader, reader.uint32());
continue;
}
case 14: {
if (tag !== 114) {
break;
}
message.kidsParent = UserInfo_KidsParent.decode(reader, reader.uint32());
continue;
}
case 15: {
if (tag !== 120) {
break;
}
message.isIncognito = reader.bool();
continue;
}
case 16: {
if (tag !== 128) {
break;
}
message.lockedSafetyMode = reader.bool();
continue;
}
case 17: {
if (tag !== 138) {
break;
}
message.delegationContext = UserInfo_DelegationContext.decode(reader, reader.uint32());
continue;
}
case 18: {
if (tag !== 146) {
break;
}
message.serializedDelegationContext = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseUserInfo_KidsParent() {
return {};
}
export const UserInfo_KidsParent = {
encode(_, writer = new BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUserInfo_KidsParent();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseUserInfo_DelegatePurchases() {
return {};
}
export const UserInfo_DelegatePurchases = {
encode(_, writer = new BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUserInfo_DelegatePurchases();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseUserInfo_DelegationContext() {
return {};
}
export const UserInfo_DelegationContext = {
encode(_, writer = new BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUserInfo_DelegationContext();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
function createBaseUserInfo_CredentialTransferToken() {
return {};
}
export const UserInfo_CredentialTransferToken = {
encode(_, writer = new BinaryWriter()) {
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseUserInfo_CredentialTransferToken();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=user_info.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,39 @@
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InnerTubeContext } from "./innertube_context.js";
export declare const protobufPackage = "youtube.api.pfiinnertube";
export interface WatchNextRequest {
context?: InnerTubeContext | undefined;
videoId?: string | undefined;
playlistId?: string | undefined;
params?: string | undefined;
continuation?: string | undefined;
isAdPlayback?: boolean | undefined;
mdxUseDevServer?: boolean | undefined;
referrer?: string | undefined;
referringApp?: string | undefined;
adParams?: string | undefined;
requestMusicSequence?: boolean | undefined;
enableMdxAutoplay?: boolean | undefined;
isMdxPlayback?: boolean | undefined;
racyCheckOk?: boolean | undefined;
contentCheckOk?: boolean | undefined;
isAudioOnly?: boolean | undefined;
autonavEnabled?: boolean | undefined;
enablePersistentPlaylistPanel?: boolean | undefined;
playlistSetVideoId?: string | undefined;
showRuInvalidTokenMessage?: boolean | undefined;
serializedThirdPartyEmbedConfig?: string | undefined;
showContentOwnerOnly?: boolean | undefined;
isEmbedPreview?: boolean | undefined;
lastScrubbedInlinePlaybackVideoId?: string | undefined;
lastAudioTurnedOnInlinePlaybackVideoId?: string | undefined;
lastAudioTurnedOffInlinePlaybackVideoId?: string | undefined;
captionsRequested?: boolean | undefined;
queueContextParams?: Uint8Array | undefined;
showShortsOnly?: boolean | undefined;
}
export declare const WatchNextRequest: MessageFns<WatchNextRequest>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
}
@@ -0,0 +1,353 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.7.7
// protoc v6.33.5
// source: youtube/api/pfiinnertube/watch_next_request.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { InnerTubeContext } from "./innertube_context.js";
export const protobufPackage = "youtube.api.pfiinnertube";
function createBaseWatchNextRequest() {
return {
context: undefined,
videoId: undefined,
playlistId: undefined,
params: undefined,
continuation: undefined,
isAdPlayback: undefined,
mdxUseDevServer: undefined,
referrer: undefined,
referringApp: undefined,
adParams: undefined,
requestMusicSequence: undefined,
enableMdxAutoplay: undefined,
isMdxPlayback: undefined,
racyCheckOk: undefined,
contentCheckOk: undefined,
isAudioOnly: undefined,
autonavEnabled: undefined,
enablePersistentPlaylistPanel: undefined,
playlistSetVideoId: undefined,
showRuInvalidTokenMessage: undefined,
serializedThirdPartyEmbedConfig: undefined,
showContentOwnerOnly: undefined,
isEmbedPreview: undefined,
lastScrubbedInlinePlaybackVideoId: undefined,
lastAudioTurnedOnInlinePlaybackVideoId: undefined,
lastAudioTurnedOffInlinePlaybackVideoId: undefined,
captionsRequested: undefined,
queueContextParams: undefined,
showShortsOnly: undefined,
};
}
export const WatchNextRequest = {
encode(message, writer = new BinaryWriter()) {
if (message.context !== undefined) {
InnerTubeContext.encode(message.context, writer.uint32(10).fork()).join();
}
if (message.videoId !== undefined) {
writer.uint32(18).string(message.videoId);
}
if (message.playlistId !== undefined) {
writer.uint32(34).string(message.playlistId);
}
if (message.params !== undefined) {
writer.uint32(50).string(message.params);
}
if (message.continuation !== undefined) {
writer.uint32(66).string(message.continuation);
}
if (message.isAdPlayback !== undefined) {
writer.uint32(72).bool(message.isAdPlayback);
}
if (message.mdxUseDevServer !== undefined) {
writer.uint32(80).bool(message.mdxUseDevServer);
}
if (message.referrer !== undefined) {
writer.uint32(98).string(message.referrer);
}
if (message.referringApp !== undefined) {
writer.uint32(106).string(message.referringApp);
}
if (message.adParams !== undefined) {
writer.uint32(130).string(message.adParams);
}
if (message.requestMusicSequence !== undefined) {
writer.uint32(144).bool(message.requestMusicSequence);
}
if (message.enableMdxAutoplay !== undefined) {
writer.uint32(168).bool(message.enableMdxAutoplay);
}
if (message.isMdxPlayback !== undefined) {
writer.uint32(176).bool(message.isMdxPlayback);
}
if (message.racyCheckOk !== undefined) {
writer.uint32(192).bool(message.racyCheckOk);
}
if (message.contentCheckOk !== undefined) {
writer.uint32(200).bool(message.contentCheckOk);
}
if (message.isAudioOnly !== undefined) {
writer.uint32(208).bool(message.isAudioOnly);
}
if (message.autonavEnabled !== undefined) {
writer.uint32(216).bool(message.autonavEnabled);
}
if (message.enablePersistentPlaylistPanel !== undefined) {
writer.uint32(240).bool(message.enablePersistentPlaylistPanel);
}
if (message.playlistSetVideoId !== undefined) {
writer.uint32(250).string(message.playlistSetVideoId);
}
if (message.showRuInvalidTokenMessage !== undefined) {
writer.uint32(280).bool(message.showRuInvalidTokenMessage);
}
if (message.serializedThirdPartyEmbedConfig !== undefined) {
writer.uint32(298).string(message.serializedThirdPartyEmbedConfig);
}
if (message.showContentOwnerOnly !== undefined) {
writer.uint32(304).bool(message.showContentOwnerOnly);
}
if (message.isEmbedPreview !== undefined) {
writer.uint32(336).bool(message.isEmbedPreview);
}
if (message.lastScrubbedInlinePlaybackVideoId !== undefined) {
writer.uint32(346).string(message.lastScrubbedInlinePlaybackVideoId);
}
if (message.lastAudioTurnedOnInlinePlaybackVideoId !== undefined) {
writer.uint32(354).string(message.lastAudioTurnedOnInlinePlaybackVideoId);
}
if (message.lastAudioTurnedOffInlinePlaybackVideoId !== undefined) {
writer.uint32(362).string(message.lastAudioTurnedOffInlinePlaybackVideoId);
}
if (message.captionsRequested !== undefined) {
writer.uint32(376).bool(message.captionsRequested);
}
if (message.queueContextParams !== undefined) {
writer.uint32(402).bytes(message.queueContextParams);
}
if (message.showShortsOnly !== undefined) {
writer.uint32(440).bool(message.showShortsOnly);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseWatchNextRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.context = InnerTubeContext.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.videoId = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.playlistId = reader.string();
continue;
}
case 6: {
if (tag !== 50) {
break;
}
message.params = reader.string();
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.continuation = reader.string();
continue;
}
case 9: {
if (tag !== 72) {
break;
}
message.isAdPlayback = reader.bool();
continue;
}
case 10: {
if (tag !== 80) {
break;
}
message.mdxUseDevServer = reader.bool();
continue;
}
case 12: {
if (tag !== 98) {
break;
}
message.referrer = reader.string();
continue;
}
case 13: {
if (tag !== 106) {
break;
}
message.referringApp = reader.string();
continue;
}
case 16: {
if (tag !== 130) {
break;
}
message.adParams = reader.string();
continue;
}
case 18: {
if (tag !== 144) {
break;
}
message.requestMusicSequence = reader.bool();
continue;
}
case 21: {
if (tag !== 168) {
break;
}
message.enableMdxAutoplay = reader.bool();
continue;
}
case 22: {
if (tag !== 176) {
break;
}
message.isMdxPlayback = reader.bool();
continue;
}
case 24: {
if (tag !== 192) {
break;
}
message.racyCheckOk = reader.bool();
continue;
}
case 25: {
if (tag !== 200) {
break;
}
message.contentCheckOk = reader.bool();
continue;
}
case 26: {
if (tag !== 208) {
break;
}
message.isAudioOnly = reader.bool();
continue;
}
case 27: {
if (tag !== 216) {
break;
}
message.autonavEnabled = reader.bool();
continue;
}
case 30: {
if (tag !== 240) {
break;
}
message.enablePersistentPlaylistPanel = reader.bool();
continue;
}
case 31: {
if (tag !== 250) {
break;
}
message.playlistSetVideoId = reader.string();
continue;
}
case 35: {
if (tag !== 280) {
break;
}
message.showRuInvalidTokenMessage = reader.bool();
continue;
}
case 37: {
if (tag !== 298) {
break;
}
message.serializedThirdPartyEmbedConfig = reader.string();
continue;
}
case 38: {
if (tag !== 304) {
break;
}
message.showContentOwnerOnly = reader.bool();
continue;
}
case 42: {
if (tag !== 336) {
break;
}
message.isEmbedPreview = reader.bool();
continue;
}
case 43: {
if (tag !== 346) {
break;
}
message.lastScrubbedInlinePlaybackVideoId = reader.string();
continue;
}
case 44: {
if (tag !== 354) {
break;
}
message.lastAudioTurnedOnInlinePlaybackVideoId = reader.string();
continue;
}
case 45: {
if (tag !== 362) {
break;
}
message.lastAudioTurnedOffInlinePlaybackVideoId = reader.string();
continue;
}
case 47: {
if (tag !== 376) {
break;
}
message.captionsRequested = reader.bool();
continue;
}
case 50: {
if (tag !== 402) {
break;
}
message.queueContextParams = reader.bytes();
continue;
}
case 55: {
if (tag !== 440) {
break;
}
message.showShortsOnly = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
};
//# sourceMappingURL=watch_next_request.js.map
File diff suppressed because one or more lines are too long
+122
View File
@@ -0,0 +1,122 @@
import Session from './core/Session.js';
import { Kids, Music, Studio } from './core/clients/index.js';
import { AccountManager, InteractionManager, PlaylistManager } from './core/managers/index.js';
import { Feed } from './core/mixins/index.js';
import { Channel, Comments, Guide, HashtagFeed, History, HomeFeed, Library, NotificationsMenu, Playlist, Search, VideoInfo } from './parser/youtube/index.js';
import { ShortFormVideoInfo } from './parser/ytshorts/index.js';
import NavigationEndpoint from './parser/classes/NavigationEndpoint.js';
import type Format from './parser/classes/misc/Format.js';
import type { ApiResponse } from './core/Actions.js';
import type { DownloadOptions, EngagementType, FormatOptions, GetVideoInfoOptions, InnerTubeClient, InnerTubeConfig, SearchFilters } from './types/index.js';
import type { IBrowseResponse, IParsedResponse } from './parser/index.js';
/**
* Provides access to various services and modules in the YouTube API.
*
* @example
* ```ts
* import { Innertube, UniversalCache } from 'youtubei.js';
* const innertube = await Innertube.create({ cache: new UniversalCache(true)});
* ```
*/
export default class Innertube {
#private;
constructor(session: Session);
static create(config?: InnerTubeConfig): Promise<Innertube>;
getInfo(target: string | NavigationEndpoint, options?: GetVideoInfoOptions): Promise<VideoInfo>;
getBasicInfo(video_id: string, options?: GetVideoInfoOptions): Promise<VideoInfo>;
getShortsVideoInfo(video_id: string, client?: InnerTubeClient): Promise<ShortFormVideoInfo>;
search(query: string, filters?: SearchFilters): Promise<Search>;
getSearchSuggestions(query: string, previous_query?: string): Promise<string[]>;
getComments(video_id: string, sort_by?: 'TOP_COMMENTS' | 'NEWEST_FIRST', comment_id?: string): Promise<Comments>;
getHomeFeed(): Promise<HomeFeed>;
getGuide(): Promise<Guide>;
getLibrary(): Promise<Library>;
getHistory(): Promise<History>;
getCourses(): Promise<Feed<IBrowseResponse>>;
getSubscriptionsFeed(): Promise<Feed<IBrowseResponse>>;
getChannelsFeed(): Promise<Feed<IBrowseResponse>>;
getChannel(id: string): Promise<Channel>;
getNotifications(): Promise<NotificationsMenu>;
getUnseenNotificationsCount(): Promise<number>;
/**
* Retrieves the user's playlists.
*/
getPlaylists(): Promise<Feed<IBrowseResponse>>;
getPlaylist(id: string): Promise<Playlist>;
getHashtag(hashtag: string): Promise<HashtagFeed>;
/**
* An alternative to {@link download}.
* Returns deciphered streaming data.
*
* If you wish to retrieve the video info too, have a look at {@link getBasicInfo} or {@link getInfo}.
* @param video_id - The video id.
* @param options - Format options.
*/
getStreamingData(video_id: string, options?: FormatOptions): Promise<Format>;
/**
* Downloads a given video. If all you need the direct download link, see {@link getStreamingData}.
* If you wish to retrieve the video info too, have a look at {@link getBasicInfo} or {@link getInfo}.
* @param video_id - The video id.
* @param options - Download options.
*/
download(video_id: string, options?: DownloadOptions): Promise<ReadableStream<Uint8Array>>;
/**
* Resolves the given URL.
*/
resolveURL(url: string): Promise<NavigationEndpoint>;
/**
* Gets a post page given a post id and the channel id
*/
getPost(post_id: string, channel_id: string): Promise<Feed<IBrowseResponse>>;
/**
* Gets the comments of a post.
*/
getPostComments(post_id: string, channel_id: string, sort_by?: 'TOP_COMMENTS' | 'NEWEST_FIRST'): Promise<Comments>;
/**
* Fetches an attestation challenge.
*/
getAttestationChallenge(engagement_type: EngagementType, ids?: Record<string, any>[]): Promise<import("./parser/index.js").IGetChallengeResponse>;
/**
* Utility method to call an endpoint without having to use {@link Actions}.
*/
call<T extends IParsedResponse>(endpoint: NavigationEndpoint, args: {
[key: string]: any;
parse: true;
}): Promise<T>;
call(endpoint: NavigationEndpoint, args?: {
[key: string]: any;
parse?: false;
}): Promise<ApiResponse>;
/**
* An interface for interacting with YouTube Music.
*/
get music(): Music;
/**
* An interface for interacting with YouTube Studio.
*/
get studio(): Studio;
/**
* An interface for interacting with YouTube Kids.
*/
get kids(): Kids;
/**
* An interface for managing and retrieving account information.
*/
get account(): AccountManager;
/**
* An interface for managing playlists.
*/
get playlist(): PlaylistManager;
/**
* An interface for directly interacting with certain YouTube features.
*/
get interact(): InteractionManager;
/**
* An internal class used to dispatch requests.
*/
get actions(): import("./core/Actions.js").default;
/**
* The session used by this instance.
*/
get session(): Session;
}
+483
View File
@@ -0,0 +1,483 @@
import Session from './core/Session.js';
import { Kids, Music, Studio } from './core/clients/index.js';
import { AccountManager, InteractionManager, PlaylistManager } from './core/managers/index.js';
import { Feed } from './core/mixins/index.js';
import { Channel, Comments, Guide, HashtagFeed, History, HomeFeed, Library, NotificationsMenu, Playlist, Search, VideoInfo } from './parser/youtube/index.js';
import { ShortFormVideoInfo } from './parser/ytshorts/index.js';
import { NavigateAction } from './parser/continuations.js';
import NavigationEndpoint from './parser/classes/NavigationEndpoint.js';
import * as Constants from './utils/Constants.js';
import { generateRandomString, InnertubeError, throwIfMissing, u8ToBase64 } from './utils/Utils.js';
import { CommunityPostCommentsParam, CommunityPostCommentsParamContainer, CommunityPostParams, GetCommentsSectionParams, Hashtag, ReelSequence, SearchFilter, SearchFilter_Filters_Duration, SearchFilter_Filters_SearchType, SearchFilter_Filters_UploadDate, SearchFilter_Prioritize } from '../protos/generated/misc/params.js';
/**
* Provides access to various services and modules in the YouTube API.
*
* @example
* ```ts
* import { Innertube, UniversalCache } from 'youtubei.js';
* const innertube = await Innertube.create({ cache: new UniversalCache(true)});
* ```
*/
export default class Innertube {
#session;
constructor(session) {
this.#session = session;
}
static async create(config = {}) {
return new Innertube(await Session.create(config));
}
async getInfo(target, options) {
throwIfMissing({ target });
const payload = {
videoId: target instanceof NavigationEndpoint ? target.payload?.videoId : target,
playlistId: target instanceof NavigationEndpoint ? target.payload?.playlistId : undefined,
playlistIndex: target instanceof NavigationEndpoint ? target.payload?.playlistIndex : undefined,
params: target instanceof NavigationEndpoint ? target.payload?.params : undefined,
racyCheckOk: true,
contentCheckOk: true
};
const watch_endpoint = new NavigationEndpoint({ watchEndpoint: payload });
const watch_next_endpoint = new NavigationEndpoint({ watchNextEndpoint: payload });
const session = this.#session;
const extra_payload = {
playbackContext: {
contentPlaybackContext: {
vis: 0,
splay: false,
lactMilliseconds: '-1',
signatureTimestamp: session.player?.signature_timestamp
}
},
client: options?.client
};
if (options?.po_token) {
extra_payload.serviceIntegrityDimensions = {
poToken: options.po_token
};
}
else if (session.po_token) {
extra_payload.serviceIntegrityDimensions = {
poToken: session.po_token
};
}
const watch_response = watch_endpoint.call(session.actions, extra_payload);
const watch_next_response = watch_next_endpoint.call(session.actions);
const response = await Promise.all([watch_response, watch_next_response]);
const cpn = generateRandomString(16);
return new VideoInfo(response, session.actions, cpn);
}
async getBasicInfo(video_id, options) {
throwIfMissing({ video_id });
const watch_endpoint = new NavigationEndpoint({
watchEndpoint: {
videoId: video_id,
racyCheckOk: true,
contentCheckOk: true
}
});
const session = this.#session;
const extra_payload = {
playbackContext: {
contentPlaybackContext: {
vis: 0,
splay: false,
lactMilliseconds: '-1',
signatureTimestamp: session.player?.signature_timestamp
}
},
client: options?.client
};
if (options?.po_token) {
extra_payload.serviceIntegrityDimensions = {
poToken: options.po_token
};
}
else if (session.po_token) {
extra_payload.serviceIntegrityDimensions = {
poToken: session.po_token
};
}
const watch_response = await watch_endpoint.call(session.actions, extra_payload);
const cpn = generateRandomString(16);
return new VideoInfo([watch_response], session.actions, cpn);
}
async getShortsVideoInfo(video_id, client) {
throwIfMissing({ video_id });
const reel_watch_endpoint = new NavigationEndpoint({
reelWatchEndpoint: {
disablePlayerResponse: false,
params: 'CAUwAg%3D%3D',
videoId: video_id
}
});
const actions = this.#session.actions;
const reel_watch_response = reel_watch_endpoint.call(actions, { client });
const writer = ReelSequence.encode({
shortId: video_id,
params: {
number: 5
},
feature2: 25,
feature3: 0
});
const params = encodeURIComponent(u8ToBase64(writer.finish()));
const sequence_response = actions.execute('/reel/reel_watch_sequence', { sequenceParams: params });
const response = await Promise.all([reel_watch_response, sequence_response]);
const cpn = generateRandomString(16);
return new ShortFormVideoInfo([response[0]], actions, cpn, response[1]);
}
async search(query, filters = {}) {
throwIfMissing({ query });
const search_filter = {};
search_filter.filters = {};
if (filters.prioritize) {
search_filter.prioritize = SearchFilter_Prioritize[filters.prioritize.toUpperCase()];
}
if (filters.upload_date) {
search_filter.filters.uploadDate = SearchFilter_Filters_UploadDate[filters.upload_date.toUpperCase()];
}
if (filters.type) {
search_filter.filters.type = SearchFilter_Filters_SearchType[filters.type.toUpperCase()];
}
if (filters.duration) {
search_filter.filters.duration = SearchFilter_Filters_Duration[filters.duration.toUpperCase()];
}
if (filters.features) {
for (const feature of filters.features) {
switch (feature) {
case '360':
search_filter.filters.features360 = true;
break;
case '3d':
search_filter.filters.features3d = true;
break;
case '4k':
search_filter.filters.features4k = true;
break;
case 'creative_commons':
search_filter.filters.featuresCreativeCommons = true;
break;
case 'hd':
search_filter.filters.featuresHd = true;
break;
case 'hdr':
search_filter.filters.featuresHdr = true;
break;
case 'live':
search_filter.filters.featuresLive = true;
break;
case 'location':
search_filter.filters.featuresLocation = true;
break;
case 'purchased':
search_filter.filters.featuresPurchased = true;
break;
case 'subtitles':
search_filter.filters.featuresSubtitles = true;
break;
case 'vr180':
search_filter.filters.featuresVr180 = true;
break;
default:
break;
}
}
}
const search_endpoint = new NavigationEndpoint({
searchEndpoint: {
query,
params: filters ? encodeURIComponent(u8ToBase64(SearchFilter.encode(search_filter).finish())) : undefined
}
});
const response = await search_endpoint.call(this.#session.actions);
return new Search(this.actions, response);
}
async getSearchSuggestions(query, previous_query) {
const session = this.#session;
const url = new URL(`${Constants.URLS.YT_SUGGESTIONS}/complete/search`);
url.searchParams.set('client', 'youtube');
url.searchParams.set('gs_ri', 'youtube');
url.searchParams.set('gs_id', '0');
url.searchParams.set('cp', '0');
url.searchParams.set('ds', 'yt');
url.searchParams.set('sugexp', Constants.CLIENTS.WEB.SUGG_EXP_ID);
url.searchParams.set('hl', session.context.client.hl);
url.searchParams.set('gl', session.context.client.gl);
url.searchParams.set('q', query);
if (previous_query)
url.searchParams.set('pq', previous_query);
const response = await session.http.fetch_function(url, {
headers: {
'Cookie': session.cookie || ''
}
});
const text = await response.text();
const data = JSON.parse(text.replace('window.google.ac.h(', '').slice(0, -1));
return data[1].map((suggestion) => suggestion[0]);
}
async getComments(video_id, sort_by, comment_id) {
throwIfMissing({ video_id });
const SORT_OPTIONS = {
TOP_COMMENTS: 0,
NEWEST_FIRST: 1
};
const token = GetCommentsSectionParams.encode({
ctx: {
videoId: video_id
},
unkParam: 6,
params: {
opts: {
videoId: video_id,
sortBy: SORT_OPTIONS[sort_by || 'TOP_COMMENTS'],
type: 2,
commentId: comment_id || ''
},
target: 'comments-section'
}
});
const continuation = encodeURIComponent(u8ToBase64(token.finish()));
const continuation_command = new NavigationEndpoint({
continuationCommand: {
request: 'CONTINUATION_REQUEST_TYPE_WATCH_NEXT',
token: continuation
}
});
const response = await continuation_command.call(this.#session.actions);
return new Comments(this.actions, response.data);
}
async getHomeFeed() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEwhat_to_watch' } });
const response = await browse_endpoint.call(this.#session.actions);
return new HomeFeed(this.actions, response);
}
async getGuide() {
const response = await this.actions.execute('/guide');
return new Guide(response.data);
}
async getLibrary() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FElibrary' } });
const response = await browse_endpoint.call(this.#session.actions);
return new Library(this.actions, response);
}
async getHistory() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEhistory' } });
const response = await browse_endpoint.call(this.#session.actions);
return new History(this.actions, response);
}
async getCourses() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEcourses_destination' } });
const response = await browse_endpoint.call(this.#session.actions, { parse: true });
return new Feed(this.actions, response);
}
async getSubscriptionsFeed() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEsubscriptions' } });
const response = await browse_endpoint.call(this.#session.actions, { parse: true });
return new Feed(this.actions, response);
}
async getChannelsFeed() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEchannels' } });
const response = await browse_endpoint.call(this.#session.actions, { parse: true });
return new Feed(this.actions, response);
}
async getChannel(id) {
throwIfMissing({ id });
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: id } });
let response = await browse_endpoint.call(this.#session.actions, { parse: true });
if (response.on_response_received_actions?.[0]?.is(NavigateAction)) {
response = await response.on_response_received_actions[0].endpoint.call(this.#session.actions, { parse: true });
}
return new Channel(this.actions, response, true);
}
async getNotifications() {
const response = await this.actions.execute('/notification/get_notification_menu', { notificationsMenuRequestType: 'NOTIFICATIONS_MENU_REQUEST_TYPE_INBOX' });
return new NotificationsMenu(this.actions, response);
}
async getUnseenNotificationsCount() {
const response = await this.actions.execute('/notification/get_unseen_count');
// FIXME: properly parse this.
return response.data?.unseenCount || response.data?.actions?.[0].updateNotificationsUnseenCountAction?.unseenCount || 0;
}
/**
* Retrieves the user's playlists.
*/
async getPlaylists() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEplaylist_aggregation' } });
const response = await browse_endpoint.call(this.#session.actions, { parse: true });
return new Feed(this.actions, response);
}
async getPlaylist(id) {
throwIfMissing({ id });
if (!id.startsWith('VL')) {
id = `VL${id}`;
}
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: id } });
const response = await browse_endpoint.call(this.#session.actions);
return new Playlist(this.actions, response);
}
async getHashtag(hashtag) {
throwIfMissing({ hashtag });
const writer = Hashtag.encode({
params: {
hashtag,
type: 1
}
});
const params = encodeURIComponent(u8ToBase64(writer.finish()));
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEhashtag', params } });
const response = await browse_endpoint.call(this.#session.actions);
return new HashtagFeed(this.actions, response);
}
/**
* An alternative to {@link download}.
* Returns deciphered streaming data.
*
* If you wish to retrieve the video info too, have a look at {@link getBasicInfo} or {@link getInfo}.
* @param video_id - The video id.
* @param options - Format options.
*/
async getStreamingData(video_id, options = {}) {
const info = await this.getBasicInfo(video_id, options);
const format = info.chooseFormat(options);
format.url = await format.decipher(this.#session.player);
return format;
}
/**
* Downloads a given video. If all you need the direct download link, see {@link getStreamingData}.
* If you wish to retrieve the video info too, have a look at {@link getBasicInfo} or {@link getInfo}.
* @param video_id - The video id.
* @param options - Download options.
*/
async download(video_id, options) {
const info = await this.getBasicInfo(video_id, options);
return info.download(options);
}
/**
* Resolves the given URL.
*/
async resolveURL(url) {
const response = await this.actions.execute('/navigation/resolve_url', { url, parse: true });
if (!response.endpoint)
throw new InnertubeError('Failed to resolve URL. Expected a NavigationEndpoint but got undefined', response);
return response.endpoint;
}
/**
* Gets a post page given a post id and the channel id
*/
async getPost(post_id, channel_id) {
throwIfMissing({ post_id, channel_id });
const writer = CommunityPostParams.encode({
f1: {
ucid1: channel_id,
postId: post_id,
ucid2: channel_id
}
});
const params = encodeURIComponent(u8ToBase64(writer.finish()).replace(/\+/g, '-').replace(/\//g, '_'));
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEpost_detail', params: params } });
const response = await browse_endpoint.call(this.#session.actions, { parse: true });
return new Feed(this.actions, response);
}
/**
* Gets the comments of a post.
*/
async getPostComments(post_id, channel_id, sort_by) {
throwIfMissing({ post_id, channel_id });
const SORT_OPTIONS = {
TOP_COMMENTS: 0,
NEWEST_FIRST: 1
};
const writer1 = CommunityPostCommentsParam.encode({
title: 'posts',
commentDataContainer: {
title: 'comments-section',
commentData: {
sortBy: SORT_OPTIONS[sort_by || 'TOP_COMMENTS'],
f0: 2,
f1: 0,
channelId: channel_id,
postId: post_id
},
f0: 0
}
});
const writer2 = CommunityPostCommentsParamContainer.encode({
f0: {
location: 'FEcomment_post_detail_page_web_top_level',
protoData: encodeURIComponent(u8ToBase64(writer1.finish()).replace(/\+/g, '-').replace(/\//g, '_'))
}
});
const continuation = encodeURIComponent(u8ToBase64(writer2.finish()));
const continuation_command = new NavigationEndpoint({
continuationCommand: {
request: 'CONTINUATION_REQUEST_TYPE_BROWSE',
token: continuation
}
});
const response = await continuation_command.call(this.#session.actions);
return new Comments(this.actions, response.data);
}
/**
* Fetches an attestation challenge.
*/
async getAttestationChallenge(engagement_type, ids) {
const payload = {
engagementType: engagement_type
};
if (ids)
payload.ids = ids;
return this.actions.execute('/att/get', { parse: true, ...payload });
}
call(endpoint, args) {
return endpoint.call(this.actions, args);
}
/**
* An interface for interacting with YouTube Music.
*/
get music() {
return new Music(this.#session);
}
/**
* An interface for interacting with YouTube Studio.
*/
get studio() {
return new Studio(this.#session);
}
/**
* An interface for interacting with YouTube Kids.
*/
get kids() {
return new Kids(this.#session);
}
/**
* An interface for managing and retrieving account information.
*/
get account() {
return new AccountManager(this.#session.actions);
}
/**
* An interface for managing playlists.
*/
get playlist() {
return new PlaylistManager(this.#session.actions);
}
/**
* An interface for directly interacting with certain YouTube features.
*/
get interact() {
return new InteractionManager(this.#session.actions);
}
/**
* An internal class used to dispatch requests.
*/
get actions() {
return this.#session.actions;
}
/**
* The session used by this instance.
*/
get session() {
return this.#session;
}
}
//# sourceMappingURL=Innertube.js.map
File diff suppressed because one or more lines are too long
+45
View File
@@ -0,0 +1,45 @@
import type { IBrowseResponse, IGetChallengeResponse, IGetNotificationsMenuResponse, INextResponse, IParsedResponse, IPlayerResponse, IRawResponse, IResolveURLResponse, ISearchResponse, IUpdatedMetadataResponse } from '../parser/index.js';
import type { Session } from './index.js';
export interface ApiResponse {
success: boolean;
status_code: number;
data: IRawResponse;
}
export type InnertubeEndpoint = '/player' | '/search' | '/browse' | '/next' | '/reel' | '/updated_metadata' | '/notification/get_notification_menu' | '/att/get' | string;
export type ParsedResponse<T> = T extends '/player' ? IPlayerResponse : T extends '/search' ? ISearchResponse : T extends '/browse' ? IBrowseResponse : T extends '/next' ? INextResponse : T extends '/updated_metadata' ? IUpdatedMetadataResponse : T extends '/navigation/resolve_url' ? IResolveURLResponse : T extends '/notification/get_notification_menu' ? IGetNotificationsMenuResponse : T extends '/att/get' ? IGetChallengeResponse : IParsedResponse;
export default class Actions {
#private;
session: Session;
constructor(session: Session);
/**
* Makes calls to the playback tracking API.
* @param url - The URL to call.
* @param client - The client to use.
* @param params - Call parameters.
*/
stats(url: string, client: {
client_name: string;
client_version: string;
}, params: {
[key: string]: any;
}): Promise<Response>;
/**
* Executes an API call.
* @param endpoint - The endpoint to call.
* @param args - Call arguments
*/
execute<T extends InnertubeEndpoint>(endpoint: T, args: {
[key: string]: any;
parse: true;
protobuf?: false;
serialized_data?: any;
skip_auth_check?: boolean;
}): Promise<ParsedResponse<T>>;
execute<T extends InnertubeEndpoint>(endpoint: T, args?: {
[key: string]: any;
parse?: false;
protobuf?: true;
serialized_data?: any;
skip_auth_check?: boolean;
}): Promise<ApiResponse>;
}
+111
View File
@@ -0,0 +1,111 @@
import { NavigateAction, Parser } from '../parser/index.js';
import { InnertubeError } from '../utils/Utils.js';
export default class Actions {
session;
constructor(session) {
this.session = session;
}
/**
* Makes calls to the playback tracking API.
* @param url - The URL to call.
* @param client - The client to use.
* @param params - Call parameters.
*/
async stats(url, client, params) {
const s_url = new URL(url);
s_url.searchParams.set('ver', '2');
s_url.searchParams.set('c', client.client_name.toLowerCase());
s_url.searchParams.set('cbrver', client.client_version);
s_url.searchParams.set('cver', client.client_version);
for (const key of Object.keys(params)) {
s_url.searchParams.set(key, params[key]);
}
return await this.session.http.fetch(s_url);
}
async execute(endpoint, args) {
let data;
if (args && !args.protobuf) {
data = { ...args };
if (Reflect.has(data, 'browseId') && !args.skip_auth_check) {
if (this.#needsLogin(data.browseId) && !this.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
}
if (Reflect.has(data, 'skip_auth_check'))
delete data.skip_auth_check;
if (Reflect.has(data, 'override_endpoint'))
delete data.override_endpoint;
if (Reflect.has(data, 'parse'))
delete data.parse;
if (Reflect.has(data, 'request'))
delete data.request;
if (Reflect.has(data, 'clientActions'))
delete data.clientActions;
if (Reflect.has(data, 'settingItemIdForClient'))
delete data.settingItemIdForClient;
if (Reflect.has(data, 'action')) {
data.actions = [data.action];
delete data.action;
}
if (Reflect.has(data, 'boolValue')) {
data.newValue = { boolValue: data.boolValue };
delete data.boolValue;
}
if (Reflect.has(data, 'token')) {
data.continuation = data.token;
delete data.token;
}
if (data?.client === 'YTMUSIC') {
data.isAudioOnly = true;
}
}
else if (args) {
data = args.serialized_data;
}
const target_endpoint = Reflect.has(args || {}, 'override_endpoint') ? args?.override_endpoint : endpoint;
const response = await this.session.http.fetch(target_endpoint, {
method: 'POST',
body: args?.protobuf ? data : JSON.stringify((data || {})),
headers: {
'Content-Type': args?.protobuf ?
'application/x-protobuf' :
'application/json'
}
});
if (args?.parse) {
let parsed_response = Parser.parseResponse(await response.json());
// Handle redirects
if (this.#isBrowse(parsed_response) && parsed_response.on_response_received_actions?.[0]?.type === 'navigateAction') {
const navigate_action = parsed_response.on_response_received_actions.firstOfType(NavigateAction);
if (navigate_action) {
parsed_response = await navigate_action.endpoint.call(this, { parse: true });
}
}
return parsed_response;
}
// Mimics the Axios API using Fetch's Response object.
return {
success: response.ok,
status_code: response.status,
data: await response.json()
};
}
#isBrowse(response) {
return 'on_response_received_actions' in response;
}
#needsLogin(id) {
return [
'FElibrary',
'FEhistory',
'FEsubscriptions',
'FEchannels',
'FEplaylist_aggregation',
'FEmusic_listening_review',
'FEmusic_library_landing',
'SPaccount_overview',
'SPaccount_notifications',
'SPaccount_privacy',
'SPtime_watched'
].includes(id);
}
}
//# sourceMappingURL=Actions.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Actions.js","sourceRoot":"","sources":["../../../src/core/Actions.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAgCnD,MAAM,CAAC,OAAO,OAAO,OAAO;IACnB,OAAO,CAAU;IAExB,YAAY,OAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,GAAW,EAAE,MAAuD,EAAE,MAEjF;QACC,MAAM,KAAK,GAAG,IAAI,GAAG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,QAAQ,CAAC,MAAM;YAC5B,IAAI,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;SAC5B,CAAC;IACJ,CAAC;IAED,SAAS,CAAC,QAAyB;QACjC,OAAO,8BAA8B,IAAI,QAAQ,CAAC;IACpD,CAAC;IAED,WAAW,CAAC,EAAU;QACpB,OAAO;YACL,WAAW;YACX,WAAW;YACX,iBAAiB;YACjB,YAAY;YACZ,wBAAwB;YACxB,0BAA0B;YAC1B,yBAAyB;YACzB,oBAAoB;YACpB,yBAAyB;YACzB,mBAAmB;YACnB,gBAAgB;SACjB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;CACF"}
+49
View File
@@ -0,0 +1,49 @@
import { OAuth2Error } from '../utils/Utils.js';
import type Session from './Session.js';
export type OAuth2ClientID = {
client_id: string;
client_secret: string;
};
export type OAuth2Tokens = {
access_token: string;
expiry_date: string;
expires_in?: number;
refresh_token: string;
scope?: string;
token_type?: string;
client?: OAuth2ClientID;
};
export type DeviceAndUserCode = {
device_code: string;
expires_in: number;
interval: number;
user_code: string;
verification_url: string;
error_code?: string;
};
export type OAuth2AuthEventHandler = (data: {
credentials: OAuth2Tokens;
}) => void;
export type OAuth2AuthPendingEventHandler = (data: DeviceAndUserCode) => void;
export type OAuth2AuthErrorEventHandler = (err: OAuth2Error) => void;
export default class OAuth2 {
#private;
YTTV_URL: URL;
AUTH_SERVER_CODE_URL: URL;
AUTH_SERVER_TOKEN_URL: URL;
AUTH_SERVER_REVOKE_TOKEN_URL: URL;
client_id: OAuth2ClientID | undefined;
oauth2_tokens: OAuth2Tokens | undefined;
constructor(session: Session);
init(tokens?: OAuth2Tokens): Promise<void>;
setTokens(tokens: OAuth2Tokens): void;
cacheCredentials(): Promise<void>;
removeCache(): Promise<void>;
pollForAccessToken(device_and_user_code: DeviceAndUserCode): void;
revokeCredentials(): Promise<Response | undefined>;
refreshAccessToken(): Promise<void>;
getDeviceAndUserCode(): Promise<DeviceAndUserCode>;
getClientID(): Promise<OAuth2ClientID>;
shouldRefreshToken(): boolean;
validateTokens(tokens: OAuth2Tokens): boolean;
}
+223
View File
@@ -0,0 +1,223 @@
import { OAuth2Error, Platform } from '../utils/Utils.js';
import { Log, Constants } from '../utils/index.js';
const TAG = 'OAuth2';
export default class OAuth2 {
#session;
YTTV_URL;
AUTH_SERVER_CODE_URL;
AUTH_SERVER_TOKEN_URL;
AUTH_SERVER_REVOKE_TOKEN_URL;
client_id;
oauth2_tokens;
constructor(session) {
this.#session = session;
this.YTTV_URL = new URL('/tv', Constants.URLS.YT_BASE);
this.AUTH_SERVER_CODE_URL = new URL('/o/oauth2/device/code', Constants.URLS.YT_BASE);
this.AUTH_SERVER_TOKEN_URL = new URL('/o/oauth2/token', Constants.URLS.YT_BASE);
this.AUTH_SERVER_REVOKE_TOKEN_URL = new URL('/o/oauth2/revoke', Constants.URLS.YT_BASE);
}
async init(tokens) {
if (tokens) {
this.setTokens(tokens);
if (this.shouldRefreshToken()) {
await this.refreshAccessToken();
}
this.#session.emit('auth', { credentials: this.oauth2_tokens });
return;
}
const loaded_from_cache = await this.#loadFromCache();
if (loaded_from_cache) {
Log.info(TAG, 'Loaded OAuth2 tokens from cache.', this.oauth2_tokens);
return;
}
if (!this.client_id)
this.client_id = await this.getClientID();
// Initialize OAuth2 flow
const device_and_user_code = await this.getDeviceAndUserCode();
this.#session.emit('auth-pending', device_and_user_code);
this.pollForAccessToken(device_and_user_code);
}
setTokens(tokens) {
const tokensMod = tokens;
// Convert access token remaining lifetime to ISO string
if (tokensMod.expires_in) {
tokensMod.expiry_date = new Date(Date.now() + tokensMod.expires_in * 1000).toISOString();
delete tokensMod.expires_in; // We don't need this anymore
}
if (!this.validateTokens(tokensMod))
throw new OAuth2Error('Invalid tokens provided.');
this.oauth2_tokens = tokensMod;
if (tokensMod.client) {
Log.info(TAG, 'Using provided client id and secret.');
this.client_id = tokensMod.client;
}
}
async cacheCredentials() {
const encoder = new TextEncoder();
const data = encoder.encode(JSON.stringify(this.oauth2_tokens));
await this.#session.cache?.set('youtubei_oauth_credentials', data.buffer);
}
async #loadFromCache() {
const data = await this.#session.cache?.get('youtubei_oauth_credentials');
if (!data)
return false;
const decoder = new TextDecoder();
const credentials = JSON.parse(decoder.decode(data));
this.setTokens(credentials);
this.#session.emit('auth', { credentials });
return true;
}
async removeCache() {
await this.#session.cache?.remove('youtubei_oauth_credentials');
}
pollForAccessToken(device_and_user_code) {
if (!this.client_id)
throw new OAuth2Error('Client ID is missing.');
const { device_code, interval } = device_and_user_code;
const { client_id, client_secret } = this.client_id;
const payload = {
client_id,
client_secret,
code: device_code,
grant_type: 'http://oauth.net/grant_type/device/1.0'
};
const connInterval = setInterval(async () => {
const response = await this.#http.fetch_function(this.AUTH_SERVER_TOKEN_URL, {
body: JSON.stringify(payload),
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
});
const response_data = await response.json();
if (response_data.error) {
switch (response_data.error) {
case 'access_denied':
this.#session.emit('auth-error', new OAuth2Error('Access was denied.', response_data));
clearInterval(connInterval);
break;
case 'expired_token':
this.#session.emit('auth-error', new OAuth2Error('The device code has expired.', response_data));
clearInterval(connInterval);
break;
case 'authorization_pending':
case 'slow_down':
Log.info(TAG, 'Polling for access token...');
break;
default:
this.#session.emit('auth-error', new OAuth2Error('Server returned an unexpected error.', response_data));
clearInterval(connInterval);
break;
}
return;
}
this.setTokens(response_data);
this.#session.emit('auth', { credentials: this.oauth2_tokens });
clearInterval(connInterval);
}, interval * 1000);
}
async revokeCredentials() {
if (!this.oauth2_tokens)
throw new OAuth2Error('Access token not found');
await this.removeCache();
const url = this.AUTH_SERVER_REVOKE_TOKEN_URL;
url.searchParams.set('token', this.oauth2_tokens.access_token);
return this.#session.http.fetch_function(url, { method: 'POST' });
}
async refreshAccessToken() {
if (!this.client_id)
this.client_id = await this.getClientID();
if (!this.oauth2_tokens)
throw new OAuth2Error('No tokens available to refresh.');
const { client_id, client_secret } = this.client_id;
const { refresh_token } = this.oauth2_tokens;
const payload = {
client_id,
client_secret,
refresh_token,
grant_type: 'refresh_token'
};
const response = await this.#http.fetch_function(this.AUTH_SERVER_TOKEN_URL, {
body: JSON.stringify(payload),
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
});
if (!response.ok)
throw new OAuth2Error(`Failed to refresh access token: ${response.status}`);
const response_data = await response.json();
if (response_data.error_code)
throw new OAuth2Error('Authorization server returned an error', response_data);
this.oauth2_tokens.access_token = response_data.access_token;
this.oauth2_tokens.expiry_date = new Date(Date.now() + response_data.expires_in * 1000).toISOString();
this.#session.emit('update-credentials', { credentials: this.oauth2_tokens });
}
async getDeviceAndUserCode() {
if (!this.client_id)
throw new OAuth2Error('Client ID is missing.');
const { client_id } = this.client_id;
const payload = {
client_id,
scope: 'http://gdata.youtube.com https://www.googleapis.com/auth/youtube-paid-content',
device_id: Platform.shim.uuidv4(),
device_model: 'ytlr::'
};
const response = await this.#http.fetch_function(this.AUTH_SERVER_CODE_URL, {
body: JSON.stringify(payload),
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
});
if (!response.ok)
throw new OAuth2Error(`Failed to get device/user code: ${response.status}`);
const response_data = await response.json();
if (response_data.error_code)
throw new OAuth2Error('Authorization server returned an error', response_data);
return response_data;
}
async getClientID() {
const yttv_response = await this.#http.fetch_function(this.YTTV_URL, {
headers: {
'User-Agent': 'Mozilla/5.0 (ChromiumStylePlatform) Cobalt/Version',
'Referer': 'https://www.youtube.com/tv',
'Accept-Language': 'en-US'
}
});
if (!yttv_response.ok)
throw new OAuth2Error(`Failed to get client ID: ${yttv_response.status}`);
const yttv_response_data = await yttv_response.text();
let script_url_body;
if ((script_url_body = Constants.OAUTH.REGEX.TV_SCRIPT.exec(yttv_response_data)) !== null) {
Log.info(TAG, `Got YouTubeTV script URL (${script_url_body[1]})`);
const script_response = await this.#http.fetch(script_url_body[1], { baseURL: Constants.URLS.YT_BASE });
if (!script_response.ok)
throw new OAuth2Error(`TV script request failed with status code ${script_response.status}`);
const script_response_data = await script_response.text();
const client_identity = script_response_data
.match(Constants.OAUTH.REGEX.CLIENT_IDENTITY);
if (!client_identity || !client_identity.groups)
throw new OAuth2Error('Could not obtain client ID.');
const { client_id, client_secret } = client_identity.groups;
Log.info(TAG, `Client identity retrieved (clientId=${client_id}, clientSecret=${client_secret}).`);
return {
client_id,
client_secret
};
}
throw new OAuth2Error('Could not obtain script URL.');
}
shouldRefreshToken() {
if (!this.oauth2_tokens)
return false;
return Date.now() > new Date(this.oauth2_tokens.expiry_date).getTime();
}
validateTokens(tokens) {
return !(!tokens.access_token || !tokens.refresh_token || !tokens.expiry_date);
}
get #http() {
return this.#session.http;
}
}
//# sourceMappingURL=OAuth2.js.map
File diff suppressed because one or more lines are too long
+25
View File
@@ -0,0 +1,25 @@
import type { FetchFunction, ICache } from '../types/index.js';
import type { BuildScriptResult } from '../utils/javascript/JsExtractor.js';
interface PlayerInitializationOptions {
cache?: ICache;
signature_timestamp: number;
data: BuildScriptResult;
}
/**
* Represents YouTube's player script. This is required to decipher signatures.
*/
export default class Player {
player_id: string;
signature_timestamp: number;
data?: BuildScriptResult | undefined;
po_token?: string;
constructor(player_id: string, signature_timestamp: number, data?: BuildScriptResult | undefined);
static create(cache: ICache | undefined, fetch?: FetchFunction, po_token?: string, player_id?: string): Promise<Player>;
decipher(url?: string, signature_cipher?: string, cipher?: string, this_response_nsig_cache?: Map<string, string>): Promise<string>;
static fromCache(cache: ICache, player_id: string): Promise<Player | null>;
static fromSource(player_id: string, options: PlayerInitializationOptions): Promise<Player>;
cache(cache?: ICache): Promise<void>;
get url(): string;
static get LIBRARY_VERSION(): number;
}
export {};
+213
View File
@@ -0,0 +1,213 @@
import { Constants, BinarySerializer, Log } from '../utils/index.js';
import { getRandomUserAgent, getStringBetweenStrings, getNsigProcessorFn, Platform, PlayerError } from '../utils/Utils.js';
import { JsExtractor, JsAnalyzer } from '../utils/index.js';
import { nsigMatcher, timestampMatcher } from '../utils/javascript/matchers.js';
import packageInfo from '../../package.json' with { type: 'json' };
const TAG = 'Player';
/**
* Represents YouTube's player script. This is required to decipher signatures.
*/
export default class Player {
player_id;
signature_timestamp;
data;
po_token;
constructor(player_id, signature_timestamp, data) {
this.player_id = player_id;
this.signature_timestamp = signature_timestamp;
this.data = data;
}
static async create(cache, fetch = Platform.shim.fetch, po_token, player_id) {
if (!player_id) {
const url = new URL('/iframe_api', Constants.URLS.YT_BASE);
const res = await fetch(url);
if (!res.ok)
throw new PlayerError(`Failed to get player id: ${res.status} (${res.statusText})`);
const js = await res.text();
player_id = getStringBetweenStrings(js, 'player\\/', '\\/');
}
Log.info(TAG, `Using player id (${player_id}). Checking for cached players..`);
if (!player_id)
throw new PlayerError('Failed to get player id');
// We have the player id, now we can check if we have a cached player.
if (cache) {
const cached_player = await Player.fromCache(cache, player_id);
if (cached_player) {
Log.info(TAG, 'Found up-to-date player data in cache.');
cached_player.po_token = po_token;
return cached_player;
}
}
const player_url = new URL(`/s/player/${player_id}/player_es6.vflset/en_US/base.js`, Constants.URLS.YT_BASE);
Log.info(TAG, `Could not find any cached player. Will download a new player from ${player_url}.`);
const player_res = await fetch(player_url, {
headers: {
'user-agent': getRandomUserAgent('desktop')
}
});
if (!player_res.ok) {
throw new PlayerError(`Failed to get player data: ${player_res.status}`);
}
const player_js = await player_res.text();
const nsigFunctionName = 'nsigFunction';
const timestampVarName = 'signatureTimestampVar';
const extractions = [
{ friendlyName: nsigFunctionName, match: nsigMatcher },
{ friendlyName: timestampVarName, match: timestampMatcher, collectDependencies: false }
];
const jsAnalyzer = new JsAnalyzer(player_js, { extractions });
const jsExtractor = new JsExtractor(jsAnalyzer);
const result = jsExtractor.buildScript({
disallowSideEffectInitializers: true,
exportRawValues: true,
rawValueOnly: [timestampVarName]
});
if (result.exportedRawValues && !(timestampVarName in result.exportedRawValues)) {
Log.warn(TAG, 'Failed to extract signature timestamp.');
}
if (!result.exported.includes(nsigFunctionName)) {
Log.warn(TAG, 'Failed to extract n/sig decipher function.');
}
const signatureTimestamp = result.exportedRawValues?.[timestampVarName];
const player = await Player.fromSource(player_id, {
cache,
signature_timestamp: parseInt(signatureTimestamp) || 0,
data: result
});
player.po_token = po_token;
return player;
}
async decipher(url, signature_cipher, cipher, this_response_nsig_cache) {
url = url || signature_cipher || cipher;
if (!url)
throw new PlayerError('No valid URL to decipher');
const args = new URLSearchParams(url);
const url_components = new URL(args.get('url') || url);
const n = url_components.searchParams.get('n');
const s = args.get('s');
const sp = args.get('sp');
if (this.data && ((signature_cipher || cipher) || n)) {
const eval_args = {};
if (signature_cipher || cipher) {
eval_args.sig = s;
eval_args.sp = sp;
}
if (n) {
if (this_response_nsig_cache?.has(n)) {
const nsig = this_response_nsig_cache.get(n);
url_components.searchParams.set('n', nsig);
}
else {
eval_args.n = n;
}
}
if (Object.keys(eval_args).length > 0) {
// Shallow copy to avoid mutating the original data.
const data = { ...this.data };
data.output = `${data.output}\n${getNsigProcessorFn(eval_args.n, eval_args.sp, eval_args.sig)}`;
const result = await Platform.shim.eval(data, eval_args);
if (typeof result !== 'object' || result === null) {
throw new PlayerError('Got invalid result from player script evaluation.');
}
if (typeof eval_args.sig === 'string') {
const signatureResult = result.sig;
Log.info(TAG, `Transformed signature from ${s} to ${signatureResult}.`);
if (typeof signatureResult !== 'string')
throw new PlayerError('Got invalid signature from player script evaluation.');
if (sp) {
url_components.searchParams.set(sp, signatureResult);
}
else {
url_components.searchParams.set('signature', signatureResult);
}
}
if (typeof eval_args.n === 'string') {
const nResult = result.n;
Log.info(TAG, `Transformed n from ${n} to ${nResult}.`);
if (typeof nResult !== 'string')
throw new PlayerError('Failed to decipher nsig');
if (nResult.startsWith('enhanced_except_')) {
Log.warn(TAG, `Decipher script returned an error (n=${n}):`, nResult);
}
else if (this_response_nsig_cache) {
this_response_nsig_cache.set(n, nResult);
}
url_components.searchParams.set('n', nResult);
}
}
}
// @NOTE: SABR requests should include the PoToken (not base64d, but as bytes!) in the payload.
if (url_components.searchParams.get('sabr') !== '1' && this.po_token)
url_components.searchParams.set('pot', this.po_token);
const client = url_components.searchParams.get('c');
switch (client) {
case 'WEB':
url_components.searchParams.set('cver', Constants.CLIENTS.WEB.VERSION);
break;
case 'MWEB':
url_components.searchParams.set('cver', Constants.CLIENTS.MWEB.VERSION);
break;
case 'WEB_REMIX':
url_components.searchParams.set('cver', Constants.CLIENTS.YTMUSIC.VERSION);
break;
case 'WEB_KIDS':
url_components.searchParams.set('cver', Constants.CLIENTS.WEB_KIDS.VERSION);
break;
case 'TVHTML5':
url_components.searchParams.set('cver', Constants.CLIENTS.TV.VERSION);
break;
case 'TVHTML5_SIMPLY':
url_components.searchParams.set('cver', Constants.CLIENTS.TV_SIMPLY.VERSION);
break;
case 'TVHTML5_SIMPLY_EMBEDDED_PLAYER':
url_components.searchParams.set('cver', Constants.CLIENTS.TV_EMBEDDED.VERSION);
break;
case 'WEB_EMBEDDED_PLAYER':
url_components.searchParams.set('cver', Constants.CLIENTS.WEB_EMBEDDED.VERSION);
break;
}
const result = url_components.toString();
Log.info(TAG, `Deciphered URL: ${result}`);
return url_components.toString();
}
static async fromCache(cache, player_id) {
const buffer = await cache.get(player_id);
if (!buffer)
return null;
try {
const deserializedCache = BinarySerializer.deserialize(new Uint8Array(buffer));
if (deserializedCache.libraryVersion !== packageInfo.version) {
Log.warn(TAG, `Cached player data is from a different library version (${deserializedCache.libraryVersion}). Ignoring it.`);
return null;
}
return new Player(deserializedCache.playerId, deserializedCache.signatureTimestamp, deserializedCache.data);
}
catch (e) {
Log.error(TAG, 'Failed to deserialize player data from cache:', e);
return null;
}
}
static async fromSource(player_id, options) {
const player = new Player(player_id, options.signature_timestamp, options.data);
await player.cache(options.cache);
return player;
}
async cache(cache) {
if (!cache || !this.data)
return;
const buffer = BinarySerializer.serialize({
playerId: this.player_id,
signatureTimestamp: this.signature_timestamp,
libraryVersion: packageInfo.version,
data: this.data
});
await cache.set(this.player_id, buffer);
}
get url() {
return new URL(`/s/player/${this.player_id}/player_ias.vflset/en_US/base.js`, Constants.URLS.YT_BASE).toString();
}
static get LIBRARY_VERSION() {
return 14;
}
}
//# sourceMappingURL=Player.js.map
File diff suppressed because one or more lines are too long
+277
View File
@@ -0,0 +1,277 @@
import Actions from './Actions.js';
import OAuth2 from './OAuth2.js';
import Player from './Player.js';
import { EventEmitter, HTTPClient } from '../utils/index.js';
import type { DeviceCategory } from '../utils/Utils.js';
import type { FetchFunction, ICache } from '../types/index.js';
import type { OAuth2Tokens, OAuth2AuthErrorEventHandler, OAuth2AuthPendingEventHandler, OAuth2AuthEventHandler } from './OAuth2.js';
export declare enum ClientType {
WEB = "WEB",
MWEB = "MWEB",
KIDS = "WEB_KIDS",
MUSIC = "WEB_REMIX",
IOS = "iOS",
ANDROID = "ANDROID",
ANDROID_VR = "ANDROID_VR",
ANDROID_MUSIC = "ANDROID_MUSIC",
ANDROID_CREATOR = "ANDROID_CREATOR",
TV = "TVHTML5",
TV_SIMPLY = "TVHTML5_SIMPLY",
TV_EMBEDDED = "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
WEB_EMBEDDED = "WEB_EMBEDDED_PLAYER",
WEB_CREATOR = "WEB_CREATOR"
}
export type Context = {
client: {
hl: string;
gl: string;
remoteHost?: string;
screenDensityFloat?: number;
screenHeightPoints?: number;
screenPixelDensity?: number;
screenWidthPoints?: number;
visitorData?: string;
clientName: string;
clientVersion: string;
clientScreen?: string;
androidSdkVersion?: number;
osName: string;
osVersion: string;
platform: string;
clientFormFactor: string;
userInterfaceTheme?: string;
timeZone: string;
userAgent: string;
browserName?: string;
browserVersion?: string;
originalUrl?: string;
deviceMake: string;
deviceModel: string;
deviceExperimentId?: string;
rolloutToken?: string;
utcOffsetMinutes: number;
mainAppWebInfo?: {
graftUrl: string;
pwaInstallabilityStatus: string;
webDisplayMode: string;
isWebNativeShareAvailable: boolean;
};
memoryTotalKbytes?: string;
configInfo?: {
appInstallData?: string;
coldConfigData?: string;
coldHashData?: string;
hotHashData?: string;
};
kidsAppInfo?: {
categorySettings: {
enabledCategories: string[];
};
contentSettings: {
corpusPreference: string;
kidsNoSearchMode: string;
};
};
};
user: {
enableSafetyMode: boolean;
lockedSafetyMode: boolean;
onBehalfOfUser?: string;
};
thirdParty?: {
embedUrl: string;
};
request?: {
useSsl: boolean;
internalExperimentFlags: any[];
};
};
type ContextData = {
hl: string;
gl: string;
remote_host?: string;
visitor_data: string;
client_name: string;
client_version: string;
user_agent: string;
os_name: string;
os_version: string;
device_category: string;
time_zone: string;
enable_safety_mode: boolean;
browser_name?: string;
browser_version?: string;
app_install_data?: string;
device_make: string;
device_model: string;
on_behalf_of_user?: string;
device_experiment_id?: string;
rollout_token?: string;
};
export type SessionOptions = {
/**
* Language.
*/
lang?: string;
/**
* Geolocation.
*/
location?: string;
/**
* User agent (InnerTube requests only).
*/
user_agent?: string;
/**
* The account index to use. This is useful if you have multiple accounts logged in.
*
* **NOTE:** Only works if you are signed in with cookies.
*/
account_index?: number;
/**
* Specify the Page ID of the YouTube profile/channel to use, if the logged-in account has multiple profiles.
*/
on_behalf_of_user?: string;
/**
* Specifies whether to retrieve the JS player. Disabling this will make session creation faster.
*
* **NOTE:** Deciphering formats is not possible without the JS player.
*/
retrieve_player?: boolean;
/**
* Specifies whether to enable safety mode. This will prevent the session from loading any potentially unsafe content.
*/
enable_safety_mode?: boolean;
/**
* Specifies whether to retrieve the InnerTube config. Useful for "onesie" requests.
*/
retrieve_innertube_config?: boolean;
/**
* Specifies whether to generate the session data locally or retrieve it from YouTube.
* This can be useful if you need more performance.
*
* **NOTE:** If you are using the cache option and a session has already been generated, this will be ignored.
* If you want to force a new session to be generated, you must clear the cache or disable session caching.
*/
generate_session_locally?: boolean;
/**
* If set to `true`, session creation will fail if it's not possible to retrieve session data from YouTube.
* If `false`, a local fallback will be used.
*/
fail_fast?: boolean;
/**
* Specifies whether the session data should be cached.
*/
enable_session_cache?: boolean;
/**
* Platform to use for the session.
*/
device_category?: DeviceCategory;
/**
* InnerTube client type.
*/
client_type?: ClientType;
/**
* The time zone.
*/
timezone?: string;
/**
* Used to cache algorithms, session data, and OAuth2 tokens.
*/
cache?: ICache;
/**
* YouTube cookies.
*/
cookie?: string;
/**
* Setting this to a valid and persistent visitor data string will allow YouTube to give this session tailored content even when not logged in.
* A good way to get a valid one is by either grabbing it from a browser or calling InnerTube's `/visitor_id` endpoint.
*/
visitor_data?: string;
/**
* Fetch function to use.
*/
fetch?: FetchFunction;
/**
* Session bound Proof of Origin Token. This is an attestation token generated by BotGuard/DroidGuard. It is used to confirm that the request is coming from a real client.
*/
po_token?: string;
/**
* Player ID override.
* In most cases, this isn't necessary; but when YouTube introduces breaking changes,
* forcing an older Player ID can help work around temporary issues.
*/
player_id?: string;
};
export type SessionData = {
context: Context;
api_key: string;
api_version: string;
config_data?: string;
};
export type SWSessionData = {
context_data: ContextData;
api_key: string;
api_version: string;
};
export type SessionArgs = {
lang: string;
location: string;
time_zone: string;
user_agent: string;
device_category: DeviceCategory;
client_name: ClientType;
enable_safety_mode: boolean;
visitor_data: string;
on_behalf_of_user: string | undefined;
};
/**
* Represents an InnerTube session. This holds all the data needed to make requests to YouTube.
*/
export default class Session extends EventEmitter {
#private;
context: Context;
api_key: string;
api_version: string;
account_index: number;
config_data?: string | undefined;
player?: Player | undefined;
cookie?: string | undefined;
cache?: ICache | undefined;
po_token?: string | undefined;
oauth: OAuth2;
http: HTTPClient;
logged_in: boolean;
actions: Actions;
user_agent?: string;
constructor(context: Context, api_key: string, api_version: string, account_index: number, config_data?: string | undefined, player?: Player | undefined, cookie?: string | undefined, fetch?: FetchFunction, cache?: ICache | undefined, po_token?: string | undefined);
on(type: 'auth', listener: OAuth2AuthEventHandler): void;
on(type: 'auth-pending', listener: OAuth2AuthPendingEventHandler): void;
on(type: 'auth-error', listener: OAuth2AuthErrorEventHandler): void;
on(type: 'update-credentials', listener: OAuth2AuthEventHandler): void;
once(type: 'auth', listener: OAuth2AuthEventHandler): void;
once(type: 'auth-pending', listener: OAuth2AuthPendingEventHandler): void;
once(type: 'auth-error', listener: OAuth2AuthErrorEventHandler): void;
static create(options?: SessionOptions): Promise<Session>;
/**
* Retrieves session data from cache.
* @param cache - A valid cache implementation.
* @param session_args - User provided session arguments.
*/
static fromCache(cache: ICache, session_args: SessionArgs): Promise<SessionData | null>;
static getSessionData(lang?: string, location?: string, account_index?: number, visitor_data?: string, user_agent?: string, enable_safety_mode?: boolean, generate_session_locally?: boolean, fail_fast?: boolean, device_category?: DeviceCategory, client_name?: ClientType, tz?: string, fetch?: FetchFunction, on_behalf_of_user?: string, cache?: ICache, enable_session_cache?: boolean, po_token?: string, retrieve_innertube_config?: boolean): Promise<{
account_index: number;
context: Context;
api_key: string;
api_version: string;
config_data?: string;
}>;
signIn(credentials?: OAuth2Tokens): Promise<void>;
/**
* Signs out of the current account and revokes the credentials.
*/
signOut(): Promise<Response | undefined>;
get client_version(): string;
get client_name(): string;
get lang(): string;
}
export {};
+371
View File
@@ -0,0 +1,371 @@
import Actions from './Actions.js';
import OAuth2 from './OAuth2.js';
import Player from './Player.js';
import * as Constants from '../utils/Constants.js';
import { EventEmitter, HTTPClient, BinarySerializer, Log, ProtoUtils } from '../utils/index.js';
import { generateRandomString, getRandomUserAgent, InnertubeError, Platform, SessionError } from '../utils/Utils.js';
import packageInfo from '../../package.json' with { type: 'json' };
export const ClientType = {
WEB: "WEB",
MWEB: "MWEB",
KIDS: "WEB_KIDS",
MUSIC: "WEB_REMIX",
IOS: "iOS",
ANDROID: "ANDROID",
ANDROID_VR: "ANDROID_VR",
ANDROID_MUSIC: "ANDROID_MUSIC",
ANDROID_CREATOR: "ANDROID_CREATOR",
TV: "TVHTML5",
TV_SIMPLY: "TVHTML5_SIMPLY",
TV_EMBEDDED: "TVHTML5_SIMPLY_EMBEDDED_PLAYER",
WEB_EMBEDDED: "WEB_EMBEDDED_PLAYER",
WEB_CREATOR: "WEB_CREATOR"
};
const TAG = 'Session';
/**
* Represents an InnerTube session. This holds all the data needed to make requests to YouTube.
*/
export default class Session extends EventEmitter {
context;
api_key;
api_version;
account_index;
config_data;
player;
cookie;
cache;
po_token;
oauth;
http;
logged_in;
actions;
user_agent;
constructor(context, api_key, api_version, account_index, config_data, player, cookie, fetch, cache, po_token) {
super();
this.context = context;
this.api_key = api_key;
this.api_version = api_version;
this.account_index = account_index;
this.config_data = config_data;
this.player = player;
this.cookie = cookie;
this.cache = cache;
this.po_token = po_token;
this.http = new HTTPClient(this, cookie, fetch);
this.actions = new Actions(this);
this.oauth = new OAuth2(this);
this.logged_in = !!cookie;
this.user_agent = context.client.userAgent;
}
on(type, listener) {
super.on(type, listener);
}
once(type, listener) {
super.once(type, listener);
}
static async create(options = {}) {
const { context, api_key, api_version, account_index, config_data } = await Session.getSessionData(options.lang, options.location, options.account_index, options.visitor_data, options.user_agent, options.enable_safety_mode, options.generate_session_locally, options.fail_fast, options.device_category, options.client_type, options.timezone, options.fetch, options.on_behalf_of_user, options.cache, options.enable_session_cache, options.po_token, options.retrieve_innertube_config);
return new Session(context, api_key, api_version, account_index, config_data, options.retrieve_player === false ? undefined : await Player.create(options.cache, options.fetch, options.po_token, options.player_id), options.cookie, options.fetch, options.cache, options.po_token);
}
/**
* Retrieves session data from cache.
* @param cache - A valid cache implementation.
* @param session_args - User provided session arguments.
*/
static async fromCache(cache, session_args) {
const buffer = await cache.get('innertube_session_data');
if (!buffer)
return null;
try {
const session_data = BinarySerializer.deserialize(new Uint8Array(buffer));
if (session_data.library_version !== parseInt(packageInfo.version.split('.', 1)[0])) {
Log.warn(TAG, `Cached session data is from a different library version (${session_data.library_version}). Regenerating session data.`);
return null;
}
if (session_args.visitor_data) {
session_data.context.client.visitorData = session_args.visitor_data;
}
if (session_args.lang)
session_data.context.client.hl = session_args.lang;
if (session_args.location)
session_data.context.client.gl = session_args.location;
if (session_args.on_behalf_of_user)
session_data.context.user.onBehalfOfUser = session_args.on_behalf_of_user;
if (session_args.user_agent)
session_data.context.client.userAgent = session_args.user_agent;
if (session_args.client_name) {
const client = Object.values(Constants.CLIENTS).find((c) => c.NAME === session_args.client_name);
if (client) {
session_data.context.client.clientName = client.NAME;
session_data.context.client.clientVersion = client.VERSION;
}
else
Log.warn(TAG, `Unknown client name: ${session_args.client_name}.`);
}
session_data.context.client.timeZone = session_args.time_zone;
session_data.context.client.platform = session_args.device_category.toUpperCase();
session_data.context.user.enableSafetyMode = session_args.enable_safety_mode;
return session_data;
}
catch (error) {
Log.error(TAG, 'Failed to deserialize session data from cache.', error);
return null;
}
}
static async getSessionData(lang = '', location = '', account_index = 0, visitor_data = '', user_agent = getRandomUserAgent('desktop'), enable_safety_mode = false, generate_session_locally = false, fail_fast = false, device_category = 'desktop', client_name = ClientType.WEB, tz = Intl.DateTimeFormat().resolvedOptions().timeZone, fetch = Platform.shim.fetch, on_behalf_of_user, cache, enable_session_cache = true, po_token, retrieve_innertube_config = true) {
const session_args = {
lang,
location,
time_zone: tz,
user_agent,
device_category,
client_name,
enable_safety_mode,
visitor_data,
on_behalf_of_user,
po_token
};
let session_data;
if (cache && enable_session_cache) {
const cached_session_data = await this.fromCache(cache, session_args);
if (cached_session_data) {
Log.info(TAG, 'Found session data in cache.');
session_data = cached_session_data;
}
}
if (!session_data) {
Log.info(TAG, 'Generating session data.');
let api_key = Constants.CLIENTS.WEB.API_KEY;
let api_version = Constants.CLIENTS.WEB.API_VERSION;
let context_data = {
hl: lang || 'en',
gl: location || 'US',
remote_host: '',
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).find((v) => v.NAME === client_name)?.VERSION ?? Constants.CLIENTS.WEB.VERSION,
device_category: device_category.toUpperCase(),
os_name: 'Windows',
os_version: '10.0',
time_zone: tz,
browser_name: 'Chrome',
browser_version: '125.0.0.0',
device_make: '',
device_model: '',
enable_safety_mode: enable_safety_mode
};
if (!generate_session_locally) {
try {
const sw_session_data = await this.#getSessionData(session_args, fetch);
api_key = sw_session_data.api_key;
api_version = sw_session_data.api_version;
context_data = sw_session_data.context_data;
}
catch (error) {
if (fail_fast)
throw error;
Log.error(TAG, 'Failed to retrieve session data from server. Session data generated locally will be used instead.', error);
}
}
if (on_behalf_of_user) {
context_data.on_behalf_of_user = on_behalf_of_user;
}
session_data = {
api_key,
api_version,
context: this.#buildContext(context_data)
};
if (retrieve_innertube_config) {
try {
Log.info(TAG, 'Retrieving InnerTube config data.');
const config_headers = {
'Accept-Language': lang,
'Accept': '*/*',
'Referer': Constants.URLS.YT_BASE,
'X-Goog-Visitor-Id': context_data.visitor_data,
'X-Origin': Constants.URLS.YT_BASE,
'X-Youtube-Client-Version': context_data.client_version
};
if (Platform.shim.server) {
config_headers['User-Agent'] = user_agent;
config_headers['Origin'] = Constants.URLS.YT_BASE;
}
const config = await fetch(`${Constants.URLS.API.PRODUCTION_1}v1/config?prettyPrint=false`, {
headers: config_headers,
method: 'POST',
body: JSON.stringify({ context: session_data.context })
});
const configJson = await config.json();
const coldConfigData = configJson.responseContext?.globalConfigGroup?.rawColdConfigGroup?.configData;
const coldHashData = configJson.responseContext?.globalConfigGroup?.coldHashData;
const hotHashData = configJson.responseContext?.globalConfigGroup?.hotHashData;
session_data.config_data = configJson.configData;
session_data.context.client.configInfo = {
...session_data.context.client.configInfo,
coldConfigData,
coldHashData,
hotHashData
};
}
catch (error) {
Log.error(TAG, 'Failed to retrieve config data.', error);
}
}
if (enable_session_cache)
await this.#storeSession(session_data, cache);
}
Log.debug(TAG, 'Session data:', session_data);
return { ...session_data, account_index };
}
static async #storeSession(session_data, cache) {
if (!cache)
return;
Log.info(TAG, 'Compressing and caching session data.');
const buffer = BinarySerializer.serialize({
...session_data,
library_version: parseInt(packageInfo.version)
});
await cache.set('innertube_session_data', buffer);
}
static async #getSessionData(options, fetch = Platform.shim.fetch) {
let visitor_id = generateRandomString(11);
if (options.visitor_data)
visitor_id = this.#getVisitorID(options.visitor_data);
const url = new URL('/sw.js_data', Constants.URLS.YT_BASE);
const res = await fetch(url, {
headers: {
'Accept-Language': options.lang || 'en-US',
'User-Agent': options.user_agent,
'Accept': '*/*',
'Referer': `${Constants.URLS.YT_BASE}/sw.js`,
'Cookie': `PREF=tz=${options.time_zone.replace('/', '.')};VISITOR_INFO1_LIVE=${visitor_id};`
}
});
if (!res.ok)
throw new SessionError(`Failed to retrieve session data: ${res.status}`);
const text = await res.text();
if (!text.startsWith(')]}\''))
throw new SessionError('Invalid JSPB response');
const data = JSON.parse(text.replace(/^\)\]\}'/, ''));
const ytcfg = data[0][2];
const api_version = Constants.CLIENTS.WEB.API_VERSION;
const [[device_info], api_key] = ytcfg;
const config_info = device_info[61];
const app_install_data = config_info[config_info.length - 1];
const context_info = {
hl: options.lang || device_info[0],
gl: options.location || device_info[1],
remote_host: device_info[3],
visitor_data: options.visitor_data || device_info[13],
user_agent: options.user_agent,
client_name: options.client_name,
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,
device_category: options.device_category,
browser_name: device_info[86],
browser_version: device_info[87],
device_make: device_info[11],
device_model: device_info[12],
app_install_data: app_install_data,
device_experiment_id: device_info[103],
rollout_token: device_info[107],
enable_safety_mode: options.enable_safety_mode
};
return { context_data: context_info, api_key, api_version };
}
static #buildContext(args) {
const context = {
client: {
hl: args.hl || 'en',
gl: args.gl || 'US',
remoteHost: args.remote_host,
screenDensityFloat: 1,
screenHeightPoints: 1440,
screenPixelDensity: 1,
screenWidthPoints: 2560,
visitorData: args.visitor_data,
clientName: args.client_name,
clientVersion: args.client_version,
osName: args.os_name,
osVersion: args.os_version,
userAgent: args.user_agent,
platform: args.device_category.toUpperCase(),
clientFormFactor: 'UNKNOWN_FORM_FACTOR',
userInterfaceTheme: 'USER_INTERFACE_THEME_LIGHT',
timeZone: args.time_zone,
originalUrl: Constants.URLS.YT_BASE,
deviceMake: args.device_make,
deviceModel: args.device_model,
browserName: args.browser_name,
browserVersion: args.browser_version,
utcOffsetMinutes: -Math.floor((new Date()).getTimezoneOffset()),
memoryTotalKbytes: '8000000',
rolloutToken: args.rollout_token,
deviceExperimentId: args.device_experiment_id,
mainAppWebInfo: {
graftUrl: Constants.URLS.YT_BASE,
pwaInstallabilityStatus: 'PWA_INSTALLABILITY_STATUS_UNKNOWN',
webDisplayMode: 'WEB_DISPLAY_MODE_BROWSER',
isWebNativeShareAvailable: true
}
},
user: {
enableSafetyMode: args.enable_safety_mode,
lockedSafetyMode: false
},
request: {
useSsl: true,
internalExperimentFlags: []
}
};
if (args.app_install_data)
context.client.configInfo = { appInstallData: args.app_install_data };
if (args.on_behalf_of_user)
context.user.onBehalfOfUser = args.on_behalf_of_user;
return context;
}
static #getVisitorID(visitor_data) {
const decoded_visitor_data = ProtoUtils.decodeVisitorData(visitor_data);
return decoded_visitor_data.id;
}
async signIn(credentials) {
return new Promise(async (resolve, reject) => {
const error_handler = (err) => reject(err);
this.once('auth-error', error_handler);
this.once('auth', () => {
this.off('auth-error', error_handler);
this.logged_in = true;
resolve();
});
try {
await this.oauth.init(credentials);
}
catch (err) {
reject(err);
}
});
}
/**
* Signs out of the current account and revokes the credentials.
*/
async signOut() {
if (!this.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const response = await this.oauth.revokeCredentials();
this.logged_in = false;
return response;
}
get client_version() {
return this.context.client.clientVersion;
}
get client_name() {
return this.context.client.clientName;
}
get lang() {
return this.context.client.hl;
}
}
//# sourceMappingURL=Session.js.map
File diff suppressed because one or more lines are too long
+18
View File
@@ -0,0 +1,18 @@
import { Channel, HomeFeed, Search, VideoInfo } from '../../parser/ytkids/index.js';
import type { Session, ApiResponse } from '../index.js';
import type { GetVideoInfoOptions } from '../../types/index.js';
export default class Kids {
#private;
constructor(session: Session);
search(query: string): Promise<Search>;
getInfo(video_id: string, options?: Omit<GetVideoInfoOptions, 'client'>): Promise<VideoInfo>;
getChannel(channel_id: string): Promise<Channel>;
getHomeFeed(): Promise<HomeFeed>;
/**
* Retrieves the list of supervised accounts that the signed-in user has
* access to, and blocks the given channel for each of them.
* @param channel_id - The channel id to block.
* @returns A list of API responses.
*/
blockChannel(channel_id: string): Promise<ApiResponse[]>;
}
+94
View File
@@ -0,0 +1,94 @@
import { Parser } from '../../parser/index.js';
import { Channel, HomeFeed, Search, VideoInfo } from '../../parser/ytkids/index.js';
import NavigationEndpoint from '../../parser/classes/NavigationEndpoint.js';
import KidsBlocklistPickerItem from '../../parser/classes/ytkids/KidsBlocklistPickerItem.js';
import { InnertubeError, generateRandomString } from '../../utils/Utils.js';
export default class Kids {
#session;
constructor(session) {
this.#session = session;
}
async search(query) {
const search_endpoint = new NavigationEndpoint({ searchEndpoint: { query } });
const response = await search_endpoint.call(this.#session.actions, { client: 'YTKIDS' });
return new Search(this.#session.actions, response);
}
async getInfo(video_id, options) {
const payload = { videoId: video_id };
const watch_endpoint = new NavigationEndpoint({ watchEndpoint: payload });
const watch_next_endpoint = new NavigationEndpoint({ watchNextEndpoint: payload });
const session = this.#session;
const extra_payload = {
playbackContext: {
contentPlaybackContext: {
vis: 0,
splay: false,
lactMilliseconds: '-1',
signatureTimestamp: session.player?.signature_timestamp
}
},
client: 'YTKIDS'
};
if (options?.po_token) {
extra_payload.serviceIntegrityDimensions = {
poToken: options.po_token
};
}
else if (session.po_token) {
extra_payload.serviceIntegrityDimensions = {
poToken: session.po_token
};
}
const watch_response = watch_endpoint.call(session.actions, extra_payload);
const watch_next_response = watch_next_endpoint.call(session.actions, { client: 'YTKIDS' });
const response = await Promise.all([watch_response, watch_next_response]);
const cpn = generateRandomString(16);
return new VideoInfo(response, session.actions, cpn);
}
async getChannel(channel_id) {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: channel_id } });
const response = await browse_endpoint.call(this.#session.actions, { client: 'YTKIDS' });
return new Channel(this.#session.actions, response);
}
async getHomeFeed() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEkids_home' } });
const response = await browse_endpoint.call(this.#session.actions, { client: 'YTKIDS' });
return new HomeFeed(this.#session.actions, response);
}
/**
* Retrieves the list of supervised accounts that the signed-in user has
* access to, and blocks the given channel for each of them.
* @param channel_id - The channel id to block.
* @returns A list of API responses.
*/
async blockChannel(channel_id) {
const session = this.#session;
if (!session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const kids_blocklist_picker_command = new NavigationEndpoint({
getKidsBlocklistPickerCommand: {
blockedForKidsContent: {
external_channel_id: channel_id
}
}
});
const response = await kids_blocklist_picker_command.call(session.actions, { client: 'YTKIDS' });
const popup = response.data.command.confirmDialogEndpoint;
const popup_fragment = { contents: popup.content, engagementPanels: [] };
const kid_picker = Parser.parseResponse(popup_fragment);
const kids = kid_picker.contents_memo?.getType(KidsBlocklistPickerItem);
if (!kids)
throw new InnertubeError('Could not find any kids profiles or supervised accounts.');
// Iterate through the kids and block the channel if not already blocked.
const responses = [];
for (const kid of kids) {
if (!kid.block_button?.is_toggled) {
kid.setActions(session.actions);
// Block channel and add to the response list.
responses.push(await kid.blockChannel());
}
}
return responses;
}
}
//# sourceMappingURL=Kids.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Kids.js","sourceRoot":"","sources":["../../../../src/core/clients/Kids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,kBAAkB,MAAM,4CAA4C,CAAC;AAC5E,OAAO,uBAAuB,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAI5E,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB,QAAQ,CAAU;IAElB,YAAY,OAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,M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HomeFeed, Library, Playlist, Recap, Search, TrackInfo } from '../../parser/ytmusic/index.js';
import Message from '../../parser/classes/Message.js';
import MusicDescriptionShelf from '../../parser/classes/MusicDescriptionShelf.js';
import MusicResponsiveListItem from '../../parser/classes/MusicResponsiveListItem.js';
import MusicTwoRowItem from '../../parser/classes/MusicTwoRowItem.js';
import NavigationEndpoint from '../../parser/classes/NavigationEndpoint.js';
import PlaylistPanel from '../../parser/classes/PlaylistPanel.js';
import SearchSuggestionsSection from '../../parser/classes/SearchSuggestionsSection.js';
import SectionList from '../../parser/classes/SectionList.js';
import type { ObservedArray } from '../../parser/helpers.js';
import type { GetVideoInfoOptions, MusicSearchFilters } from '../../types/index.js';
import type { Session } from '../index.js';
export default class Music {
#private;
constructor(session: Session);
/**
* Retrieves track info. Passing a list item of type MusicTwoRowItem automatically starts a radio.
* @param target - Video id or a list item.
* @param options - Options for fetching video info.
*/
getInfo(target: string | MusicTwoRowItem | MusicResponsiveListItem | NavigationEndpoint, options?: Omit<GetVideoInfoOptions, 'client'>): Promise<TrackInfo>;
search(query: string, filters?: MusicSearchFilters): Promise<Search>;
getHomeFeed(): Promise<HomeFeed>;
getExplore(): Promise<Explore>;
getLibrary(): Promise<Library>;
getArtist(artist_id: string): Promise<Artist>;
getAlbum(album_id: string): Promise<Album>;
getPlaylist(playlist_id: string): Promise<Playlist>;
getUpNext(video_id: string, automix?: boolean): Promise<PlaylistPanel>;
getRelated(video_id: string): Promise<SectionList | Message>;
getLyrics(video_id: string): Promise<MusicDescriptionShelf | undefined>;
getRecap(): Promise<Recap>;
getSearchSuggestions(input: string): Promise<ObservedArray<SearchSuggestionsSection>>;
}
+230
View File
@@ -0,0 +1,230 @@
import { generateRandomString, InnertubeError, throwIfMissing, u8ToBase64 } from '../../utils/Utils.js';
import { Album, Artist, Explore, HomeFeed, Library, Playlist, Recap, Search, TrackInfo } from '../../parser/ytmusic/index.js';
import AutomixPreviewVideo from '../../parser/classes/AutomixPreviewVideo.js';
import Message from '../../parser/classes/Message.js';
import MusicDescriptionShelf from '../../parser/classes/MusicDescriptionShelf.js';
import MusicQueue from '../../parser/classes/MusicQueue.js';
import MusicResponsiveListItem from '../../parser/classes/MusicResponsiveListItem.js';
import MusicTwoRowItem from '../../parser/classes/MusicTwoRowItem.js';
import NavigationEndpoint from '../../parser/classes/NavigationEndpoint.js';
import PlaylistPanel from '../../parser/classes/PlaylistPanel.js';
import SearchSuggestionsSection from '../../parser/classes/SearchSuggestionsSection.js';
import SectionList from '../../parser/classes/SectionList.js';
import Tab from '../../parser/classes/Tab.js';
import { SearchFilter } from '../../../protos/generated/misc/params.js';
export default class Music {
#session;
#actions;
constructor(session) {
this.#session = session;
this.#actions = session.actions;
}
/**
* Retrieves track info. Passing a list item of type MusicTwoRowItem automatically starts a radio.
* @param target - Video id or a list item.
* @param options - Options for fetching video info.
*/
getInfo(target, options) {
if (target instanceof MusicTwoRowItem) {
return this.#fetchInfoFromEndpoint(target.endpoint, options);
}
else if (target instanceof MusicResponsiveListItem) {
return this.#fetchInfoFromEndpoint(target.overlay?.content?.endpoint ?? target.endpoint, options);
}
else if (target instanceof NavigationEndpoint) {
return this.#fetchInfoFromEndpoint(target, options);
}
return this.#fetchInfoFromVideoId(target, options);
}
async #fetchInfoFromVideoId(video_id, options) {
const payload = { videoId: video_id, racyCheckOk: true, contentCheckOk: true };
const watch_endpoint = new NavigationEndpoint({ watchEndpoint: payload });
const watch_next_endpoint = new NavigationEndpoint({ watchNextEndpoint: payload });
const extra_payload = {
playbackContext: {
contentPlaybackContext: {
vis: 0,
splay: false,
lactMilliseconds: '-1',
signatureTimestamp: this.#session.player?.signature_timestamp
}
},
client: 'YTMUSIC'
};
if (options?.po_token) {
extra_payload.serviceIntegrityDimensions = {
poToken: options.po_token
};
}
else if (this.#session.po_token) {
extra_payload.serviceIntegrityDimensions = {
poToken: this.#session.po_token
};
}
const watch_response = watch_endpoint.call(this.#actions, extra_payload);
const watch_next_response = watch_next_endpoint.call(this.#actions, { client: 'YTMUSIC' });
const response = await Promise.all([watch_response, watch_next_response]);
const cpn = generateRandomString(16);
return new TrackInfo(response, this.#actions, cpn);
}
async #fetchInfoFromEndpoint(endpoint, options) {
if (!endpoint)
throw new Error('This item does not have an endpoint.');
const extra_payload = {
playbackContext: {
contentPlaybackContext: {
vis: 0,
splay: false,
lactMilliseconds: '-1',
signatureTimestamp: this.#session.player?.signature_timestamp
}
},
client: 'YTMUSIC'
};
if (options?.po_token) {
extra_payload.serviceIntegrityDimensions = {
poToken: options.po_token
};
}
else if (this.#session.po_token) {
extra_payload.serviceIntegrityDimensions = {
poToken: this.#session.po_token
};
}
const player_response = endpoint.call(this.#actions, extra_payload);
const next_response = endpoint.call(this.#actions, {
client: 'YTMUSIC',
enablePersistentPlaylistPanel: true,
override_endpoint: '/next'
});
const cpn = generateRandomString(16);
const response = await Promise.all([player_response, next_response]);
return new TrackInfo(response, this.#actions, cpn);
}
async search(query, filters = {}) {
throwIfMissing({ query });
let params;
if (filters.type && filters.type !== 'all') {
const writer = SearchFilter.encode({
filters: {
musicSearchType: {
[filters.type]: true
}
}
});
params = encodeURIComponent(u8ToBase64(writer.finish()));
}
const search_endpoint = new NavigationEndpoint({ searchEndpoint: { query, params } });
const response = await search_endpoint.call(this.#actions, { client: 'YTMUSIC' });
return new Search(response, this.#actions, Reflect.has(filters, 'type') && filters.type !== 'all');
}
async getHomeFeed() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEmusic_home' } });
const response = await browse_endpoint.call(this.#actions, { client: 'YTMUSIC' });
return new HomeFeed(response, this.#actions);
}
async getExplore() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEmusic_explore' } });
const response = await browse_endpoint.call(this.#actions, { client: 'YTMUSIC' });
return new Explore(response);
// TODO: return new Explore(response, this.#actions);
}
async getLibrary() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEmusic_library_landing' } });
const response = await browse_endpoint.call(this.#actions, { client: 'YTMUSIC' });
return new Library(response, this.#actions);
}
async getArtist(artist_id) {
if (!artist_id || !artist_id.startsWith('UC') && !artist_id.startsWith('FEmusic_library_privately_owned_artist'))
throw new InnertubeError('Invalid artist id', artist_id);
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: artist_id } });
const response = await browse_endpoint.call(this.#actions, { client: 'YTMUSIC' });
return new Artist(response, this.#actions);
}
async getAlbum(album_id) {
if (!album_id || !album_id.startsWith('MPR') && !album_id.startsWith('FEmusic_library_privately_owned_release'))
throw new InnertubeError('Invalid album id', album_id);
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: album_id } });
const response = await browse_endpoint.call(this.#actions, { client: 'YTMUSIC' });
return new Album(response);
}
async getPlaylist(playlist_id) {
if (!playlist_id.startsWith('VL'))
playlist_id = `VL${playlist_id}`;
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: playlist_id } });
const response = await browse_endpoint.call(this.#actions, { client: 'YTMUSIC' });
return new Playlist(response, this.#actions);
}
async getUpNext(video_id, automix = true) {
throwIfMissing({ video_id });
const watch_next_endpoint = new NavigationEndpoint({ watchNextEndpoint: { videoId: video_id } });
const response = await watch_next_endpoint.call(this.#actions, { client: 'YTMUSIC', parse: true });
const tabs = response.contents_memo?.getType(Tab);
const tab = tabs?.[0];
if (!tab)
throw new InnertubeError('Could not find target tab.');
const music_queue = tab.content?.as(MusicQueue);
if (!music_queue || !music_queue.content)
throw new InnertubeError('Music queue was empty, the given id is probably invalid.', music_queue);
const playlist_panel = music_queue.content.as(PlaylistPanel);
if (!playlist_panel.playlist_id && automix) {
const automix_preview_video = playlist_panel.contents.firstOfType(AutomixPreviewVideo);
if (!automix_preview_video)
throw new InnertubeError('Automix item not found');
const page = await automix_preview_video.playlist_video?.endpoint.call(this.#actions, {
videoId: video_id,
client: 'YTMUSIC',
parse: true
});
if (!page || !page.contents_memo)
throw new InnertubeError('Could not fetch automix');
return page.contents_memo.getType(PlaylistPanel)[0];
}
return playlist_panel;
}
async getRelated(video_id) {
throwIfMissing({ video_id });
const watch_next_endpoint = new NavigationEndpoint({ watchNextEndpoint: { videoId: video_id } });
const response = await watch_next_endpoint.call(this.#actions, { client: 'YTMUSIC', parse: true });
const tabs = response.contents_memo?.getType(Tab);
const tab = tabs?.find((tab) => tab.endpoint.payload.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType === 'MUSIC_PAGE_TYPE_TRACK_RELATED');
if (!tab)
throw new InnertubeError('Could not find target tab.');
const page = await tab.endpoint.call(this.#actions, { client: 'YTMUSIC', parse: true });
if (!page.contents)
throw new InnertubeError('Unexpected response', page);
return page.contents.item().as(SectionList, Message);
}
async getLyrics(video_id) {
throwIfMissing({ video_id });
const watch_next_endpoint = new NavigationEndpoint({ watchNextEndpoint: { videoId: video_id } });
const response = await watch_next_endpoint.call(this.#actions, { client: 'YTMUSIC', parse: true });
const tabs = response.contents_memo?.getType(Tab);
const tab = tabs?.find((tab) => tab.endpoint.payload.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType === 'MUSIC_PAGE_TYPE_TRACK_LYRICS');
if (!tab)
throw new InnertubeError('Could not find target tab.');
const page = await tab.endpoint.call(this.#actions, { client: 'YTMUSIC', parse: true });
if (!page.contents)
throw new InnertubeError('Unexpected response', page);
if (page.contents.item().type === 'Message')
throw new InnertubeError(page.contents.item().as(Message).text.toString(), video_id);
const section_list = page.contents.item().as(SectionList).contents;
return section_list.firstOfType(MusicDescriptionShelf);
}
async getRecap() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEmusic_listening_review' } });
const response = await browse_endpoint.call(this.#actions, { client: 'YTMUSIC' });
return new Recap(response, this.#actions);
}
async getSearchSuggestions(input) {
const response = await this.#actions.execute('/music/get_search_suggestions', {
input,
client: 'YTMUSIC',
parse: true
});
if (!response.contents_memo)
return [];
return response.contents_memo.getType(SearchSuggestionsSection);
}
}
//# sourceMappingURL=Music.js.map
File diff suppressed because one or more lines are too long
+34
View File
@@ -0,0 +1,34 @@
import type { UpdateVideoMetadataOptions, UploadedVideoMetadataOptions } from '../../types/Misc.js';
import type { ApiResponse, Session } from '../index.js';
export default class Studio {
#private;
constructor(session: Session);
/**
* Updates the metadata of a video.
* @example
* ```ts
* const videoId = 'abcdefg';
* const thumbnail = fs.readFileSync('./my_awesome_thumbnail.jpg');
*
* const response = await yt.studio.updateVideoMetadata(videoId, {
* tags: [ 'astronomy', 'NASA', 'APOD' ],
* title: 'Artemis Mission',
* description: 'A nicely written description...',
* category: 27,
* license: 'creative_commons',
* thumbnail,
* // ...
* });
* ```
*/
updateVideoMetadata(video_id: string, metadata: UpdateVideoMetadataOptions): Promise<ApiResponse>;
/**
* Uploads a video to YouTube.
* @example
* ```ts
* const file = fs.readFileSync('./my_awesome_video.mp4');
* const response = await yt.studio.upload(file.buffer, { title: 'Wow!' });
* ```
*/
upload(file: BodyInit, metadata?: UploadedVideoMetadataOptions): Promise<ApiResponse>;
}
+196
View File
@@ -0,0 +1,196 @@
import { Constants } from '../../utils/index.js';
import { InnertubeError, Platform } from '../../utils/Utils.js';
import { MetadataUpdateRequest } from '../../../protos/generated/youtube/api/pfiinnertube/metadata_update_request.js';
export default class Studio {
#session;
constructor(session) {
this.#session = session;
}
/**
* Updates the metadata of a video.
* @example
* ```ts
* const videoId = 'abcdefg';
* const thumbnail = fs.readFileSync('./my_awesome_thumbnail.jpg');
*
* const response = await yt.studio.updateVideoMetadata(videoId, {
* tags: [ 'astronomy', 'NASA', 'APOD' ],
* title: 'Artemis Mission',
* description: 'A nicely written description...',
* category: 27,
* license: 'creative_commons',
* thumbnail,
* // ...
* });
* ```
*/
async updateVideoMetadata(video_id, metadata) {
const session = this.#session;
if (!session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const payload = {
context: {
client: {
osName: 'Android',
clientName: parseInt(Constants.CLIENT_NAME_IDS.ANDROID),
clientVersion: Constants.CLIENTS.ANDROID.VERSION,
androidSdkVersion: Constants.CLIENTS.ANDROID.SDK_VERSION,
visitorData: session.context.client.visitorData,
osVersion: '13',
acceptLanguage: session.context.client.hl,
acceptRegion: session.context.client.gl,
deviceMake: 'Google',
deviceModel: 'sdk_gphone64_x86_64',
screenHeightPoints: 840,
screenWidthPoints: 432,
configInfo: {
appInstallData: session.context.client.configInfo?.appInstallData
},
timeZone: session.context.client.timeZone,
chipset: 'qcom;taro'
},
activePlayers: []
},
encryptedVideoId: video_id
};
if (metadata.title)
payload.title = { newTitle: metadata.title };
if (metadata.description)
payload.description = { newDescription: metadata.description };
if (metadata.license)
payload.license = { newLicenseId: metadata.license };
if (metadata.tags)
payload.tags = { newTags: metadata.tags };
if (metadata.thumbnail) {
payload.videoStill = {
operation: 3,
image: {
rawBytes: metadata.thumbnail
},
experimentImage: []
};
}
if (Reflect.has(metadata, 'category'))
payload.category = { newCategoryId: metadata.category };
if (Reflect.has(metadata, 'privacy')) {
switch (metadata.privacy) {
case 'PUBLIC':
payload.privacy = { newPrivacy: 1 };
break;
case 'UNLISTED':
payload.privacy = { newPrivacy: 2 };
break;
case 'PRIVATE':
payload.privacy = { newPrivacy: 3 };
break;
default:
throw new Error('Invalid privacy setting');
}
}
if (Reflect.has(metadata, 'made_for_kids')) {
payload.madeForKids = {
operation: 1,
newMfk: metadata.made_for_kids ? 1 : 2
};
}
if (Reflect.has(metadata, 'age_restricted')) {
payload.racy = {
operation: 1,
newRacy: metadata.age_restricted ? 1 : 2
};
}
const writer = MetadataUpdateRequest.encode(payload);
return await session.actions.execute('/video_manager/metadata_update', {
protobuf: true,
serialized_data: writer.finish()
});
}
/**
* Uploads a video to YouTube.
* @example
* ```ts
* const file = fs.readFileSync('./my_awesome_video.mp4');
* const response = await yt.studio.upload(file.buffer, { title: 'Wow!' });
* ```
*/
async upload(file, metadata = {}) {
if (!this.#session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const initial_data = await this.#getInitialUploadData();
const upload_result = await this.#uploadVideo(initial_data.upload_url, file);
if (upload_result.status !== 'STATUS_SUCCESS')
throw new InnertubeError('Could not process video.');
return await this.#setVideoMetadata(initial_data, upload_result, metadata);
}
async #getInitialUploadData() {
const frontend_upload_id = `innertube_android:${Platform.shim.uuidv4()}:0:v=3,api=1,cf=3`;
const payload = {
frontendUploadId: frontend_upload_id,
deviceDisplayName: 'Pixel 6 Pro',
fileId: `goog-edited-video://generated?videoFileUri=content://media/external/video/media/${Platform.shim.uuidv4()}`,
mp4MoovAtomRelocationStatus: 'UNSUPPORTED',
transcodeResult: 'DISABLED',
connectionType: 'WIFI'
};
const response = await this.#session.http.fetch('/upload/youtubei', {
baseURL: Constants.URLS.YT_UPLOAD,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'x-goog-upload-command': 'start',
'x-goog-upload-protocol': 'resumable'
},
body: JSON.stringify(payload)
});
if (!response.ok)
throw new InnertubeError('Could not get initial upload data');
return {
frontend_upload_id,
upload_id: response.headers.get('x-guploader-uploadid'),
upload_url: response.headers.get('x-goog-upload-url'),
scotty_resource_id: response.headers.get('x-goog-upload-header-scotty-resource-id'),
chunk_granularity: response.headers.get('x-goog-upload-chunk-granularity')
};
}
async #uploadVideo(upload_url, file) {
const response = await this.#session.http.fetch_function(upload_url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'x-goog-upload-command': 'upload, finalize',
'x-goog-upload-file-name': `file-${Date.now()}`,
'x-goog-upload-offset': '0'
},
body: file
});
if (!response.ok)
throw new InnertubeError('Could not upload video');
return await response.json();
}
async #setVideoMetadata(initial_data, upload_result, metadata) {
return await this.#session.actions.execute('/upload/createvideo', {
resourceId: {
scottyResourceId: {
id: upload_result.scottyResourceId
}
},
frontendUploadId: initial_data.frontend_upload_id,
initialMetadata: {
title: {
newTitle: metadata.title
},
description: {
newDescription: metadata.description,
shouldSegment: true
},
privacy: {
newPrivacy: metadata.privacy || 'PRIVATE'
},
draftState: {
isDraft: !!metadata.is_draft
}
}
});
}
}
//# sourceMappingURL=Studio.js.map
File diff suppressed because one or more lines are too long
+3
View File
@@ -0,0 +1,3 @@
export { default as Kids } from './Kids.js';
export { default as Music } from './Music.js';
export { default as Studio } from './Studio.js';
+4
View File
@@ -0,0 +1,4 @@
export { default as Kids } from './Kids.js';
export { default as Music } from './Music.js';
export { default as Studio } from './Studio.js';
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/clients/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC"}
+11
View File
@@ -0,0 +1,11 @@
export { default as Session } from './Session.js';
export * from './Session.js';
export { default as Actions } from './Actions.js';
export * from './Actions.js';
export { default as Player } from './Player.js';
export * from './Player.js';
export { default as OAuth2 } from './OAuth2.js';
export * from './OAuth2.js';
export * as Clients from './clients/index.js';
export * as Managers from './managers/index.js';
export * as Mixins from './mixins/index.js';
+12
View File
@@ -0,0 +1,12 @@
export { default as Session } from './Session.js';
export * from './Session.js';
export { default as Actions } from './Actions.js';
export * from './Actions.js';
export { default as Player } from './Player.js';
export * from './Player.js';
export { default as OAuth2 } from './OAuth2.js';
export * from './OAuth2.js';
export * as Clients from './clients/index.js';
export * as Managers from './managers/index.js';
export * as Mixins from './mixins/index.js';
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,cAAc,aAAa,CAAC;AAE5B,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC"}
+20
View File
@@ -0,0 +1,20 @@
import type { Actions } from '../index.js';
import AccountInfo from '../../parser/youtube/AccountInfo.js';
import Settings from '../../parser/youtube/Settings.js';
import { AccountItem } from '../../parser/nodes.js';
export default class AccountManager {
#private;
constructor(actions: Actions);
/**
* Retrieves the list of channels belonging to the signed-in account. Only useful when signed in through cookie. If signed in through OAuth, you will get the active channel only.
*/
getInfo(all: true): Promise<AccountItem[]>;
/**
* Retrieves the active channel info for the signed-in account. Throws error if `on_behalf_of_user` was used to create the Innertube instance; use `getInfo(true)` instead.
*/
getInfo(all?: false): Promise<AccountInfo>;
/**
* Gets YouTube settings.
*/
getSettings(): Promise<Settings>;
}
+38
View File
@@ -0,0 +1,38 @@
import AccountInfo from '../../parser/youtube/AccountInfo.js';
import Settings from '../../parser/youtube/Settings.js';
import NavigationEndpoint from '../../parser/classes/NavigationEndpoint.js';
import { InnertubeError } from '../../utils/Utils.js';
import { AccountItem } from '../../parser/nodes.js';
export default class AccountManager {
#actions;
constructor(actions) {
this.#actions = actions;
}
async getInfo(all = false) {
if (!this.#actions.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
if (!all && !!this.#actions.session.context.user.onBehalfOfUser) {
throw new InnertubeError('Boolean argument must be true when "on_behalf_of_user" is specified.');
}
if (all) {
const get_accounts_list_endpoint = new NavigationEndpoint({ getAccountsListInnertubeEndpoint: {
requestType: 'ACCOUNTS_LIST_REQUEST_TYPE_CHANNEL_SWITCHER',
callCircumstance: 'SWITCHING_USERS_FULL'
} });
const response = await get_accounts_list_endpoint.call(this.#actions, { client: 'WEB', parse: true });
return response.actions_memo?.getType(AccountItem) || [];
}
const get_accounts_list_endpoint = new NavigationEndpoint({ getAccountsListInnertubeEndpoint: {} });
const response = await get_accounts_list_endpoint.call(this.#actions, { client: 'TV' });
return new AccountInfo(response);
}
/**
* Gets YouTube settings.
*/
async getSettings() {
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'SPaccount_overview' } });
const response = await browse_endpoint.call(this.#actions);
return new Settings(this.#actions, response);
}
}
//# sourceMappingURL=AccountManager.js.map
@@ -0,0 +1 @@
{"version":3,"file":"AccountManager.js","sourceRoot":"","sources":["../../../../src/core/managers/AccountManager.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,QAAQ,MAAM,kCAAkC,CAAC;AACxD,OAAO,kBAAkB,MAAM,4CAA4C,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,cAAc;IACxB,QAAQ,CAAU;IAE3B,YAAY,OAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAUD,KAAK,CAAC,OAAO,CAAC,GAAG,GAAG,KAAK;QACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS;YAClC,MAAM,IAAI,cAAc,CAAC,kDAAkD,CAAC,CAAC;QAE/E,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YAChE,MAAM,IAAI,cAAc,CAAC,sEAAsE,CAAC,CAAC;QACnG,CAAC;QAED,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,0BAA0B,GAAG,IAAI,kBAAkB,CAAC,EAAE,gCAAgC,EAAE;oBAC5F,WAAW,EAAE,6CAA6C;oBAC1D,gBAAgB,EAAE,sBAAsB;iBACzC,EAAE,CAAC,CAAC;YACL,MAAM,QAAQ,GAAG,MAAM,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACtG,OAAO,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC3D,CAAC;QAED,MAAM,0BAA0B,GAAG,IAAI,kBAAkB,CAAC,EAAE,gCAAgC,EAAE,EAAE,EAAE,CAAC,CAAC;QACpG,MAAM,QAAQ,GAAG,MAAM,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACxF,OAAO,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,MAAM,eAAe,GAAG,IAAI,kBAAkB,CAAC,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,oBAAoB,EAAE,EAAE,CAAC,CAAC;QACvG,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3D,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -0,0 +1,58 @@
import type { Actions, ApiResponse } from '../index.js';
export default class InteractionManager {
#private;
constructor(actions: Actions);
/**
* Likes a given video.
* @param video_id - The video ID
*/
like(video_id: string): Promise<ApiResponse>;
/**
* Dislikes a given video.
* @param video_id - The video ID
*/
dislike(video_id: string): Promise<ApiResponse>;
/**
* Removes a like/dislike.
* @param video_id - The video ID
*/
removeRating(video_id: string): Promise<ApiResponse>;
/**
* Subscribes to the given channel.
* @param channel_id - The channel ID
*/
subscribe(channel_id: string): Promise<ApiResponse>;
/**
* Unsubscribes from the given channel.
* @param channel_id - The channel ID
*/
unsubscribe(channel_id: string): Promise<ApiResponse>;
/**
* Posts a comment on a given video.
* @param video_id - The video ID
* @param text - The comment text
*/
comment(video_id: string, text: string): Promise<ApiResponse>;
/**
* Translates a given text using YouTube's comment translation feature.
* @param text - The text to translate
* @param target_language - an ISO language code
* @param args - optional arguments
*/
translate(text: string, target_language: string, args?: {
video_id?: string;
comment_id?: string;
}): Promise<{
success: boolean;
status_code: number;
translated_content: any;
data: import("../../parser/index.js").IRawResponse;
}>;
/**
* Changes notification preferences for a given channel.
* Only works with channels you are subscribed to.
* @param channel_id - The channel ID.
* @param type - The notification type.
*/
setNotificationPreferences(channel_id: string, type: 'PERSONALIZED' | 'ALL' | 'NONE'): Promise<ApiResponse>;
}
+163
View File
@@ -0,0 +1,163 @@
import * as ProtoUtils from '../../utils/ProtoUtils.js';
import { throwIfMissing, u8ToBase64 } from '../../utils/Utils.js';
import { CreateCommentParams, NotificationPreferences } from '../../../protos/generated/misc/params.js';
import NavigationEndpoint from '../../parser/classes/NavigationEndpoint.js';
export default class InteractionManager {
#actions;
constructor(actions) {
this.#actions = actions;
}
/**
* Likes a given video.
* @param video_id - The video ID
*/
async like(video_id) {
throwIfMissing({ video_id });
if (!this.#actions.session.logged_in)
throw new Error('You must be signed in to perform this operation.');
const like_endpoint = new NavigationEndpoint({
likeEndpoint: {
status: 'LIKE',
target: video_id
}
});
return like_endpoint.call(this.#actions, { client: 'TV' });
}
/**
* Dislikes a given video.
* @param video_id - The video ID
*/
async dislike(video_id) {
throwIfMissing({ video_id });
if (!this.#actions.session.logged_in)
throw new Error('You must be signed in to perform this operation.');
const dislike_endpoint = new NavigationEndpoint({
likeEndpoint: {
status: 'DISLIKE',
target: video_id
}
});
return dislike_endpoint.call(this.#actions, { client: 'TV' });
}
/**
* Removes a like/dislike.
* @param video_id - The video ID
*/
async removeRating(video_id) {
throwIfMissing({ video_id });
if (!this.#actions.session.logged_in)
throw new Error('You must be signed in to perform this operation.');
const remove_like_endpoint = new NavigationEndpoint({
likeEndpoint: {
status: 'INDIFFERENT',
target: video_id
}
});
return remove_like_endpoint.call(this.#actions, { client: 'TV' });
}
/**
* Subscribes to the given channel.
* @param channel_id - The channel ID
*/
async subscribe(channel_id) {
throwIfMissing({ channel_id });
if (!this.#actions.session.logged_in)
throw new Error('You must be signed in to perform this operation.');
const subscribe_endpoint = new NavigationEndpoint({
subscribeEndpoint: {
channelIds: [channel_id],
params: 'EgIIAhgA'
}
});
return subscribe_endpoint.call(this.#actions);
}
/**
* Unsubscribes from the given channel.
* @param channel_id - The channel ID
*/
async unsubscribe(channel_id) {
throwIfMissing({ channel_id });
if (!this.#actions.session.logged_in)
throw new Error('You must be signed in to perform this operation.');
const unsubscribe_endpoint = new NavigationEndpoint({
unsubscribeEndpoint: {
channelIds: [channel_id],
params: 'CgIIAhgA'
}
});
return unsubscribe_endpoint.call(this.#actions);
}
/**
* Posts a comment on a given video.
* @param video_id - The video ID
* @param text - The comment text
*/
async comment(video_id, text) {
throwIfMissing({ video_id, text });
if (!this.#actions.session.logged_in)
throw new Error('You must be signed in to perform this operation.');
const writer = CreateCommentParams.encode({
videoId: video_id,
params: {
index: 0
},
number: 7
});
const params = encodeURIComponent(u8ToBase64(writer.finish()));
const create_comment_endpoint = new NavigationEndpoint({
createCommentEndpoint: {
commentText: text,
createCommentParams: params
}
});
return create_comment_endpoint.call(this.#actions);
}
/**
* Translates a given text using YouTube's comment translation feature.
* @param text - The text to translate
* @param target_language - an ISO language code
* @param args - optional arguments
*/
async translate(text, target_language, args = {}) {
throwIfMissing({ text, target_language });
const action = ProtoUtils.encodeCommentActionParams(22, { text, target_language, ...args });
const perform_comment_action_endpoint = new NavigationEndpoint({ performCommentActionEndpoint: { action } });
const response = await perform_comment_action_endpoint.call(this.#actions);
const mutation = response.data.frameworkUpdates.entityBatchUpdate.mutations[0].payload.commentEntityPayload;
return {
success: response.success,
status_code: response.status_code,
translated_content: mutation.translatedContent.content,
data: response.data
};
}
/**
* Changes notification preferences for a given channel.
* Only works with channels you are subscribed to.
* @param channel_id - The channel ID.
* @param type - The notification type.
*/
async setNotificationPreferences(channel_id, type) {
throwIfMissing({ channel_id, type });
if (!this.#actions.session.logged_in)
throw new Error('You must be signed in to perform this operation.');
const pref_types = {
PERSONALIZED: 1,
ALL: 2,
NONE: 3
};
if (!Object.keys(pref_types).includes(type.toUpperCase()))
throw new Error(`Invalid notification preference type: ${type}`);
const writer = NotificationPreferences.encode({
channelId: channel_id,
prefId: {
index: pref_types[type.toUpperCase()]
},
number0: 0, number1: 4
});
const params = encodeURIComponent(u8ToBase64(writer.finish()));
const modify_channel_notification_preference_endpoint = new NavigationEndpoint({ modifyChannelNotificationPreferenceEndpoint: { params } });
return modify_channel_notification_preference_endpoint.call(this.#actions);
}
}
//# sourceMappingURL=InteractionManager.js.map
@@ -0,0 +1 @@
{"version":3,"file":"InteractionManager.js","sourceRoot":"","sources":["../../../../src/core/managers/InteractionManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAExG,OAAO,kBAAkB,MAAM,4CAA4C,CAAC;AAE5E,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAC5B,QAAQ,CAAU;IAE3B,YAAY,OAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,QAAgB;QACzB,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE7B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS;YAClC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC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c,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAErC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS;YAClC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QAEtE,MAAM,UAAU,GAAG;YACjB,YAAY,EAAE,CAAC;YACf,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;SACR,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,yCAAyC,IAAI,EAAE,CAAC,CAAC;QAEnE,MAAM,MAAM,GAAG,uBAAuB,CAAC,MAAM,CAAC;YAC5C,SAAS,EAAE,UAAU;YACrB,MAAM,EAAE;gBACN,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,WAAW,EAA6B,CAAC;aACjE;YACD,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;SACvB,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,kBAAkB,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAE/D,MAAM,+CAA+C,GAAG,IAAI,kBAAkB,CAAC,EAAE,2CAA2C,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QAC5I,OAAO,+CAA+C,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7E,CAAC;CACF"}
+83
View File
@@ -0,0 +1,83 @@
import type { Actions } from '../index.js';
export default class PlaylistManager {
#private;
constructor(actions: Actions);
/**
* Creates a playlist.
* @param title - The title of the playlist.
* @param video_ids - An array of video IDs to add to the playlist.
*/
create(title: string, video_ids: string[]): Promise<{
success: boolean;
status_code: number;
playlist_id?: string;
data: any;
}>;
/**
* Deletes a given playlist.
* @param playlist_id - The playlist ID.
*/
delete(playlist_id: string): Promise<{
playlist_id: string;
success: boolean;
status_code: number;
data: any;
}>;
/**
* Adds a given playlist to the library of a user.
* @param playlist_id - The playlist ID.
*/
addToLibrary(playlist_id: string): Promise<import("../Actions.js").ApiResponse>;
/**
* Remove a given playlist to the library of a user.
* @param playlist_id - The playlist ID.
*/
removeFromLibrary(playlist_id: string): Promise<import("../Actions.js").ApiResponse>;
/**
* Adds videos to a given playlist.
* @param playlist_id - The playlist ID.
* @param video_ids - An array of video IDs to add to the playlist.
*/
addVideos(playlist_id: string, video_ids: string[]): Promise<{
playlist_id: string;
action_result: any;
}>;
/**
* Removes videos from a given playlist.
* @param playlist_id - The playlist ID.
* @param video_ids - An array of video IDs to remove from the playlist.
* @param use_set_video_ids - Option to remove videos using set video IDs.
*/
removeVideos(playlist_id: string, video_ids: string[], use_set_video_ids?: boolean): Promise<{
playlist_id: string;
action_result: any;
}>;
/**
* Moves a video to a new position within a given playlist.
* @param playlist_id - The playlist ID.
* @param moved_video_id - The video ID to move.
* @param predecessor_video_id - The video ID to move the moved video before.
*/
moveVideo(playlist_id: string, moved_video_id: string, predecessor_video_id: string): Promise<{
playlist_id: string;
action_result: any;
}>;
/**
* Sets the name for the given playlist.
* @param playlist_id - The playlist ID.
* @param name - The name / title to use for the playlist.
*/
setName(playlist_id: string, name: string): Promise<{
playlist_id: string;
action_result: any;
}>;
/**
* Sets the description for the given playlist.
* @param playlist_id - The playlist ID.
* @param description - The description to use for the playlist.
*/
setDescription(playlist_id: string, description: string): Promise<{
playlist_id: string;
action_result: any;
}>;
}
+234
View File
@@ -0,0 +1,234 @@
import { InnertubeError, throwIfMissing } from '../../utils/Utils.js';
import Playlist from '../../parser/youtube/Playlist.js';
import NavigationEndpoint from '../../parser/classes/NavigationEndpoint.js';
export default class PlaylistManager {
#actions;
constructor(actions) {
this.#actions = actions;
}
/**
* Creates a playlist.
* @param title - The title of the playlist.
* @param video_ids - An array of video IDs to add to the playlist.
*/
async create(title, video_ids) {
throwIfMissing({ title, video_ids });
if (!this.#actions.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const create_playlist_endpoint = new NavigationEndpoint({
createPlaylistServiceEndpoint: {
title,
videoIds: video_ids
}
});
const response = await create_playlist_endpoint.call(this.#actions);
return {
success: response.success,
status_code: response.status_code,
playlist_id: response.data.playlistId,
data: response.data
};
}
/**
* Deletes a given playlist.
* @param playlist_id - The playlist ID.
*/
async delete(playlist_id) {
throwIfMissing({ playlist_id });
if (!this.#actions.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const delete_playlist_endpoint = new NavigationEndpoint({
deletePlaylistServiceEndpoint: {
sourcePlaylistId: playlist_id
}
});
const response = await delete_playlist_endpoint.call(this.#actions);
return {
playlist_id,
success: response.success,
status_code: response.status_code,
data: response.data
};
}
/**
* Adds a given playlist to the library of a user.
* @param playlist_id - The playlist ID.
*/
async addToLibrary(playlist_id) {
throwIfMissing({ playlist_id });
if (!this.#actions.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const like_playlist_endpoint = new NavigationEndpoint({
likeEndpoint: {
status: 'LIKE',
target: playlist_id
}
});
return await like_playlist_endpoint.call(this.#actions);
}
/**
* Remove a given playlist to the library of a user.
* @param playlist_id - The playlist ID.
*/
async removeFromLibrary(playlist_id) {
throwIfMissing({ playlist_id });
if (!this.#actions.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const remove_like_playlist_endpoint = new NavigationEndpoint({
likeEndpoint: {
status: 'INDIFFERENT',
target: playlist_id
}
});
return await remove_like_playlist_endpoint.call(this.#actions);
}
/**
* Adds videos to a given playlist.
* @param playlist_id - The playlist ID.
* @param video_ids - An array of video IDs to add to the playlist.
*/
async addVideos(playlist_id, video_ids) {
throwIfMissing({ playlist_id, video_ids });
if (!this.#actions.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const playlist_edit_endpoint = new NavigationEndpoint({
playlistEditEndpoint: {
playlistId: playlist_id,
actions: video_ids.map((id) => ({
action: 'ACTION_ADD_VIDEO',
addedVideoId: id
}))
}
});
const response = await playlist_edit_endpoint.call(this.#actions);
return {
playlist_id,
action_result: response.data.actions // TODO: implement actions in the parser
};
}
/**
* Removes videos from a given playlist.
* @param playlist_id - The playlist ID.
* @param video_ids - An array of video IDs to remove from the playlist.
* @param use_set_video_ids - Option to remove videos using set video IDs.
*/
async removeVideos(playlist_id, video_ids, use_set_video_ids = false) {
throwIfMissing({ playlist_id, video_ids });
if (!this.#actions.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const playlist = await this.#getPlaylist(playlist_id);
if (!playlist.info.is_editable)
throw new InnertubeError('This playlist cannot be edited.', playlist_id);
const payload = { playlistId: playlist_id, actions: [] };
const getSetVideoIds = async (pl) => {
const key_id = use_set_video_ids ? 'set_video_id' : 'id';
const videos = pl.videos.filter((video) => video_ids.includes(video.key(key_id).string()));
videos.forEach((video) => payload.actions.push({
action: 'ACTION_REMOVE_VIDEO',
setVideoId: video.key('set_video_id').string()
}));
if (payload.actions.length < video_ids.length) {
const next = await pl.getContinuation();
return getSetVideoIds(next);
}
};
await getSetVideoIds(playlist);
if (!payload.actions.length)
throw new InnertubeError('Given video ids were not found in this playlist.', video_ids);
const playlist_edit_endpoint = new NavigationEndpoint({ playlistEditEndpoint: payload });
const response = await playlist_edit_endpoint.call(this.#actions);
return {
playlist_id,
action_result: response.data.actions // TODO: implement actions in the parser
};
}
/**
* Moves a video to a new position within a given playlist.
* @param playlist_id - The playlist ID.
* @param moved_video_id - The video ID to move.
* @param predecessor_video_id - The video ID to move the moved video before.
*/
async moveVideo(playlist_id, moved_video_id, predecessor_video_id) {
throwIfMissing({ playlist_id, moved_video_id, predecessor_video_id });
if (!this.#actions.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const playlist = await this.#getPlaylist(playlist_id);
if (!playlist.info.is_editable)
throw new InnertubeError('This playlist cannot be edited.', playlist_id);
const payload = { playlistId: playlist_id, actions: [] };
let set_video_id_0, set_video_id_1;
const getSetVideoIds = async (pl) => {
const video_0 = pl.videos.find((video) => moved_video_id === video.key('id').string());
const video_1 = pl.videos.find((video) => predecessor_video_id === video.key('id').string());
set_video_id_0 = set_video_id_0 || video_0?.key('set_video_id').string();
set_video_id_1 = set_video_id_1 || video_1?.key('set_video_id').string();
if (!set_video_id_0 || !set_video_id_1) {
const next = await pl.getContinuation();
return getSetVideoIds(next);
}
};
await getSetVideoIds(playlist);
payload.actions.push({
action: 'ACTION_MOVE_VIDEO_AFTER',
setVideoId: set_video_id_0,
movedSetVideoIdPredecessor: set_video_id_1
});
const playlist_edit_endpoint = new NavigationEndpoint({ playlistEditEndpoint: payload });
const response = await playlist_edit_endpoint.call(this.#actions);
return {
playlist_id,
action_result: response.data.actions // TODO: implement actions in the parser
};
}
async #getPlaylist(playlist_id) {
if (!playlist_id.startsWith('VL')) {
playlist_id = `VL${playlist_id}`;
}
const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: playlist_id } });
const browse_response = await browse_endpoint.call(this.#actions, { parse: true });
return new Playlist(this.#actions, browse_response, true);
}
/**
* Sets the name for the given playlist.
* @param playlist_id - The playlist ID.
* @param name - The name / title to use for the playlist.
*/
async setName(playlist_id, name) {
throwIfMissing({ playlist_id, name });
if (!this.#actions.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const payload = { playlist_id, actions: [] };
payload.actions.push({
action: 'ACTION_SET_PLAYLIST_NAME',
playlistName: name
});
const playlist_edit_endpoint = new NavigationEndpoint({ playlistEditEndpoint: payload });
const response = await playlist_edit_endpoint.call(this.#actions);
return {
playlist_id,
action_result: response.data.actions
};
}
/**
* Sets the description for the given playlist.
* @param playlist_id - The playlist ID.
* @param description - The description to use for the playlist.
*/
async setDescription(playlist_id, description) {
throwIfMissing({ playlist_id, description });
if (!this.#actions.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
const payload = { playlistId: playlist_id, actions: [] };
payload.actions.push({
action: 'ACTION_SET_PLAYLIST_DESCRIPTION',
playlistDescription: description
});
const playlist_edit_endpoint = new NavigationEndpoint({ playlistEditEndpoint: payload });
const response = await playlist_edit_endpoint.call(this.#actions);
return {
playlist_id,
action_result: response.data.actions
};
}
}
//# sourceMappingURL=PlaylistManager.js.map
File diff suppressed because one or more lines are too long
+3
View File
@@ -0,0 +1,3 @@
export { default as AccountManager } from './AccountManager.js';
export { default as PlaylistManager } from './PlaylistManager.js';
export { default as InteractionManager } from './InteractionManager.js';
+4
View File
@@ -0,0 +1,4 @@
export { default as AccountManager } from './AccountManager.js';
export { default as PlaylistManager } from './PlaylistManager.js';
export { default as InteractionManager } from './InteractionManager.js';
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/managers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
+91
View File
@@ -0,0 +1,91 @@
import type { IParsedResponse } from '../../parser/index.js';
import { ReloadContinuationItemsCommand } from '../../parser/index.js';
import BackstagePost from '../../parser/classes/BackstagePost.js';
import SharedPost from '../../parser/classes/SharedPost.js';
import Channel from '../../parser/classes/Channel.js';
import CompactVideo from '../../parser/classes/CompactVideo.js';
import GridChannel from '../../parser/classes/GridChannel.js';
import GridPlaylist from '../../parser/classes/GridPlaylist.js';
import GridVideo from '../../parser/classes/GridVideo.js';
import LockupView from '../../parser/classes/LockupView.js';
import Playlist from '../../parser/classes/Playlist.js';
import PlaylistPanelVideo from '../../parser/classes/PlaylistPanelVideo.js';
import PlaylistVideo from '../../parser/classes/PlaylistVideo.js';
import Post from '../../parser/classes/Post.js';
import ReelItem from '../../parser/classes/ReelItem.js';
import ShortsLockupView from '../../parser/classes/ShortsLockupView.js';
import ReelShelf from '../../parser/classes/ReelShelf.js';
import RichShelf from '../../parser/classes/RichShelf.js';
import Shelf from '../../parser/classes/Shelf.js';
import Video from '../../parser/classes/Video.js';
import WatchCardCompactVideo from '../../parser/classes/WatchCardCompactVideo.js';
import type { Actions, ApiResponse } from '../index.js';
import type { Memo, ObservedArray } from '../../parser/helpers.js';
import type MusicQueue from '../../parser/classes/MusicQueue.js';
import type RichGrid from '../../parser/classes/RichGrid.js';
import type SectionList from '../../parser/classes/SectionList.js';
import type SecondarySearchContainer from '../../parser/classes/SecondarySearchContainer.js';
import type BrowseFeedActions from '../../parser/classes/BrowseFeedActions.js';
import type ProfileColumn from '../../parser/classes/ProfileColumn.js';
export default class Feed<T extends IParsedResponse = IParsedResponse> {
#private;
constructor(actions: Actions, response: ApiResponse | IParsedResponse, already_parsed?: boolean);
/**
* Get all videos on a given page via memo
*/
static getVideosFromMemo(memo: Memo): ObservedArray<CompactVideo | GridVideo | PlaylistPanelVideo | PlaylistVideo | ReelItem | ShortsLockupView | Video | WatchCardCompactVideo>;
/**
* Get all playlists on a given page via memo
*/
static getPlaylistsFromMemo(memo: Memo): ObservedArray<GridPlaylist | LockupView | Playlist>;
/**
* Get all the videos in the feed
*/
get videos(): ObservedArray<CompactVideo | GridVideo | PlaylistPanelVideo | PlaylistVideo | ReelItem | ShortsLockupView | Video | WatchCardCompactVideo>;
/**
* Get all the community posts in the feed
*/
get posts(): ObservedArray<BackstagePost | Post | SharedPost>;
/**
* Get all the channels in the feed
*/
get channels(): ObservedArray<Channel | GridChannel>;
/**
* Get all playlists in the feed
*/
get playlists(): ObservedArray<GridPlaylist | LockupView | Playlist>;
get memo(): Memo;
/**
* Returns contents from the page.
*/
get page_contents(): SectionList | MusicQueue | RichGrid | ReloadContinuationItemsCommand;
/**
* Returns all segments/sections from the page.
*/
get shelves(): ObservedArray<ReelShelf | RichShelf | Shelf>;
/**
* Finds shelf by title.
*/
getShelf(title: string): ReelShelf | RichShelf | Shelf | undefined;
/**
* Returns secondary contents from the page.
*/
get secondary_contents(): SectionList | SecondarySearchContainer | BrowseFeedActions | ProfileColumn | null;
get actions(): Actions;
/**
* Get the original page data
*/
get page(): T;
/**
* Checks if the feed has continuation.
*/
get has_continuation(): boolean;
/**
* Retrieves continuation data as it is.
*/
getContinuationData(): Promise<T | undefined>;
/**
* Retrieves next batch of contents and returns a new {@link Feed} object.
*/
getContinuation(): Promise<Feed<T>>;
}
+180
View File
@@ -0,0 +1,180 @@
import { Parser, ReloadContinuationItemsCommand } from '../../parser/index.js';
import { concatMemos, InnertubeError } from '../../utils/Utils.js';
import BackstagePost from '../../parser/classes/BackstagePost.js';
import SharedPost from '../../parser/classes/SharedPost.js';
import Channel from '../../parser/classes/Channel.js';
import CompactVideo from '../../parser/classes/CompactVideo.js';
import GridChannel from '../../parser/classes/GridChannel.js';
import GridPlaylist from '../../parser/classes/GridPlaylist.js';
import GridVideo from '../../parser/classes/GridVideo.js';
import LockupView from '../../parser/classes/LockupView.js';
import Playlist from '../../parser/classes/Playlist.js';
import PlaylistPanelVideo from '../../parser/classes/PlaylistPanelVideo.js';
import PlaylistVideo from '../../parser/classes/PlaylistVideo.js';
import Post from '../../parser/classes/Post.js';
import ReelItem from '../../parser/classes/ReelItem.js';
import ShortsLockupView from '../../parser/classes/ShortsLockupView.js';
import ReelShelf from '../../parser/classes/ReelShelf.js';
import RichShelf from '../../parser/classes/RichShelf.js';
import Shelf from '../../parser/classes/Shelf.js';
import Tab from '../../parser/classes/Tab.js';
import Video from '../../parser/classes/Video.js';
import AppendContinuationItemsAction from '../../parser/classes/actions/AppendContinuationItemsAction.js';
import ContinuationItem from '../../parser/classes/ContinuationItem.js';
import TwoColumnBrowseResults from '../../parser/classes/TwoColumnBrowseResults.js';
import TwoColumnSearchResults from '../../parser/classes/TwoColumnSearchResults.js';
import WatchCardCompactVideo from '../../parser/classes/WatchCardCompactVideo.js';
export default class Feed {
#page;
#actions;
#memo;
#continuation;
constructor(actions, response, already_parsed = false) {
if (this.#isParsed(response) || already_parsed) {
this.#page = response;
}
else {
this.#page = Parser.parseResponse(response.data);
}
const memo = concatMemos(...[
this.#page.contents_memo,
this.#page.continuation_contents_memo,
this.#page.on_response_received_commands_memo,
this.#page.on_response_received_endpoints_memo,
this.#page.on_response_received_actions_memo,
this.#page.sidebar_memo,
this.#page.header_memo
]);
if (!memo)
throw new InnertubeError('No memo found in feed');
this.#memo = memo;
this.#actions = actions;
}
#isParsed(response) {
return !('data' in response);
}
/**
* Get all videos on a given page via memo
*/
static getVideosFromMemo(memo) {
return memo.getType(Video, GridVideo, ReelItem, ShortsLockupView, CompactVideo, PlaylistVideo, PlaylistPanelVideo, WatchCardCompactVideo);
}
/**
* Get all playlists on a given page via memo
*/
static getPlaylistsFromMemo(memo) {
const playlists = memo.getType(Playlist, GridPlaylist);
const lockup_views = memo.getType(LockupView)
.filter((lockup) => {
return ['PLAYLIST', 'ALBUM', 'PODCAST'].includes(lockup.content_type);
});
if (lockup_views.length > 0) {
playlists.push(...lockup_views);
}
return playlists;
}
/**
* Get all the videos in the feed
*/
get videos() {
return Feed.getVideosFromMemo(this.#memo);
}
/**
* Get all the community posts in the feed
*/
get posts() {
return this.#memo.getType(BackstagePost, Post, SharedPost);
}
/**
* Get all the channels in the feed
*/
get channels() {
return this.#memo.getType(Channel, GridChannel);
}
/**
* Get all playlists in the feed
*/
get playlists() {
return Feed.getPlaylistsFromMemo(this.#memo);
}
get memo() {
return this.#memo;
}
/**
* Returns contents from the page.
*/
get page_contents() {
const tab_content = this.#memo.getType(Tab)?.[0].content;
const reload_continuation_items = this.#memo.getType(ReloadContinuationItemsCommand)[0];
const append_continuation_items = this.#memo.getType(AppendContinuationItemsAction)[0];
return tab_content || reload_continuation_items || append_continuation_items;
}
/**
* Returns all segments/sections from the page.
*/
get shelves() {
return this.#memo.getType(Shelf, RichShelf, ReelShelf);
}
/**
* Finds shelf by title.
*/
getShelf(title) {
return this.shelves.find((shelf) => shelf.title.toString() === title);
}
/**
* Returns secondary contents from the page.
*/
get secondary_contents() {
if (!this.#page.contents?.is_node)
return null;
const node = this.#page.contents?.item();
if (!node.is(TwoColumnBrowseResults, TwoColumnSearchResults))
return null;
return node.secondary_contents;
}
get actions() {
return this.#actions;
}
/**
* Get the original page data
*/
get page() {
return this.#page;
}
/**
* Checks if the feed has continuation.
*/
get has_continuation() {
return this.#getBodyContinuations().length > 0;
}
/**
* Retrieves continuation data as it is.
*/
async getContinuationData() {
if (this.#continuation) {
if (this.#continuation.length === 0)
throw new InnertubeError('There are no continuations.');
return await this.#continuation[0].endpoint.call(this.#actions, { parse: true });
}
this.#continuation = this.#getBodyContinuations();
if (this.#continuation)
return this.getContinuationData();
}
/**
* Retrieves next batch of contents and returns a new {@link Feed} object.
*/
async getContinuation() {
const continuation_data = await this.getContinuationData();
if (!continuation_data)
throw new InnertubeError('Could not get continuation data');
return new Feed(this.actions, continuation_data, true);
}
#getBodyContinuations() {
if (this.#page.header_memo) {
const header_continuations = this.#page.header_memo.getType(ContinuationItem);
return this.#memo.getType(ContinuationItem).filter((continuation) => !header_continuations.includes(continuation));
}
return this.#memo.getType(ContinuationItem);
}
}
//# sourceMappingURL=Feed.js.map
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More