I am trying to scrape html code from a URL using Swift, but it needs to be done anonymously. The issue with my case is that the content differs when I am logged in the website or not. My app has a webkit that allows users to view a certain page of a website. If they log in via the webkit, the scraping result is different from if they did not log in.
I have read and searched through tons of questions on StackOverflow to see how to get the HTML source from a URL and the one that I am using can be found here: How To Get HTML source from URL with Swift I have also tried the codes from different answers and questions.
guard let getHTMLString = try? String(contentsOf: theUrl, encoding: .utf8).condensingWhitespace() as String else {
callErrorPage()
return
}
I get the content of the html page with the code above.
But like I mentioned above, the codes differ if the user has logged in the website.
Edit: I need the code to always be the version where the user is not logged in.