mirror of
https://github.com/cranci1/Sora.git
synced 2026-03-11 17:45:37 +00:00
This commit is contained in:
parent
3cba82d95a
commit
eec8c3a115
1 changed files with 6 additions and 1 deletions
|
|
@ -88,6 +88,7 @@ class JSController: ObservableObject {
|
|||
return
|
||||
}
|
||||
|
||||
Logger.shared.log(html)
|
||||
if let parseFunction = self.context.objectForKeyedSubscript("searchResults"),
|
||||
let results = parseFunction.call(withArguments: [html]).toArray() as? [[String: String]] {
|
||||
let resultItems = results.map { item in
|
||||
|
|
@ -131,6 +132,7 @@ class JSController: ObservableObject {
|
|||
var resultItems: [MediaItem] = []
|
||||
var episodeLinks: [EpisodeLink] = []
|
||||
|
||||
Logger.shared.log(html)
|
||||
if let parseFunction = self.context.objectForKeyedSubscript("extractDetails"),
|
||||
let results = parseFunction.call(withArguments: [html]).toArray() as? [[String: String]] {
|
||||
resultItems = results.map { item in
|
||||
|
|
@ -180,6 +182,7 @@ class JSController: ObservableObject {
|
|||
return
|
||||
}
|
||||
|
||||
Logger.shared.log(html)
|
||||
if let parseFunction = self.context.objectForKeyedSubscript("extractStreamUrl"),
|
||||
let streamUrl = parseFunction.call(withArguments: [html]).toString() {
|
||||
DispatchQueue.main.async {
|
||||
|
|
@ -214,6 +217,7 @@ class JSController: ObservableObject {
|
|||
|
||||
let thenBlock: @convention(block) (JSValue) -> Void = { result in
|
||||
|
||||
Logger.shared.log(result.toString())
|
||||
if let jsonString = result.toString(),
|
||||
let data = jsonString.data(using: .utf8) {
|
||||
do {
|
||||
|
|
@ -299,6 +303,7 @@ class JSController: ObservableObject {
|
|||
|
||||
let thenBlockDetails: @convention(block) (JSValue) -> Void = { result in
|
||||
|
||||
Logger.shared.log(result.toString())
|
||||
if let jsonOfDetails = result.toString(),
|
||||
let dataDetails = jsonOfDetails.data(using: .utf8) {
|
||||
do {
|
||||
|
|
@ -352,6 +357,7 @@ class JSController: ObservableObject {
|
|||
|
||||
let thenBlockEpisodes: @convention(block) (JSValue) -> Void = { result in
|
||||
|
||||
Logger.shared.log(result.toString())
|
||||
if let jsonOfEpisodes = result.toString(),
|
||||
let dataEpisodes = jsonOfEpisodes.data(using: .utf8) {
|
||||
do {
|
||||
|
|
@ -399,5 +405,4 @@ class JSController: ObservableObject {
|
|||
promiseEpisodes.invokeMethod("then", withArguments: [thenFunctionEpisodes as Any])
|
||||
promiseEpisodes.invokeMethod("catch", withArguments: [catchFunctionEpisodes as Any])
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue