scinfu/swiftsoup

SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 43 minutes ago
Added to GitGenius on September 13th, 2026
Created on November 18th, 2016
Open Issues & Pull Requests: 0 (+0)
GitHub issues: Enabled
Number of forks: 400
Total Stargazers: 5,120 (+0)
Total Subscribers: 55 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

SwiftSoup is a pure Swift HTML parser that combines DOM traversal, CSS selectors, and jQuery-like methods for parsing and manipulating HTML across macOS, iOS, tvOS, watchOS, and Linux.

The tool solves the problem of extracting and transforming data from HTML documents in Swift applications. It parses HTML according to the WHATWG HTML5 specification, ensuring that malformed or messy HTML is handled the same way modern browsers handle it, producing a reliable parse tree. The library supports parsing from URLs, files, or strings, and includes automatic format detection that switches between HTML and XML parsing based on whether an XML declaration is present in the input.

SwiftSoup suits projects that need to scrape web content, extract structured data from HTML, or manipulate HTML dynamically within Swift applications. It is particularly useful for server-side Swift applications on Linux as well as iOS and macOS apps. The tool includes features for finding and extracting data via DOM traversal or CSS selectors, modifying elements and attributes, sanitizing user-submitted content with a whitelist to prevent XSS attacks, and generating clean HTML output. It handles both well-formed and malformed HTML reliably.

The project maintains active support across multiple dependency managers including CocoaPods, Carthage, and Swift Package Manager. Development includes a lightweight profiler gated by a compile-time flag and a CLI harness for parsing benchmarks, indicating attention to performance characteristics. The codebase supports both recent Swift versions and maintains compatibility with older Swift releases where applicable.