scinfu / SwiftSoup

SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)
https://scinfu.github.io/SwiftSoup/
MIT License
4.52k stars 345 forks source link

srcset #234

Closed AsareB closed 1 year ago

AsareB commented 1 year ago

How is srcset accounted for? The more I search and test the more I think it's just not a thing SwiftSoup can do...

scinfu commented 1 year ago

let myDoc: Document = try SwiftSoup.parse(HTML) let imgElements: Elements = try myDoc.select("img") for imgElement in imgElements { if let srcset: String = try imgElement.attr("srcset") { // process srcset string } }

You can use regular expressions or string manipulation now