mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-20 16:12:50 +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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger.shared.log(html)
|
||||||
if let parseFunction = self.context.objectForKeyedSubscript("searchResults"),
|
if let parseFunction = self.context.objectForKeyedSubscript("searchResults"),
|
||||||
let results = parseFunction.call(withArguments: [html]).toArray() as? [[String: String]] {
|
let results = parseFunction.call(withArguments: [html]).toArray() as? [[String: String]] {
|
||||||
let resultItems = results.map { item in
|
let resultItems = results.map { item in
|
||||||
|
|
@ -131,6 +132,7 @@ class JSController: ObservableObject {
|
||||||
var resultItems: [MediaItem] = []
|
var resultItems: [MediaItem] = []
|
||||||
var episodeLinks: [EpisodeLink] = []
|
var episodeLinks: [EpisodeLink] = []
|
||||||
|
|
||||||
|
Logger.shared.log(html)
|
||||||
if let parseFunction = self.context.objectForKeyedSubscript("extractDetails"),
|
if let parseFunction = self.context.objectForKeyedSubscript("extractDetails"),
|
||||||
let results = parseFunction.call(withArguments: [html]).toArray() as? [[String: String]] {
|
let results = parseFunction.call(withArguments: [html]).toArray() as? [[String: String]] {
|
||||||
resultItems = results.map { item in
|
resultItems = results.map { item in
|
||||||
|
|
@ -180,6 +182,7 @@ class JSController: ObservableObject {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger.shared.log(html)
|
||||||
if let parseFunction = self.context.objectForKeyedSubscript("extractStreamUrl"),
|
if let parseFunction = self.context.objectForKeyedSubscript("extractStreamUrl"),
|
||||||
let streamUrl = parseFunction.call(withArguments: [html]).toString() {
|
let streamUrl = parseFunction.call(withArguments: [html]).toString() {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
|
@ -214,6 +217,7 @@ class JSController: ObservableObject {
|
||||||
|
|
||||||
let thenBlock: @convention(block) (JSValue) -> Void = { result in
|
let thenBlock: @convention(block) (JSValue) -> Void = { result in
|
||||||
|
|
||||||
|
Logger.shared.log(result.toString())
|
||||||
if let jsonString = result.toString(),
|
if let jsonString = result.toString(),
|
||||||
let data = jsonString.data(using: .utf8) {
|
let data = jsonString.data(using: .utf8) {
|
||||||
do {
|
do {
|
||||||
|
|
@ -299,6 +303,7 @@ class JSController: ObservableObject {
|
||||||
|
|
||||||
let thenBlockDetails: @convention(block) (JSValue) -> Void = { result in
|
let thenBlockDetails: @convention(block) (JSValue) -> Void = { result in
|
||||||
|
|
||||||
|
Logger.shared.log(result.toString())
|
||||||
if let jsonOfDetails = result.toString(),
|
if let jsonOfDetails = result.toString(),
|
||||||
let dataDetails = jsonOfDetails.data(using: .utf8) {
|
let dataDetails = jsonOfDetails.data(using: .utf8) {
|
||||||
do {
|
do {
|
||||||
|
|
@ -352,6 +357,7 @@ class JSController: ObservableObject {
|
||||||
|
|
||||||
let thenBlockEpisodes: @convention(block) (JSValue) -> Void = { result in
|
let thenBlockEpisodes: @convention(block) (JSValue) -> Void = { result in
|
||||||
|
|
||||||
|
Logger.shared.log(result.toString())
|
||||||
if let jsonOfEpisodes = result.toString(),
|
if let jsonOfEpisodes = result.toString(),
|
||||||
let dataEpisodes = jsonOfEpisodes.data(using: .utf8) {
|
let dataEpisodes = jsonOfEpisodes.data(using: .utf8) {
|
||||||
do {
|
do {
|
||||||
|
|
@ -399,5 +405,4 @@ class JSController: ObservableObject {
|
||||||
promiseEpisodes.invokeMethod("then", withArguments: [thenFunctionEpisodes as Any])
|
promiseEpisodes.invokeMethod("then", withArguments: [thenFunctionEpisodes as Any])
|
||||||
promiseEpisodes.invokeMethod("catch", withArguments: [catchFunctionEpisodes as Any])
|
promiseEpisodes.invokeMethod("catch", withArguments: [catchFunctionEpisodes as Any])
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue