mirror of
https://github.com/cranci1/Sora.git
synced 2026-05-12 04:50:41 +00:00
applied a lot of patches ngl
This commit is contained in:
parent
66ca3cfa78
commit
457cfe9480
6 changed files with 42 additions and 14 deletions
|
|
@ -548,7 +548,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 0.1.0;
|
MARKETING_VERSION = 0.1.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = me.cranci.Sora;
|
PRODUCT_BUNDLE_IDENTIFIER = me.cranci.Sora;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SUPPORTS_MACCATALYST = YES;
|
SUPPORTS_MACCATALYST = YES;
|
||||||
|
|
@ -581,7 +581,7 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 0.1.0;
|
MARKETING_VERSION = 0.1.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = me.cranci.Sora;
|
PRODUCT_BUNDLE_IDENTIFIER = me.cranci.Sora;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SUPPORTS_MACCATALYST = YES;
|
SUPPORTS_MACCATALYST = YES;
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -121,10 +121,16 @@ struct HomeView: View {
|
||||||
let href = try element.select(module.module[0].featured.href).attr("href")
|
let href = try element.select(module.module[0].featured.href).attr("href")
|
||||||
var imageURL = try element.select(module.module[0].featured.image.url).attr(module.module[0].featured.image.attribute)
|
var imageURL = try element.select(module.module[0].featured.image.url).attr(module.module[0].featured.image.attribute)
|
||||||
|
|
||||||
if !imageURL.starts(with: "http") {
|
if imageURL.contains(",") {
|
||||||
imageURL = "\(module.module[0].details.baseURL)\(imageURL)"
|
imageURL = imageURL.split(separator: ",").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }.first ?? imageURL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !imageURL.starts(with: "http") {
|
||||||
|
imageURL = "\(module.module[0].details.baseURL.hasSuffix("/") ? module.module[0].details.baseURL : "\(module.module[0].details.baseURL)/")\(imageURL.hasPrefix("/") ? String(imageURL.dropFirst()) : imageURL)"
|
||||||
|
}
|
||||||
|
|
||||||
|
imageURL = imageURL.replacingOccurrences(of: " ", with: "%20")
|
||||||
|
|
||||||
let result = ItemResult(name: title, imageUrl: imageURL, href: href)
|
let result = ItemResult(name: title, imageUrl: imageURL, href: href)
|
||||||
results.append(result)
|
results.append(result)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,9 +97,7 @@ extension MediaView {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.playStream(urlString: patternURL?.absoluteString, fullURL: urlString)
|
self.playStream(urlString: patternURL?.absoluteString, fullURL: urlString)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.playStream(urlString: streamURLs.first, fullURL: urlString)
|
self.playStream(urlString: streamURLs.first, fullURL: urlString)
|
||||||
}
|
}
|
||||||
|
|
@ -133,14 +131,32 @@ extension MediaView {
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractPatternURL(from html: String) -> URL? {
|
func extractPatternURL(from html: String) -> URL? {
|
||||||
let pattern = module.module[0].episodes.pattern
|
var pattern = module.module[0].episodes.pattern
|
||||||
|
|
||||||
|
if module.extractor == "pattern" {
|
||||||
|
if let data = Data(base64Encoded: pattern), let decodedPattern = String(data: data, encoding: .utf8) {
|
||||||
|
pattern = decodedPattern
|
||||||
|
} else {
|
||||||
|
print("Failed to decode base64 pattern")
|
||||||
|
Logger.shared.log("Failed to decode base64 pattern")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let regex = try NSRegularExpression(pattern: pattern, options: [])
|
let regex = try NSRegularExpression(pattern: pattern, options: [])
|
||||||
let matches = regex.matches(in: html, options: [], range: NSRange(html.startIndex..., in: html))
|
let range = NSRange(html.startIndex..<html.endIndex, in: html)
|
||||||
if let match = matches.first, let range = Range(match.range, in: html) {
|
|
||||||
var urlString = String(html[range])
|
if let match = regex.firstMatch(in: html, options: [], range: range),
|
||||||
|
let matchRange = Range(match.range, in: html) {
|
||||||
|
var urlString = String(html[matchRange])
|
||||||
urlString = urlString.replacingOccurrences(of: "amp;", with: "")
|
urlString = urlString.replacingOccurrences(of: "amp;", with: "")
|
||||||
|
urlString = urlString.replacingOccurrences(of: "\"", with: "")
|
||||||
|
|
||||||
|
if let httpsRange = urlString.range(of: "https") {
|
||||||
|
urlString = String(urlString[httpsRange.lowerBound...])
|
||||||
|
}
|
||||||
|
|
||||||
return URL(string: urlString)
|
return URL(string: urlString)
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
|
|
@ -192,10 +192,16 @@ struct SearchResultsView: View {
|
||||||
let href = try element.select(module.module[0].search.href).attr("href")
|
let href = try element.select(module.module[0].search.href).attr("href")
|
||||||
var imageURL = try element.select(module.module[0].search.image.url).attr(module.module[0].search.image.attribute)
|
var imageURL = try element.select(module.module[0].search.image.url).attr(module.module[0].search.image.attribute)
|
||||||
|
|
||||||
if !imageURL.starts(with: "http") {
|
if imageURL.contains(",") {
|
||||||
imageURL = "\(module.module[0].details.baseURL)\(imageURL)"
|
imageURL = imageURL.split(separator: ",").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }.first ?? imageURL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !imageURL.starts(with: "http") {
|
||||||
|
imageURL = "\(module.module[0].details.baseURL.hasSuffix("/") ? module.module[0].details.baseURL : "\(module.module[0].details.baseURL)/")\(imageURL.hasPrefix("/") ? String(imageURL.dropFirst()) : imageURL)"
|
||||||
|
}
|
||||||
|
|
||||||
|
imageURL = imageURL.replacingOccurrences(of: " ", with: "%20")
|
||||||
|
|
||||||
let result = ItemResult(name: title, imageUrl: imageURL, href: href)
|
let result = ItemResult(name: title, imageUrl: imageURL, href: href)
|
||||||
results.append(result)
|
results.append(result)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ struct AboutView: View {
|
||||||
.font(.largeTitle)
|
.font(.largeTitle)
|
||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
|
|
||||||
Text("Public beta 1")
|
Text("Public beta 0.1.1")
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue