as an alternativ this will also work ()if you don’...
# skrape-it
c
as an alternativ this will also work ()if you don’t like the string invokation like
".jokes-nav a" {}
Copy code
fun main() {
    val allNavLinks = skrape {
        url = "<http://www.laughfactory.com/jokes>"
        extract {
            htmlDocument {
                div {
                    withClass = "jokes-nav"
                    a {
                        withAttributeKey = "href"
                        findAll {
                            associate { it.text to it.attribute("href") }
                        }
                    }
                }
            }
        }
    }
    println(allNavLinks)
}
both solutions are perfectly fine to use and i think just a matter of taste. the first one is using a plain css-selector and an invokes it, the second one is build the selector by using the DSL which will be more readable if you have more complex selectors (under the hood skrape{it} will make a selector string out of it again)