as.soup.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dispatch-jsoup_2.10 Show documentation
Show all versions of dispatch-jsoup_2.10 Show documentation
Dispatch module providing jsoup html parsing support
The newest version!
package dispatch.as.jsoup
import org.jsoup.Jsoup
import org.jsoup.nodes
import com.ning.http.client.Response
object Document extends (Response => nodes.Document) {
def apply(r: Response) =
Jsoup.parse(dispatch.as.String(r), r.getUri().toString)
}
object Query {
import org.jsoup.select.Elements
def apply(query: String): Response => Elements =
Document(_).select(query)
}
object Clean {
import org.jsoup.safety.Whitelist
def apply(wl: Whitelist): Response => String =
{ r => Jsoup.clean(dispatch.as.String(r), r.getUri().toString, wl) }
}