title: Parse HTML with Swiftsoup (Swift)?
body: <p>I'm trying to parse some websites with <a href="https://github.com/scinfu/SwiftSoup" rel="nofollow noreferrer">Swiftsoup</a>, let's say one of the websites is from <a href="https://medium.com/@timjwise/stop-lying-to-yourself-when-you-snub-panhandlers-its-not-for-their-own-good-199d0aa7a513" rel="nofollow noreferrer">Medium</a>. How can I extract the body of the website and load the body to another UIViewController like what Instapaper does?</p>
  
  <p><a href="https://i.stack.imgur.com/vPEAg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vPEAg.jpg" alt="enter image description here"></a></p>
  
  <p>Here is the code I use to extract the title: </p>
  
  <pre><code>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-not-for-their-own-good-199d0aa7a513")
          let request = URLRequest(url: url!)
          webView.loadRequest(request)
  
          guard let myURL = url else {
          print("Error: \(String(describing: url)) doesn't seem to be a valid URL")
              return
          }
          let html = try! String(contentsOf: myURL, encoding: .utf8)
  
          do {
              let doc: Document = try SwiftSoup.parseBodyFragment(html)
              let headerTitle = try doc.title()
              print("Header title: \(headerTitle)")
          } catch Exception.Error(let type, let message) {
              print("Message: \(message)")
          } catch {
              print("error")
          }
  
  }
  
  }
  </code></pre>
  
  <p>But I got no luck to extract the body of the website or any other websites, any way to get it work? CSS or JavaScript (I know nothing about CSS or Javascript)?</p>