swiftsoup

Parse HTML with Swiftsoup (Swift)?

痞子三分冷 提交于 2021-02-10 06:41:53
问题 I'm trying to parse some websites with Swiftsoup, let's say one of the websites is from Medium. How can I extract the body of the website and load the body to another UIViewController like what Instapaper does? Here is the code I use to extract the title: import SwiftSoup class WebViewController: UIViewController, UIWebViewDelegate { ... override func viewDidLoad() { super.viewDidLoad() let url = URL(string: "https://medium.com/@timjwise/stop-lying-to-yourself-when-you-snub-panhandlers-its

Parse HTML with Swiftsoup (Swift)?

情到浓时终转凉″ 提交于 2021-02-10 06:41:46
问题 I'm trying to parse some websites with Swiftsoup, let's say one of the websites is from Medium. How can I extract the body of the website and load the body to another UIViewController like what Instapaper does? Here is the code I use to extract the title: import SwiftSoup class WebViewController: UIViewController, UIWebViewDelegate { ... override func viewDidLoad() { super.viewDidLoad() let url = URL(string: "https://medium.com/@timjwise/stop-lying-to-yourself-when-you-snub-panhandlers-its

Parse HTML with Swiftsoup (Swift)?

蓝咒 提交于 2021-02-10 06:41:40
问题 I'm trying to parse some websites with Swiftsoup, let's say one of the websites is from Medium. How can I extract the body of the website and load the body to another UIViewController like what Instapaper does? Here is the code I use to extract the title: import SwiftSoup class WebViewController: UIViewController, UIWebViewDelegate { ... override func viewDidLoad() { super.viewDidLoad() let url = URL(string: "https://medium.com/@timjwise/stop-lying-to-yourself-when-you-snub-panhandlers-its

Regex for finding HTML classes with JSOUP

孤街浪徒 提交于 2020-04-30 07:20:06
问题 For my project I need to parse HTML and get the price of a product. This is how I am doing it at the moment: let url = "https://www.adidas.de/adistar-trikot/CV7089.html" let className = "gl-price__value" do { let html: String = getHTMLfromURL(url: url) let doc: Document = try SwiftSoup.parse(html) let price: Elements = try doc.getElementsByClass(className) let priceText : String = try price.text() result.text = priceText } catch Exception.Error(let type, let message) { print(message) } catch

How to parse html table data to array of string in swift?

半城伤御伤魂 提交于 2019-12-08 04:09:36
问题 I'm developing an iOS app in which I need to parse HTML from a link with the swiftsoup library. I have done it. But it shows all the table data as a string. I need to get separate data which should be stored in separate arrays. Here is the table: <table width="880" border="1" cellspacing="0" cellpadding="0"> <tr> <td width="81"><strong>Trip Name </strong></td> <td width="159"><div align="center"><strong>Starting Time from Campus </strong></div></td> <td width="186"><div align="center"><strong