0

我正在创建一个应用程序,它将使用此页面https://gyp.ch/ecran/的 div来显示它。

我试图找到一种使用 Kotlin 获取元素的方法,但由于 JVM,我认为这是不可能的。

logo.setOnClickListener {
 "https://gyp.ch/ecran/".httpGet().responseString{request,response,result ->
  profs.text = result.get()
 }
}

It just displays the result.get() so in this case the code source of the link above.
4

1 回答 1

0

由于您使用的是 kotlin,因此您可以轻松地将其添加jsoup到您的项目中。

implementation 'org.jsoup:jsoup:1.11.3'

简单的例子 -

Document doc = Jsoup.connect("https://gyp.ch/ecran/").get();
log(doc.title());
Elements allDivs = doc. getElementsByTag("div");
for (Element div : allDivs) {
 div.text()
}
于 2019-04-15T01:12:40.100 回答