fix: improve deobfuscator (support multiple nsig name matches, error if mapping all streams fails)

Since YouTube keeps changing the nsig function signature and a generic regex may match at multiple places, I changed the extraction logic to search for multiple matches if necessary and test the extracted deobfuscation functions.

I also found out that if the deobfuscation fails for all streams, fetching the player still returns a successful result with no streams, suggesting that the video is not available. So I changed the mapper to throw an ExtractionError if no streams are mapped successfully.
This commit is contained in:
ThetaDev 2024-07-29 14:45:52 +02:00
parent 11a0038350
commit 8152ce6b08
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
4 changed files with 414 additions and 331 deletions

View file

@ -70,6 +70,7 @@ rstest = "0.21.0"
tokio-test = "0.4.2"
insta = { version = "1.17.1", features = ["ron", "redactions"] }
path_macro = "1.0.0"
tracing-test = "0.2.5"
# Included crates
rustypipe = { path = ".", version = "0.2.0", default-features = false }
@ -115,3 +116,4 @@ rstest.workspace = true
tokio-test.workspace = true
insta.workspace = true
path_macro.workspace = true
tracing-test.workspace = true