https://kotlinlang.org logo
#skrape-it
Title
# skrape-it
d

danieeh

12/01/2020, 10:22 AM
hi there! 👋 I’m creating a web scraper for blog posts.. and one thing I found in common to extract the title, author, etc.. would be the <script type=“application/ld+json”> if this does not contain all the info wanted, I’ll provide alternatives for the different scenarios. could you point me to some examples on how to extract the
ld+json
script content? thanks in advance 😄
with some try-error I found my way, thanks! I’ll leave here an example:
Copy code
val jsonLdString = script {
              withAttribute = "type" to "application/ld+json"
              findFirst {
                html
              }
            }
c

Christian Dräger

12/01/2020, 10:34 PM
Yes that looks good :)
3 Views