I want to get a number off a webpage, to use in my app. Scraping, I guess it's called. I've done a little research on this and found this code:
let url = NSURL(string: "https://website.com") let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {(data, response, error) in print(NSString(data: data!, encoding: NSUTF8StringEncoding)) } task!.resume() }
This works beautifully and sends the source code of the page to the output console in Xcode. But the source code doesn't contain the number I want to grab. So instead of the code that calls a script to get the number from the server, I need the result of that code. I guess that's the HTML or XML that the browser normally renders to display the number itself.
I can't seem to find the right command for this.