Questions tagged [swiftsoup]

a Swift HTML Parser library for working with real-world HTML through a convenient API for extracting and manipulating data using DOM, CSS, and jquery-like methods.

SwiftSoup is a pure Swift HTML Parser library for working with real-world HTML. It provides a convenient API for extracting and manipulating data, using the best of DOM, CSS, and jquery-like methods. SwiftSoup implements the WHATWG HTML5 specification, parsing HTML to the same DOM as modern browsers do.

Main features:

  • Scrape and parse HTML from a URL, file, or string
  • Find and extract data, using DOM traversal or CSS selectors
  • Manipulate HTML elements, attributes, and text
  • Sanitizing: Clean user-submitted content against a white-list, to prevent XSS attacks
  • Deal with all varieties of HTML found in the wild; from validating to invalid tag-soup
  • Output tidy HTML

SwiftSoup is available through CocoaPods, Carthage, and on GitHub.

For further information and documentation see

Author: Nabil Chatbi, scinfu@gmail.com
Note: SwiftSoup was ported to Swift from Java Jsoup library.

License: SwiftSoup is available under the MIT license.

53 questions
0
votes
1 answer

SwiftSoup Parse From evaluateJavaScript

I'm trying to use SwiftSoup to parse HTML from a webpage. I'm using evaluateJavaScript with "document.getElementById(\"fieldsort\").innerHTML" as my JavaScript. I'm not using String(contentsOf: URL) because that doesn't return the HTML for the…
Ben A.
  • 874
  • 7
  • 23
0
votes
1 answer

How to fetch image size and image resolution from HTML content loaded from UIWebview in Swift?

I am using 'SwiftSoup' SDK to parse HTML content from UIWebView. I want the image size and resolution for each and every image fetched from HTML content. How to get the image size and resolution as soon as an image is loaded and from HTML content…
0
votes
2 answers

Swift - Parsing a Web Page

For the project I am currently working on, I need to download and parse the HTML for getting specific date and times. I created a dummy project for that testing and here is the code: import UIKit import Alamofire import SwiftSoup class…
onurgenes
  • 127
  • 4
  • 18
0
votes
1 answer

Int has no member multiplyReportingOverflow

I recently loaded tesseract for ios with cocoapods however now anywhere multiplyReportingOverflow is used within another pod file throws an error. in attempts to fix this problem, I removed tesseract, which didn't work. I created an empty project…
Snymax
  • 357
  • 4
  • 18
0
votes
1 answer

SwiftSoup Support for Swift 4

Does SwiftSoup support Swift 4.0? I've initialized my Podfile and added pod "SwiftSoup" as instructed by the SwiftSoup GitHub repo https://github.com/scinfu/SwiftSoup before running pod install, but I'm not able to import it into my Swift files. I'm…
Austin Guo
  • 167
  • 1
  • 12
-1
votes
1 answer

iOS 14+ SwiftUI Rendering TextView DataDetector without WebKit

When using SwiftUI with iOS 14, I was unable to find out how to render html markup into actual text. I used SwiftSoup to parse the HTML into a string, but it removed
and it didn't parse it into an NSAttributedString for formatting. Once I…
Eli017
  • 31
  • 7
-1
votes
1 answer

Regex for finding HTML classes with JSOUP

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 =…
Chris
  • 1,828
  • 6
  • 40
  • 108
-1
votes
1 answer

Dynamically create h1 tags using swift

My question is how can I dynamically create h1 tags using Swift and add it to the front of the HTML file. This is what I have and it is not working. extension WKWebView { func loadHTML(html: String) { let htmlString = """
Nayef
  • 33
  • 4
1 2 3
4