net.dankito.readability4j.extended.processor.PostprocessorExtended.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Readability4J Show documentation
Show all versions of Readability4J Show documentation
A Kotlin port of Mozilla‘s Readability. It extracts a website‘s relevant content and removes all clutter from it.
The newest version!
package net.dankito.readability4j.extended.processor
import net.dankito.readability4j.processor.Postprocessor
import org.jsoup.nodes.Element
open class PostprocessorExtended : Postprocessor() {
override fun fixRelativeImageUri(img: Element, scheme: String, prePath: String, pathBase: String) {
val dataSrc = img.attr("data-src") // load data-src;
if(dataSrc.isNotBlank()) {
img.attr("src", toAbsoluteURI(dataSrc, scheme, prePath, pathBase))
}
else {
super.fixRelativeImageUri(img, scheme, prePath, pathBase)
}
}
}