newpipe-extractor-js
Version:
JavaScript/Node.js port of NewPipeExtractor
94 lines • 2.28 kB
TypeScript
/**
* Advanced Throttling Parameter Decryptor
* Handles YouTube's n-parameter obfuscation used to prevent bot access
*/
export declare class ThrottlingDecryptor {
private cache;
private readonly CACHE_TIMEOUT;
private readonly MAX_CACHE_SIZE;
private static readonly N_FUNCTION_PATTERNS;
constructor();
/**
* Decrypt throttling parameter from URL
*/
decryptThrottlingParameter(url: string, playerJsCode?: string): Promise<string>;
/**
* Extract n parameter from URL
*/
private extractNParameter;
/**
* Replace n parameter in URL
*/
private replaceNParameter;
/**
* Extract throttling function from player JS
*/
private extractThrottlingFunction;
/**
* Parse throttling operations from function code
*/
private parseThrottlingOperations;
/**
* Apply throttling operations to decrypt parameter
*/
private applyThrottlingOperations;
/**
* Apply character transformation
*/
private applyCharacterTransform;
/**
* Apply deterministic shuffle
*/
private applyDeterministicShuffle;
/**
* Generate cache key from player JS
*/
private generateCacheKey;
/**
* Simple hash function for cache keys
*/
private simpleHash;
/**
* Check if cache entry is still valid
*/
private isCacheValid;
/**
* Clean up expired cache entries
*/
private cleanupCache;
/**
* Escape regex special characters
*/
private escapeRegex;
/**
* Clear all cached data
*/
clearCache(): void;
/**
* Get cache statistics
*/
getCacheStats(): {
size: number;
entries: Array<{
key: string;
timestamp: number;
success: boolean;
}>;
};
/**
* Test throttling decryption with known parameters
*/
testDecryption(testCases: Array<{
input: string;
expected?: string;
}>): Promise<Array<{
input: string;
output: string;
success: boolean;
}>>;
}
/**
* Singleton instance of throttling decryptor
*/
export declare const throttlingDecryptor: ThrottlingDecryptor;
//# sourceMappingURL=ThrottlingDecryptor.d.ts.map