mirror of
https://github.com/dirtydishes/dreamio.git
synced 2026-06-06 13:37:24 +00:00
accept stremio subtitle download urls
This commit is contained in:
parent
11ed364094
commit
11b9c6a12a
7 changed files with 540 additions and 1 deletions
|
|
@ -256,6 +256,7 @@ enum SubtitleCandidateParser {
|
|||
}
|
||||
guard isDirectSubtitleFile(url)
|
||||
|| isOpenSubtitlesDownloadURL(url)
|
||||
|| isStremioSubtitleDownloadURL(url)
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -282,6 +283,18 @@ enum SubtitleCandidateParser {
|
|||
|| path.range(of: #"(^|/)subtitles?(/|$)"#, options: .regularExpression) != nil
|
||||
}
|
||||
|
||||
private static func isStremioSubtitleDownloadURL(_ url: URL) -> Bool {
|
||||
guard let host = url.host?.lowercased(),
|
||||
host == "strem.io" || host.hasSuffix(".strem.io")
|
||||
else {
|
||||
return false
|
||||
}
|
||||
|
||||
let path = url.path.lowercased()
|
||||
return path.range(of: #"^/[a-z]{2,3}/download(/|$)"#, options: .regularExpression) != nil
|
||||
|| path.range(of: #"(^|/)download(/|$)"#, options: .regularExpression) != nil
|
||||
}
|
||||
|
||||
private static func isOpenSubtitlesManifestIdentifier(_ url: URL) -> Bool {
|
||||
guard url.host?.localizedCaseInsensitiveContains("opensubtitles") == true else {
|
||||
return false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue