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.53k stars 345 forks source link

implement reader view #81

Closed sgbasaraner closed 6 years ago

sgbasaraner commented 6 years ago

Is it possible for SwiftSoup to parse HTML like Safari's or Firefox's Reader View does?

scinfu commented 6 years ago

What do you mean?

sgbasaraner commented 6 years ago

https://github.com/mozilla/readability

Something like this. A smart text/article detector built into SwiftSoup.

scinfu commented 6 years ago

The answer is i think is yes, looking quickly what it does. Many function of Readability.js are based to CSS Selectors like getElementsByTagName , setAttribute, removeAttribute or getElementsByTagName and others. these functions are implemented in SwiftSoup to select o manipulate the document.

So you should make a porting of Readability.js and use SwiftSoup to manipolate and select elements but I can not know if there are any features you need.

scinfu commented 6 years ago

SwiftSoup does what JSDOMParser.js does

sgbasaraner commented 6 years ago

If I get to build a clone of readability using SwiftSoup, would you want it to be included in SwiftSoup itself? I can come up with a PR if that's the case. The usage could be something like

SwiftSoup.parse(html).smartText()

scinfu commented 6 years ago

What does this library do?

scinfu commented 6 years ago

Closed due to inactivity, if necessary re-open.