feat: resolve HTTP video URLs with bundled yt-dlp
This commit is contained in:
@@ -52,9 +52,12 @@ struct StreamResolverChecks {
|
||||
throw Failure(message: "YouTube URL classification")
|
||||
}
|
||||
try require(youtube.absoluteString == "https://www.youtube.com/watch?v=jNQXAC9IVRw", "existing YouTube normalization")
|
||||
let other = "https://vimeo.com/76979871?quality=original"
|
||||
guard case .youtube(let generic) = try StreamURL.parse(other) else {
|
||||
throw Failure(message: "other HTTP(S) sites route through yt-dlp")
|
||||
}
|
||||
try require(generic.absoluteString == other, "other sites retain their URL and query")
|
||||
for invalid in [
|
||||
"https://example.com/video", "https://www.miruro.to/watch?id=21&ep=1",
|
||||
page.replacingOccurrences(of: "barelystarted.miruro.tv", with: "barelystarted.miruro.tv.evil.example"),
|
||||
page.replacingOccurrences(of: "barelystarted.miruro.tv", with: "barelystarted.miruro.tv@evil.example"),
|
||||
page.replacingOccurrences(of: "https://", with: "http://"),
|
||||
page.replacingOccurrences(of: "https://", with: "https://user:secret@"),
|
||||
@@ -70,7 +73,7 @@ struct StreamResolverChecks {
|
||||
page + "&ep=2", page + "&provider=bee", page + "#secret",
|
||||
page.replacingOccurrences(of: ".tv/", with: ".tv:444/"),
|
||||
page.replacingOccurrences(of: "?ep", with: "/?ep"),
|
||||
"https://youtu.be/invalid", "file:///secret"
|
||||
"file:///secret"
|
||||
] {
|
||||
try reject("unsupported or unsafe URL") { _ = try StreamURL.parse(invalid) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user