mercredi 25 septembre 2019

How can I get data from HTML table?

Hey, everybody. I want to write a little app on Swift. And the question arose, how to take the data from the HTML table? The situation is as follows: there is a page on which, among other things, there is an ordinary html table ....

I need to get the data from it. There is a code that receives all the html content in a string, but for some reason this string cannot be written anywhere.

func getHTMLContent() {
       let meteoURL = URL(string: "URL adress")
        let URLTask = URLSession.shared.dataTask(with: meteoURL! as URL) {
            data, response, error in

            guard error == nil else {
                self.connectError()
                return
            }

            let meteoHTMLData = String(data: meteoData!, encoding: String.Encoding.utf8)!
        }
        URLTask.resume()
    }

HTML content is written to the string meteoHTMLData, but it is not possible to write data from this constant to any external one, there are no errors, data are simply not written to variables.

How to act in such a situation?




Aucun commentaire:

Enregistrer un commentaire