Scraping
If you want to extract data from websites this is the part of the documentation you where looking for.
Last updated
Was this helpful?
If you want to extract data from websites this is the part of the documentation you where looking for.
Last updated
Was this helpful?
Let's assume a pretty basic scenario. We want to make a request to a github profile page and extract the nickname of the profiles owner as well as getting the names of them pinned repositories and some other informations that demonstrates the usage and power of skrape{it}'s DSL.
All of the interesting parts are marked with an (ℹ️) and explained at the bottom of the code sample.
1️⃣ We are in the scope of skrape{} here. This is the place to configure your request. The code example we are only defining the url we want to make a request against but there are a lot .
5️⃣ To query a certain element you can invoke plain CSS-selector queries as string and directly use the picked element inside the lambde function to do your stuff. Read more about it in the .
7️⃣ Just for clarification in case you are not familiar with kotlin-DSLs already, it's a DSL, means you can just put any other valid kotlin code inside of here.
1️⃣6️⃣ element selection are nesting, so we will search for the second p-tag inside the parent div.pinned-item-list-item
only. This is really powerful behaviour.
1️⃣8️⃣ Properties that are of type String
can conveniently be chained with the provided and
function.
1️⃣9️⃣ Properties that are of type Map<String, String>
can directly be passed as Pair
values. sexy...