* chore(deps): Add `meriyah` * feat(utils): Implement AST-based JS extractors * chore(utils): Remove old ast walker code * fix(Player): Migrate js extraction logic * chore(JsExtractor): Fix typo in tsdoc * perf(JsAnalyzer): Simplify main AST analysis logic * fix(JsAnalyzer): Change `break` to `return` in AST matching logic * chore: Update docs * chore: Don't export `PlayerInitializationOptions` * chore(evaluate): Update error message to include doc link * perf: Use a `for-loop` to find iife
4.1 KiB
youtubei.js / Player
Class: Player
Represents YouTube's player script. This is required to decipher signatures.
Constructors
new Player()
new Player(
player_id,signature_timestamp,data?):Player
Parameters
• player_id: string
• signature_timestamp: number
• data?: BuildScriptResult
Returns
Defined in
Properties
data?
optionaldata:BuildScriptResult
Defined in
player_id
player_id:
string
Defined in
po_token?
optionalpo_token:string
Defined in
signature_timestamp
signature_timestamp:
number
Defined in
Accessors
url
geturl():string
Returns
string
Defined in
LIBRARY_VERSION
getstaticLIBRARY_VERSION():number
Returns
number
Defined in
Methods
cache()
cache(
cache?):Promise<void>
Parameters
• cache?: ICache
Returns
Promise<void>
Defined in
decipher()
decipher(
url?,signature_cipher?,cipher?,this_response_nsig_cache?):Promise<string>
Parameters
• url?: string
• signature_cipher?: string
• cipher?: string
• this_response_nsig_cache?: Map<string, string>
Returns
Promise<string>
Defined in
create()
staticcreate(cache,fetch,po_token?,player_id?):Promise<Player>
Parameters
• cache: undefined | ICache
• fetch = Platform.shim.fetch
• po_token?: string
• player_id?: string
Returns
Promise<Player>
Defined in
fromCache()
staticfromCache(cache,player_id):Promise<null|Player>
Parameters
• cache: ICache
• player_id: string
Returns
Promise<null | Player>
Defined in
fromSource()
staticfromSource(player_id,options):Promise<Player>
Parameters
• player_id: string
• options: PlayerInitializationOptions
Returns
Promise<Player>