@mks2508/bundlp 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +614 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3072 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +18 -8
- package/dist/core/extractor.d.ts +0 -30
- package/dist/core/extractor.d.ts.map +0 -1
- package/dist/http/client.d.ts +0 -50
- package/dist/http/client.d.ts.map +0 -1
- package/dist/http/retry.d.ts +0 -22
- package/dist/http/retry.d.ts.map +0 -1
- package/dist/index.d.ts +0 -20
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -19021
- package/dist/innertube/client.d.ts +0 -62
- package/dist/innertube/client.d.ts.map +0 -1
- package/dist/player/ast/analyzer.d.ts +0 -16
- package/dist/player/ast/analyzer.d.ts.map +0 -1
- package/dist/player/ast/extractor.d.ts +0 -35
- package/dist/player/ast/extractor.d.ts.map +0 -1
- package/dist/player/ast/matchers.d.ts +0 -40
- package/dist/player/ast/matchers.d.ts.map +0 -1
- package/dist/player/cache.d.ts +0 -60
- package/dist/player/cache.d.ts.map +0 -1
- package/dist/player/player.d.ts +0 -49
- package/dist/player/player.d.ts.map +0 -1
- package/dist/po-token/botguard/challenge.d.ts +0 -22
- package/dist/po-token/botguard/challenge.d.ts.map +0 -1
- package/dist/po-token/botguard/client.d.ts +0 -25
- package/dist/po-token/botguard/client.d.ts.map +0 -1
- package/dist/po-token/cache/token-cache.d.ts +0 -24
- package/dist/po-token/cache/token-cache.d.ts.map +0 -1
- package/dist/po-token/index.d.ts +0 -14
- package/dist/po-token/index.d.ts.map +0 -1
- package/dist/po-token/manager.d.ts +0 -34
- package/dist/po-token/manager.d.ts.map +0 -1
- package/dist/po-token/minter/web-minter.d.ts +0 -20
- package/dist/po-token/minter/web-minter.d.ts.map +0 -1
- package/dist/po-token/policies.d.ts +0 -18
- package/dist/po-token/policies.d.ts.map +0 -1
- package/dist/po-token/providers/local.provider.d.ts +0 -26
- package/dist/po-token/providers/local.provider.d.ts.map +0 -1
- package/dist/po-token/providers/provider.interface.d.ts +0 -15
- package/dist/po-token/providers/provider.interface.d.ts.map +0 -1
- package/dist/po-token/types.d.ts +0 -160
- package/dist/po-token/types.d.ts.map +0 -1
- package/dist/result/index.d.ts +0 -6
- package/dist/result/index.d.ts.map +0 -1
- package/dist/result/result.types.d.ts +0 -14
- package/dist/result/result.types.d.ts.map +0 -1
- package/dist/result/result.utils.d.ts +0 -32
- package/dist/result/result.utils.d.ts.map +0 -1
- package/dist/streaming/dash/parser.d.ts +0 -37
- package/dist/streaming/dash/parser.d.ts.map +0 -1
- package/dist/streaming/dash/segments.d.ts +0 -58
- package/dist/streaming/dash/segments.d.ts.map +0 -1
- package/dist/streaming/decipher.d.ts +0 -24
- package/dist/streaming/decipher.d.ts.map +0 -1
- package/dist/streaming/drm.d.ts +0 -26
- package/dist/streaming/drm.d.ts.map +0 -1
- package/dist/streaming/formats.d.ts +0 -20
- package/dist/streaming/formats.d.ts.map +0 -1
- package/dist/streaming/hls/parser.d.ts +0 -10
- package/dist/streaming/hls/parser.d.ts.map +0 -1
- package/dist/streaming/hls/segments.d.ts +0 -37
- package/dist/streaming/hls/segments.d.ts.map +0 -1
- package/dist/streaming/processor.d.ts +0 -20
- package/dist/streaming/processor.d.ts.map +0 -1
- package/dist/types/error.types.d.ts +0 -12
- package/dist/types/error.types.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -8
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/innertube.types.d.ts +0 -155
- package/dist/types/innertube.types.d.ts.map +0 -1
- package/dist/types/player.types.d.ts +0 -30
- package/dist/types/player.types.d.ts.map +0 -1
- package/dist/types/video.types.d.ts +0 -112
- package/dist/types/video.types.d.ts.map +0 -1
- package/dist/utils/constants.d.ts +0 -129
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/m3u8.d.ts +0 -31
- package/dist/utils/m3u8.d.ts.map +0 -1
- package/dist/utils/xml.d.ts +0 -41
- package/dist/utils/xml.d.ts.map +0 -1
- package/dist/validation/schemas.d.ts +0 -290
- package/dist/validation/schemas.d.ts.map +0 -1
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { type ClientName } from '../utils/constants';
|
|
2
|
-
import { type Result } from '../result';
|
|
3
|
-
import { type BundlpError } from '../types/error.types';
|
|
4
|
-
import { type PlayerResponse } from '../validation/schemas';
|
|
5
|
-
export interface InnerTubeClientConfig {
|
|
6
|
-
initialClient?: ClientName;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Client for interacting with YouTube's InnerTube API.
|
|
10
|
-
*/
|
|
11
|
-
export declare class InnerTubeClient {
|
|
12
|
-
private currentClient;
|
|
13
|
-
private readonly FALLBACK_ORDER;
|
|
14
|
-
constructor(config?: InnerTubeClientConfig);
|
|
15
|
-
/**
|
|
16
|
-
* Sets the client type to use for API requests.
|
|
17
|
-
* @param client - The client name to use
|
|
18
|
-
* @returns Result indicating success or error if client is unknown
|
|
19
|
-
*/
|
|
20
|
-
setClient(client: ClientName): Result<void, BundlpError>;
|
|
21
|
-
/**
|
|
22
|
-
* Gets the current client name being used.
|
|
23
|
-
* @returns The current client name
|
|
24
|
-
*/
|
|
25
|
-
getClientName(): ClientName;
|
|
26
|
-
private getHeaders;
|
|
27
|
-
private buildContext;
|
|
28
|
-
/**
|
|
29
|
-
* Fetches video player data from the InnerTube API.
|
|
30
|
-
* @param videoId - The YouTube video ID
|
|
31
|
-
* @param options - Optional parameters for the request
|
|
32
|
-
* @returns Result containing PlayerResponse or BundlpError
|
|
33
|
-
*/
|
|
34
|
-
fetchPlayer(videoId: string, options?: {
|
|
35
|
-
signatureTimestamp?: number;
|
|
36
|
-
poToken?: string;
|
|
37
|
-
}): Promise<Result<PlayerResponse, BundlpError>>;
|
|
38
|
-
/**
|
|
39
|
-
* Fetches player data with automatic client fallback.
|
|
40
|
-
* Tries clients in order: ANDROID_SDKLESS → TV → IOS → WEB
|
|
41
|
-
* @param videoId - Video ID to fetch
|
|
42
|
-
* @param options - Fetch options
|
|
43
|
-
* @returns Result containing player response or error
|
|
44
|
-
*/
|
|
45
|
-
fetchPlayerWithFallback(videoId: string, options?: {
|
|
46
|
-
signatureTimestamp?: number;
|
|
47
|
-
poToken?: string;
|
|
48
|
-
}): Promise<Result<PlayerResponse, BundlpError>>;
|
|
49
|
-
/**
|
|
50
|
-
* Validates if a player response is usable.
|
|
51
|
-
* @param response - Player response to validate
|
|
52
|
-
* @returns Whether response is valid
|
|
53
|
-
*/
|
|
54
|
-
private isValidResponse;
|
|
55
|
-
/**
|
|
56
|
-
* Checks if streaming data contains only DRM-protected formats.
|
|
57
|
-
* @param streamingData - Streaming data to check
|
|
58
|
-
* @returns Whether all formats are DRM-protected
|
|
59
|
-
*/
|
|
60
|
-
private hasDrmOnly;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/innertube/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,UAAU,EAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAW,KAAK,MAAM,EAAe,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAwB,KAAK,cAAc,EAAsB,MAAM,uBAAuB,CAAC;AAGtG,MAAM,WAAW,qBAAqB;IAClC,aAAa,CAAC,EAAE,UAAU,CAAC;CAC9B;AAED;;GAEG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAM7B;gBAEU,MAAM,GAAE,qBAA0B;IAI9C;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAQxD;;;OAGG;IACH,aAAa,IAAI,UAAU;IAI3B,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,YAAY;IAyBpB;;;;;OAKG;IACG,WAAW,CACb,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GAChE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IA2D/C;;;;;;OAMG;IACG,uBAAuB,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QAAE,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GAChE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAyB/C;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAOvB;;;;OAIG;IACH,OAAO,CAAC,UAAU;CAUrB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ASTNode } from './matchers';
|
|
2
|
-
export declare function analyzeDependencies(funcNode: ASTNode, ast: ASTNode, visited?: Set<string>, depth?: number): Set<string>;
|
|
3
|
-
/**
|
|
4
|
-
* Extracts all identifiers referenced within a node that are not locally declared.
|
|
5
|
-
* @param node - The AST node to scan
|
|
6
|
-
* @returns Set of external identifier names
|
|
7
|
-
*/
|
|
8
|
-
export declare function extractReferencedIdentifiers(node: ASTNode): Set<string>;
|
|
9
|
-
/**
|
|
10
|
-
* Finds a variable or function definition by name in the AST.
|
|
11
|
-
* @param name - The identifier name to find
|
|
12
|
-
* @param ast - The AST to search
|
|
13
|
-
* @returns The definition node if found, null otherwise
|
|
14
|
-
*/
|
|
15
|
-
export declare function findDefinition(name: string, ast: ASTNode): ASTNode | null;
|
|
16
|
-
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../../src/player/ast/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAsC1C,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,cAAoB,EAAE,KAAK,SAAI,GAAG,GAAG,CAAC,MAAM,CAAC,CA0BxH;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAiEvE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAsCzE"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { ASTNode } from './matchers';
|
|
2
|
-
/**
|
|
3
|
-
* Finds a function definition by name in the AST.
|
|
4
|
-
* Supports function declarations, variable declarations with function expressions,
|
|
5
|
-
* and assignment expressions.
|
|
6
|
-
* @param ast - The AST root node to search
|
|
7
|
-
* @param functionName - The name of the function to find
|
|
8
|
-
* @returns The function node if found, null otherwise
|
|
9
|
-
*/
|
|
10
|
-
export declare function findFunctionDefinition(ast: ASTNode, functionName: string): ASTNode | null;
|
|
11
|
-
/**
|
|
12
|
-
* Extracts the source code for a given AST node.
|
|
13
|
-
* @param code - The full source code string
|
|
14
|
-
* @param node - The AST node with start and end positions
|
|
15
|
-
* @returns The extracted code slice
|
|
16
|
-
*/
|
|
17
|
-
export declare function extractCode(code: string, node: ASTNode): string;
|
|
18
|
-
/**
|
|
19
|
-
* Extracts code for a function with a simplified approach.
|
|
20
|
-
* Creates a self-contained IIFE with stubs for globals.
|
|
21
|
-
* @param code - The full source code string
|
|
22
|
-
* @param funcNode - The function AST node
|
|
23
|
-
* @param ast - The full AST for dependency lookup
|
|
24
|
-
* @param funcName - The name of the main function
|
|
25
|
-
* @returns Combined code with dependencies wrapped in IIFE
|
|
26
|
-
*/
|
|
27
|
-
export declare function extractCodeWithDependencies(code: string, funcNode: ASTNode, ast: ASTNode, funcName: string): string;
|
|
28
|
-
/**
|
|
29
|
-
* Finds a variable definition by name in the AST.
|
|
30
|
-
* @param ast - The AST root node to search
|
|
31
|
-
* @param varName - The name of the variable to find
|
|
32
|
-
* @returns The variable declarator node if found, null otherwise
|
|
33
|
-
*/
|
|
34
|
-
export declare function findVariableDefinition(ast: ASTNode, varName: string): ASTNode | null;
|
|
35
|
-
//# sourceMappingURL=extractor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../../src/player/ast/extractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAI1C;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAsCzF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAO/D;AAiFD;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,EACjB,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,MAAM,GACjB,MAAM,CAyCR;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAapF"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export interface ASTNode {
|
|
2
|
-
type: string;
|
|
3
|
-
[key: string]: unknown;
|
|
4
|
-
}
|
|
5
|
-
export declare const WALK_STOP: unique symbol;
|
|
6
|
-
/**
|
|
7
|
-
* Recursively walks an AST tree and applies a callback to each node.
|
|
8
|
-
* Uses iterative approach with explicit stack for better performance on large ASTs.
|
|
9
|
-
*/
|
|
10
|
-
export declare function walkAst<T>(node: ASTNode, callback: (node: ASTNode) => T | typeof WALK_STOP | undefined): T | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Finds the signature decipher function call in YouTube's player.js.
|
|
13
|
-
* Supports multiple patterns:
|
|
14
|
-
* - Pattern 1: LogicalExpression with SequenceExpression (YouTube.js style)
|
|
15
|
-
* - Pattern 2: Direct CallExpression with decodeURIComponent argument
|
|
16
|
-
* - Pattern 3: AssignmentExpression with cipher function call
|
|
17
|
-
*/
|
|
18
|
-
export declare function sigMatcher(node: ASTNode): ASTNode | false;
|
|
19
|
-
/**
|
|
20
|
-
* Finds all potential 'n' parameter transformation function references.
|
|
21
|
-
* Searches for patterns like: var XX = [functionName] or var XX = [functionName, "string"]
|
|
22
|
-
* YouTube uses both single-element and multi-element arrays.
|
|
23
|
-
* @param ast - Full AST to search
|
|
24
|
-
* @returns Array of candidate function names
|
|
25
|
-
*/
|
|
26
|
-
export declare function findNFunctionCandidates(ast: ASTNode): string[];
|
|
27
|
-
/**
|
|
28
|
-
* Legacy nMatcher for backward compatibility.
|
|
29
|
-
* Searches for patterns: var XX = [functionName] or var XX = [functionName, "string"]
|
|
30
|
-
* @param node - AST node to check
|
|
31
|
-
* @returns The Identifier node containing function name, or false
|
|
32
|
-
*/
|
|
33
|
-
export declare function nMatcher(node: ASTNode): ASTNode | false;
|
|
34
|
-
/**
|
|
35
|
-
* Finds the signatureTimestamp value in player.js.
|
|
36
|
-
* Pattern 1: Direct ObjectExpression property (fastest)
|
|
37
|
-
* Pattern 2: Inside FunctionExpression body (fallback)
|
|
38
|
-
*/
|
|
39
|
-
export declare function timestampMatcher(node: ASTNode): ASTNode | false;
|
|
40
|
-
//# sourceMappingURL=matchers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchers.d.ts","sourceRoot":"","sources":["../../../src/player/ast/matchers.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,SAAS,eAAiB,CAAC;AAExC;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACvB,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,CAAC,GAAG,OAAO,SAAS,GAAG,SAAS,GAC5D,CAAC,GAAG,SAAS,CA2Bf;AAiBD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,KAAK,CAgGzD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CAuB9D;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,KAAK,CAgBvD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,KAAK,CAwD/D"}
|
package/dist/player/cache.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { type Result } from '../result';
|
|
2
|
-
import { type BundlpError } from '../types/error.types';
|
|
3
|
-
export interface CachedPlayer {
|
|
4
|
-
playerId: string;
|
|
5
|
-
code: string;
|
|
6
|
-
sigFunction: string;
|
|
7
|
-
nFunction: string;
|
|
8
|
-
signatureTimestamp: number;
|
|
9
|
-
cachedAt: number;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* SQLite-based cache for YouTube player.js cipher functions.
|
|
13
|
-
* Stores extracted signature and n-transform functions to avoid re-parsing.
|
|
14
|
-
*/
|
|
15
|
-
export declare class PlayerCache {
|
|
16
|
-
private db;
|
|
17
|
-
private readonly ttlMs;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a new PlayerCache instance.
|
|
20
|
-
* @param cachePath - Path to the SQLite database file
|
|
21
|
-
* @param ttlDays - Time-to-live for cached entries in days
|
|
22
|
-
*/
|
|
23
|
-
constructor(cachePath: string, ttlDays?: number);
|
|
24
|
-
private initializeSchema;
|
|
25
|
-
/**
|
|
26
|
-
* Retrieves a cached player entry.
|
|
27
|
-
* @param playerId - The player ID to look up
|
|
28
|
-
* @returns Result containing the cached player or null if not found/expired
|
|
29
|
-
*/
|
|
30
|
-
get(playerId: string): Result<CachedPlayer | null, BundlpError>;
|
|
31
|
-
/**
|
|
32
|
-
* Stores a player entry in the cache.
|
|
33
|
-
* @param data - The player data to cache
|
|
34
|
-
* @returns Result indicating success or failure
|
|
35
|
-
*/
|
|
36
|
-
set(data: CachedPlayer): Result<void, BundlpError>;
|
|
37
|
-
/**
|
|
38
|
-
* Deletes a specific player entry from the cache.
|
|
39
|
-
* @param playerId - The player ID to delete
|
|
40
|
-
* @returns Result indicating success or failure
|
|
41
|
-
*/
|
|
42
|
-
delete(playerId: string): Result<void, BundlpError>;
|
|
43
|
-
/**
|
|
44
|
-
* Clears all entries from the cache.
|
|
45
|
-
* @returns Result indicating success or failure
|
|
46
|
-
*/
|
|
47
|
-
clear(): Result<void, BundlpError>;
|
|
48
|
-
/**
|
|
49
|
-
* Retrieves the most recent valid cached player entry.
|
|
50
|
-
* Used to avoid re-downloading player.js when we have valid cache.
|
|
51
|
-
* @returns Result containing the cached player or null if none valid
|
|
52
|
-
*/
|
|
53
|
-
getLatest(): Result<CachedPlayer | null, BundlpError>;
|
|
54
|
-
/**
|
|
55
|
-
* Closes the database connection.
|
|
56
|
-
*/
|
|
57
|
-
close(): void;
|
|
58
|
-
private isExpired;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/player/cache.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIrE,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CACpB;AAWD;;;GAGG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,EAAE,CAAW;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAE/B;;;;OAIG;gBACS,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,MAAU;IASlD,OAAO,CAAC,gBAAgB;IAaxB;;;;OAIG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,YAAY,GAAG,IAAI,EAAE,WAAW,CAAC;IAgC/D;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAuBlD;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAUnD;;;OAGG;IACH,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IASlC;;;;OAIG;IACH,SAAS,IAAI,MAAM,CAAC,YAAY,GAAG,IAAI,EAAE,WAAW,CAAC;IAiCrD;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,SAAS;CAGpB"}
|
package/dist/player/player.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type Result } from '../result';
|
|
2
|
-
import { type BundlpError } from '../types/error.types';
|
|
3
|
-
/**
|
|
4
|
-
* Handles YouTube player.js downloading, parsing, and cipher function extraction.
|
|
5
|
-
* Uses AST-based extraction for robustness against YouTube's obfuscation changes.
|
|
6
|
-
*/
|
|
7
|
-
export declare class Player {
|
|
8
|
-
private cache;
|
|
9
|
-
private playerCode;
|
|
10
|
-
private sigFunctionCode;
|
|
11
|
-
private nFunctionCode;
|
|
12
|
-
private decipherFunc;
|
|
13
|
-
private nFunc;
|
|
14
|
-
private signatureTimestamp;
|
|
15
|
-
private initialized;
|
|
16
|
-
constructor(cacheDir?: string);
|
|
17
|
-
/**
|
|
18
|
-
* Downloads and parses the YouTube player.js to extract cipher functions.
|
|
19
|
-
* Uses cache-first strategy to minimize network requests.
|
|
20
|
-
* @param playerUrl - Optional direct URL to player.js, auto-detected if not provided
|
|
21
|
-
* @returns Result indicating success or failure
|
|
22
|
-
*/
|
|
23
|
-
initialize(playerUrl?: string): Promise<Result<void, BundlpError>>;
|
|
24
|
-
private extractPlayerId;
|
|
25
|
-
private restoreFromCache;
|
|
26
|
-
private processCode;
|
|
27
|
-
private extractSignatureTimestamp;
|
|
28
|
-
private extractDecipherFunction;
|
|
29
|
-
private extractNFunction;
|
|
30
|
-
/**
|
|
31
|
-
* Returns the signature timestamp extracted from player.js.
|
|
32
|
-
* Required for some InnerTube API calls.
|
|
33
|
-
*/
|
|
34
|
-
getSignatureTimestamp(): number;
|
|
35
|
-
/**
|
|
36
|
-
* Deciphers a signature cipher string and constructs the final playback URL.
|
|
37
|
-
* @param baseUrl - The base URL from the format
|
|
38
|
-
* @param signatureCipher - The encoded signature cipher string
|
|
39
|
-
* @returns The deciphered playback URL
|
|
40
|
-
*/
|
|
41
|
-
decipher(baseUrl: string, signatureCipher: string): string;
|
|
42
|
-
/**
|
|
43
|
-
* Deobfuscates the 'n' parameter to prevent throttling.
|
|
44
|
-
* @param nParam - The obfuscated n parameter value
|
|
45
|
-
* @returns The deobfuscated n parameter value
|
|
46
|
-
*/
|
|
47
|
-
deobfuscateN(nParam: string): string;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=player.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"player.d.ts","sourceRoot":"","sources":["../../src/player/player.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,MAAM,EAAQ,MAAM,WAAW,CAAC;AACvD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AASrE;;;GAGG;AACH,qBAAa,MAAM;IACf,OAAO,CAAC,KAAK,CAA4B;IACzC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,eAAe,CAAc;IACrC,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,kBAAkB,CAAa;IACvC,OAAO,CAAC,WAAW,CAAkB;gBAEzB,QAAQ,CAAC,EAAE,MAAM;IAO7B;;;;;OAKG;IACG,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAuDxE,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,gBAAgB;IAsBxB,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,uBAAuB;IAoC/B,OAAO,CAAC,gBAAgB;IAsCxB;;;OAGG;IACH,qBAAqB,IAAI,MAAM;IAI/B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM;IAoB1D;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CASvC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type Result } from '../../result';
|
|
2
|
-
import { type BundlpError } from '../../types/error.types';
|
|
3
|
-
import type { DescrambledChallenge } from '../types';
|
|
4
|
-
export interface AttestationResponse {
|
|
5
|
-
visitorData: string;
|
|
6
|
-
challenge: string;
|
|
7
|
-
program: string;
|
|
8
|
-
}
|
|
9
|
-
export interface ChallengeFetcherOptions {
|
|
10
|
-
timeout?: number;
|
|
11
|
-
}
|
|
12
|
-
export declare class ChallengeFetcher {
|
|
13
|
-
private timeout;
|
|
14
|
-
constructor(options?: ChallengeFetcherOptions);
|
|
15
|
-
fetchAttestation(): Promise<Result<AttestationResponse, BundlpError>>;
|
|
16
|
-
private parseAttestationResponse;
|
|
17
|
-
fetchWaaChallenge(): Promise<Result<DescrambledChallenge, BundlpError>>;
|
|
18
|
-
private descrambleWaaResponse;
|
|
19
|
-
fetchFullChallenge(): Promise<Result<DescrambledChallenge, BundlpError>>;
|
|
20
|
-
fetch(): Promise<Result<AttestationResponse, BundlpError>>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=challenge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"challenge.d.ts","sourceRoot":"","sources":["../../../src/po-token/botguard/challenge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAOrD,MAAM,WAAW,mBAAmB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,gBAAgB;IACzB,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,GAAE,uBAA4B;IAI3C,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;IA0C3E,OAAO,CAAC,wBAAwB;IA6B1B,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;IAmC7E,OAAO,CAAC,qBAAqB;IA2CvB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;IAIxE,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;CAGnE"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type Result } from '../../result';
|
|
2
|
-
import { type BundlpError } from '../../types/error.types';
|
|
3
|
-
import type { DescrambledChallenge, BotGuardClientOptions, ContentBinding } from '../types';
|
|
4
|
-
export declare class BotGuardClient {
|
|
5
|
-
private dom;
|
|
6
|
-
private vm;
|
|
7
|
-
private program;
|
|
8
|
-
private globalName;
|
|
9
|
-
private deferredVmFunctions;
|
|
10
|
-
private syncSnapshotFunction?;
|
|
11
|
-
private initTimeout;
|
|
12
|
-
private snapshotTimeout;
|
|
13
|
-
private constructor();
|
|
14
|
-
static create(challenge: DescrambledChallenge, options?: BotGuardClientOptions): Promise<Result<BotGuardClient, BundlpError>>;
|
|
15
|
-
private load;
|
|
16
|
-
private loadProgram;
|
|
17
|
-
snapshot(binding?: ContentBinding): Promise<Result<string, BundlpError>>;
|
|
18
|
-
snapshotWithSignalOutput(binding?: ContentBinding): Promise<Result<{
|
|
19
|
-
snapshot: string;
|
|
20
|
-
webPoSignalOutput: unknown[];
|
|
21
|
-
}, BundlpError>>;
|
|
22
|
-
shutdown(): void;
|
|
23
|
-
}
|
|
24
|
-
export declare function generateColdStartToken(identifier: string, clientState?: number): string;
|
|
25
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/po-token/botguard/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAsB5F,qBAAa,cAAc;IACvB,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,EAAE,CAAwC;IAClD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,mBAAmB,CAAsC;IACjE,OAAO,CAAC,oBAAoB,CAAC,CAAuC;IACpE,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,eAAe,CAAS;IAEhC,OAAO;WAOM,MAAM,CACf,SAAS,EAAE,oBAAoB,EAC/B,OAAO,GAAE,qBAA0B,GACpC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;YAWjC,IAAI;YAmDJ,WAAW;IAiDnB,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IA8CxE,wBAAwB,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,OAAO,EAAE,CAAA;KAAE,EAAE,WAAW,CAAC,CAAC;IA8C1I,QAAQ,IAAI,IAAI;CAYnB;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,SAAI,GAAG,MAAM,CAiClF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type Result } from '../../result';
|
|
2
|
-
import { type BundlpError } from '../../types/error.types';
|
|
3
|
-
import type { PoTokenData, PoTokenContext } from '../types';
|
|
4
|
-
import type { ClientName } from '../../utils/constants';
|
|
5
|
-
export declare class TokenCache {
|
|
6
|
-
private db;
|
|
7
|
-
constructor(cachePath: string);
|
|
8
|
-
private initializeSchema;
|
|
9
|
-
get(bindingValue: string, client: ClientName, context: PoTokenContext): Result<PoTokenData | null, BundlpError>;
|
|
10
|
-
getByClient(client: ClientName): Result<PoTokenData[], BundlpError>;
|
|
11
|
-
getExpiringSoon(marginMs: number): Result<PoTokenData[], BundlpError>;
|
|
12
|
-
set(data: PoTokenData): Result<void, BundlpError>;
|
|
13
|
-
delete(bindingValue: string, client: ClientName, context: PoTokenContext): Result<void, BundlpError>;
|
|
14
|
-
deleteExpired(): Result<number, BundlpError>;
|
|
15
|
-
clear(): Result<void, BundlpError>;
|
|
16
|
-
getStats(): Result<{
|
|
17
|
-
total: number;
|
|
18
|
-
expired: number;
|
|
19
|
-
valid: number;
|
|
20
|
-
}, BundlpError>;
|
|
21
|
-
close(): void;
|
|
22
|
-
private rowToTokenData;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=token-cache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-cache.d.ts","sourceRoot":"","sources":["../../../src/po-token/cache/token-cache.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAe,MAAM,UAAU,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIxD,qBAAa,UAAU;IACnB,OAAO,CAAC,EAAE,CAAW;gBAET,SAAS,EAAE,MAAM;IAQ7B,OAAO,CAAC,gBAAgB;IAgCxB,GAAG,CACC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,cAAc,GACxB,MAAM,CAAC,WAAW,GAAG,IAAI,EAAE,WAAW,CAAC;IAsB1C,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,EAAE,WAAW,CAAC;IAenE,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,EAAE,WAAW,CAAC;IAgBrE,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IA8BjD,MAAM,CACF,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,cAAc,GACxB,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAW5B,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;IAU5C,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IASlC,QAAQ,IAAI,MAAM,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,WAAW,CAAC;IAoBlF,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,cAAc;CAazB"}
|
package/dist/po-token/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export { PoTokenManager } from './manager';
|
|
2
|
-
export type { PoTokenManagerConfig } from './manager';
|
|
3
|
-
export { PO_TOKEN_POLICIES } from './policies';
|
|
4
|
-
export type { PoTokenPolicy, PoTokenRequirement } from './policies';
|
|
5
|
-
export type { PoTokenData, PoTokenContext, TokenBindingType, ContentBinding, DescrambledChallenge, PoTokenProvider, ProviderOptions, PoTokenStats, BotGuardClientOptions, } from './types';
|
|
6
|
-
export { LocalBotGuardProvider } from './providers/local.provider';
|
|
7
|
-
export type { PoTokenProviderOptions } from './providers/provider.interface';
|
|
8
|
-
export { BotGuardClient, generateColdStartToken } from './botguard/client';
|
|
9
|
-
export { ChallengeFetcher } from './botguard/challenge';
|
|
10
|
-
export type { AttestationResponse } from './botguard/challenge';
|
|
11
|
-
export { WebPoMinter, fetchIntegrityToken } from './minter/web-minter';
|
|
12
|
-
export type { IntegrityTokenData, WebPoMinterOptions } from './minter/web-minter';
|
|
13
|
-
export { TokenCache } from './cache/token-cache';
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/po-token/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEpE,YAAY,EACR,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,qBAAqB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACvE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type Result } from '../result';
|
|
2
|
-
import { type BundlpError } from '../types/error.types';
|
|
3
|
-
import type { ClientName } from '../utils/constants';
|
|
4
|
-
import { type PoTokenPolicy } from './policies';
|
|
5
|
-
import type { PoTokenData, ContentBinding } from './types';
|
|
6
|
-
import type { PoTokenProvider } from './providers/provider.interface';
|
|
7
|
-
export interface PoTokenManagerConfig {
|
|
8
|
-
token?: string;
|
|
9
|
-
cacheEnabled?: boolean;
|
|
10
|
-
cachePath?: string;
|
|
11
|
-
timeout?: number;
|
|
12
|
-
providers?: PoTokenProvider[];
|
|
13
|
-
}
|
|
14
|
-
export declare class PoTokenManager {
|
|
15
|
-
private staticToken?;
|
|
16
|
-
private policies;
|
|
17
|
-
private providers;
|
|
18
|
-
private cache;
|
|
19
|
-
constructor(config?: PoTokenManagerConfig);
|
|
20
|
-
getToken(identifier: string, client?: ClientName, binding?: ContentBinding): Promise<Result<string, BundlpError>>;
|
|
21
|
-
getTokenData(identifier: string, client?: ClientName, binding?: ContentBinding): Promise<Result<PoTokenData, BundlpError>>;
|
|
22
|
-
getColdStartToken(identifier: string): string;
|
|
23
|
-
isRequired(client: ClientName): boolean;
|
|
24
|
-
needsTokenForGvs(client: ClientName): boolean;
|
|
25
|
-
getPolicy(client: ClientName): PoTokenPolicy | undefined;
|
|
26
|
-
getVisitorData(): string | undefined;
|
|
27
|
-
shutdown(): void;
|
|
28
|
-
getCacheStats(): {
|
|
29
|
-
total: number;
|
|
30
|
-
expired: number;
|
|
31
|
-
valid: number;
|
|
32
|
-
} | null;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/po-token/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAkB,MAAM,SAAS,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAKtE,MAAM,WAAW,oBAAoB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;CACjC;AAED,qBAAa,cAAc;IACvB,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,KAAK,CAA2B;gBAE5B,MAAM,GAAE,oBAAyB;IAevC,QAAQ,CACV,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,UAAkB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAmCjC,YAAY,CACd,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,UAAkB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IA2C5C,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAI7C,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAWvC,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAe7C,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,GAAG,SAAS;IAIxD,cAAc,IAAI,MAAM,GAAG,SAAS;IASpC,QAAQ,IAAI,IAAI;IAUhB,aAAa,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAQ5E"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type Result } from '../../result';
|
|
2
|
-
import { type BundlpError } from '../../types/error.types';
|
|
3
|
-
export interface IntegrityTokenData {
|
|
4
|
-
integrityToken: string;
|
|
5
|
-
estimatedTtlSecs: number;
|
|
6
|
-
mintRefreshThreshold: number;
|
|
7
|
-
websafeFallbackToken?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface WebPoMinterOptions {
|
|
10
|
-
timeout?: number;
|
|
11
|
-
}
|
|
12
|
-
export declare class WebPoMinter {
|
|
13
|
-
private mintCallback;
|
|
14
|
-
private constructor();
|
|
15
|
-
static create(integrityTokenData: IntegrityTokenData, webPoSignalOutput: unknown[]): Promise<Result<WebPoMinter, BundlpError>>;
|
|
16
|
-
mint(identifier: string): Promise<Result<Uint8Array, BundlpError>>;
|
|
17
|
-
mintAsWebsafeString(identifier: string): Promise<Result<string, BundlpError>>;
|
|
18
|
-
}
|
|
19
|
-
export declare function fetchIntegrityToken(botguardResponse: string, options?: WebPoMinterOptions): Promise<Result<IntegrityTokenData, BundlpError>>;
|
|
20
|
-
//# sourceMappingURL=web-minter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-minter.d.ts","sourceRoot":"","sources":["../../../src/po-token/minter/web-minter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAMxE,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAKD,qBAAa,WAAW;IACpB,OAAO,CAAC,YAAY,CAAe;IAEnC,OAAO;WAIM,MAAM,CACf,kBAAkB,EAAE,kBAAkB,EACtC,iBAAiB,EAAE,OAAO,EAAE,GAC7B,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IA6BtC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IA+BlE,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CAStF;AAED,wBAAsB,mBAAmB,CACrC,gBAAgB,EAAE,MAAM,EACxB,OAAO,GAAE,kBAAuB,GACjC,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC,CA4ClD"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ClientName } from '../utils/constants';
|
|
2
|
-
export type PoTokenRequirement = 'required' | 'recommended' | 'not_required';
|
|
3
|
-
export interface PoTokenPolicy {
|
|
4
|
-
GVS: PoTokenRequirement | {
|
|
5
|
-
HTTPS: PoTokenRequirement;
|
|
6
|
-
DASH: PoTokenRequirement;
|
|
7
|
-
HLS: PoTokenRequirement;
|
|
8
|
-
};
|
|
9
|
-
PLAYER: PoTokenRequirement;
|
|
10
|
-
SUBS: PoTokenRequirement;
|
|
11
|
-
notRequiredForPremium?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* PO Token policies for each InnerTube client.
|
|
15
|
-
* Defines when PO tokens are required for different endpoints.
|
|
16
|
-
*/
|
|
17
|
-
export declare const PO_TOKEN_POLICIES: Record<ClientName, PoTokenPolicy>;
|
|
18
|
-
//# sourceMappingURL=policies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../src/po-token/policies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC;AAE7E,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,kBAAkB,GAAG;QACtB,KAAK,EAAE,kBAAkB,CAAC;QAC1B,IAAI,EAAE,kBAAkB,CAAC;QACzB,GAAG,EAAE,kBAAkB,CAAC;KAC3B,CAAC;IACF,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,kBAAkB,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,CAgC/D,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type Result } from '../../result';
|
|
2
|
-
import { type BundlpError } from '../../types/error.types';
|
|
3
|
-
import type { PoTokenData, ContentBinding } from '../types';
|
|
4
|
-
import type { PoTokenProvider, PoTokenProviderOptions } from './provider.interface';
|
|
5
|
-
export declare class LocalBotGuardProvider implements PoTokenProvider {
|
|
6
|
-
readonly name = "local-botguard";
|
|
7
|
-
readonly priority = 100;
|
|
8
|
-
private options;
|
|
9
|
-
private challengeFetcher;
|
|
10
|
-
private client;
|
|
11
|
-
private challenge;
|
|
12
|
-
private attestation;
|
|
13
|
-
private integrityData;
|
|
14
|
-
private minter;
|
|
15
|
-
private initPromise;
|
|
16
|
-
private createdAt;
|
|
17
|
-
constructor(options?: PoTokenProviderOptions);
|
|
18
|
-
isAvailable(): Promise<boolean>;
|
|
19
|
-
generate(identifier: string, _binding?: ContentBinding): Promise<Result<PoTokenData, BundlpError>>;
|
|
20
|
-
private ensureInitialized;
|
|
21
|
-
private initialize;
|
|
22
|
-
private reset;
|
|
23
|
-
shutdown(): void;
|
|
24
|
-
getVisitorData(): string | undefined;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=local.provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local.provider.d.ts","sourceRoot":"","sources":["../../../src/po-token/providers/local.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAwB,MAAM,UAAU,CAAC;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAOpF,qBAAa,qBAAsB,YAAW,eAAe;IACzD,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,QAAQ,OAAO;IAExB,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,WAAW,CAAoC;IACvD,OAAO,CAAC,aAAa,CAAmC;IACxD,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,WAAW,CAAmD;IACtE,OAAO,CAAC,SAAS,CAAa;gBAElB,OAAO,GAAE,sBAA2B;IAK1C,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAS/B,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YA8B1F,iBAAiB;YAwBjB,UAAU;IA0CxB,OAAO,CAAC,KAAK;IAWb,QAAQ,IAAI,IAAI;IAIhB,cAAc,IAAI,MAAM,GAAG,SAAS;CAGvC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Result } from '../../result';
|
|
2
|
-
import type { BundlpError } from '../../types/error.types';
|
|
3
|
-
import type { PoTokenData, ContentBinding } from '../types';
|
|
4
|
-
export interface PoTokenProvider {
|
|
5
|
-
readonly name: string;
|
|
6
|
-
readonly priority: number;
|
|
7
|
-
generate(identifier: string, binding?: ContentBinding): Promise<Result<PoTokenData, BundlpError>>;
|
|
8
|
-
isAvailable(): Promise<boolean>;
|
|
9
|
-
shutdown(): void;
|
|
10
|
-
}
|
|
11
|
-
export interface PoTokenProviderOptions {
|
|
12
|
-
timeout?: number;
|
|
13
|
-
cacheEnabled?: boolean;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=provider.interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider.interface.d.ts","sourceRoot":"","sources":["../../../src/po-token/providers/provider.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;IAElG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEhC,QAAQ,IAAI,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|