WEB page parsing in Kotlin Native

I’m a newbie Kotlin programmer. I’ve been using jsoup in my project reading the WEB page as follows:

import org.jsoup.Jsoup

val doc = Jsoup.connect("http://...WEB address goes there").get()
val html = doc.outerHtml()

This worked well for JVM.

Now I’m moving to Native and Multiplatform where Java libs do not exist.

Can you advise what can be used for the above purpose as a substitute for jsoup?

Please, provide detailed instructions and example for a newbie.

Many thanks in advance.

Jsoup is a JVM library, you can’t use it in native.So either you are searching for native replacement, or write it yourself.

If you are newbie, please do not use Kotlin-Native. It is in beta and require’s both kotlin knowledge and native development knowledge at the same time. Stick with JVM for now.

Thanks for your reply. I know that jsoup cannot be used in native and I’ve indicated that in my initial post. As you correctly indicated, one of the methods is to search for a replacement. This is exactly what I’m doing. Are you aware of any?

Hi there,

There is currently no library like Jsoup for K/N, but you can get away by combiing Ktor http-client with a C library like gumbo.

Of course this will be a bit of work, you’ll have to write a wrapper around the C library to make it easy to use in Kotlin, but it’s the best approach I can see right now.