data logger
Some checks failed
Build and Release IPA / Build IPA (push) Has been cancelled

This commit is contained in:
cranci1 2025-01-20 15:25:25 +01:00
parent 3cba82d95a
commit eec8c3a115

View file

@ -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])
}
}