refactor(Player)!: Use AST-based JS extraction with side-effect safe code emission (#1052)

* 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
This commit is contained in:
Luan
2025-10-12 09:08:51 -03:00
committed by GitHub
parent bffa92d96e
commit 25d0876b91
873 changed files with 10992 additions and 8345 deletions

View File

@@ -30,7 +30,7 @@
#### Defined in
[src/parser/ytkids/VideoInfo.ts:17](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/parser/ytkids/VideoInfo.ts#L17)
[src/parser/ytkids/VideoInfo.ts:17](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/parser/ytkids/VideoInfo.ts#L17)
## Properties
@@ -44,7 +44,7 @@
#### Defined in
[src/core/mixins/MediaInfo.ts:40](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L40)
[src/core/mixins/MediaInfo.ts:40](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L40)
***
@@ -190,7 +190,7 @@
#### Defined in
[src/core/mixins/MediaInfo.ts:39](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L39)
[src/core/mixins/MediaInfo.ts:39](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L39)
***
@@ -204,7 +204,7 @@
#### Defined in
[src/core/mixins/MediaInfo.ts:43](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L43)
[src/core/mixins/MediaInfo.ts:43](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L43)
***
@@ -218,7 +218,7 @@
#### Defined in
[src/core/mixins/MediaInfo.ts:44](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L44)
[src/core/mixins/MediaInfo.ts:44](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L44)
***
@@ -228,7 +228,7 @@
#### Defined in
[src/parser/ytkids/VideoInfo.ts:14](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/parser/ytkids/VideoInfo.ts#L14)
[src/parser/ytkids/VideoInfo.ts:14](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/parser/ytkids/VideoInfo.ts#L14)
***
@@ -242,7 +242,7 @@
#### Defined in
[src/core/mixins/MediaInfo.ts:42](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L42)
[src/core/mixins/MediaInfo.ts:42](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L42)
***
@@ -256,7 +256,7 @@
#### Defined in
[src/core/mixins/MediaInfo.ts:46](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L46)
[src/core/mixins/MediaInfo.ts:46](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L46)
***
@@ -270,7 +270,7 @@
#### Defined in
[src/core/mixins/MediaInfo.ts:47](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L47)
[src/core/mixins/MediaInfo.ts:47](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L47)
***
@@ -280,7 +280,7 @@
#### Defined in
[src/parser/ytkids/VideoInfo.ts:15](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/parser/ytkids/VideoInfo.ts#L15)
[src/parser/ytkids/VideoInfo.ts:15](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/parser/ytkids/VideoInfo.ts#L15)
***
@@ -290,7 +290,7 @@
#### Defined in
[src/parser/ytkids/VideoInfo.ts:12](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/parser/ytkids/VideoInfo.ts#L12)
[src/parser/ytkids/VideoInfo.ts:12](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/parser/ytkids/VideoInfo.ts#L12)
***
@@ -304,7 +304,7 @@
#### Defined in
[src/core/mixins/MediaInfo.ts:41](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L41)
[src/core/mixins/MediaInfo.ts:41](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L41)
***
@@ -318,7 +318,7 @@
#### Defined in
[src/core/mixins/MediaInfo.ts:45](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L45)
[src/core/mixins/MediaInfo.ts:45](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L45)
***
@@ -328,7 +328,7 @@
#### Defined in
[src/parser/ytkids/VideoInfo.ts:13](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/parser/ytkids/VideoInfo.ts#L13)
[src/parser/ytkids/VideoInfo.ts:13](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/parser/ytkids/VideoInfo.ts#L13)
## Accessors
@@ -346,7 +346,7 @@
#### Defined in
[src/core/mixins/MediaInfo.ts:247](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L247)
[src/core/mixins/MediaInfo.ts:247](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L247)
***
@@ -366,7 +366,7 @@ Content Playback Nonce.
#### Defined in
[src/core/mixins/MediaInfo.ts:254](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L254)
[src/core/mixins/MediaInfo.ts:254](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L254)
***
@@ -386,7 +386,7 @@ Parsed InnerTube response.
#### Defined in
[src/core/mixins/MediaInfo.ts:261](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L261)
[src/core/mixins/MediaInfo.ts:261](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L261)
## Methods
@@ -412,7 +412,7 @@ Parsed InnerTube response.
#### Defined in
[src/core/mixins/MediaInfo.ts:208](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L208)
[src/core/mixins/MediaInfo.ts:208](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L208)
***
@@ -438,7 +438,7 @@ Options
#### Defined in
[src/core/mixins/MediaInfo.ts:161](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L161)
[src/core/mixins/MediaInfo.ts:161](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L161)
***
@@ -464,13 +464,13 @@ Download options.
#### Defined in
[src/core/mixins/MediaInfo.ts:169](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L169)
[src/core/mixins/MediaInfo.ts:169](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L169)
***
### getStreamingInfo()
> **getStreamingInfo**(`url_transformer`?, `format_filter`?): `StreamingInfo`
> **getStreamingInfo**(`url_transformer`?, `format_filter`?): `Promise`\<`StreamingInfo`\>
Get a cleaned up representation of the adaptive_formats
@@ -482,7 +482,7 @@ Get a cleaned up representation of the adaptive_formats
#### Returns
`StreamingInfo`
`Promise`\<`StreamingInfo`\>
#### Inherited from
@@ -490,7 +490,7 @@ Get a cleaned up representation of the adaptive_formats
#### Defined in
[src/core/mixins/MediaInfo.ts:144](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L144)
[src/core/mixins/MediaInfo.ts:144](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L144)
***
@@ -510,7 +510,7 @@ Retrieves the video's transcript.
#### Defined in
[src/core/mixins/MediaInfo.ts:182](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L182)
[src/core/mixins/MediaInfo.ts:182](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L182)
***
@@ -542,7 +542,7 @@ DASH manifest
#### Defined in
[src/core/mixins/MediaInfo.ts:104](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L104)
[src/core/mixins/MediaInfo.ts:104](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L104)
***
@@ -570,4 +570,4 @@ DASH manifest
#### Defined in
[src/core/mixins/MediaInfo.ts:227](https://github.com/LuanRT/YouTube.js/blob/4ae0cc5c523a2080e68d6c0c1437c78fe318ea30/src/core/mixins/MediaInfo.ts#L227)
[src/core/mixins/MediaInfo.ts:227](https://github.com/LuanRT/YouTube.js/blob/af92984523f90200a18314b94478a2697c9deab0/src/core/mixins/MediaInfo.ts#L227)