I want to make an android app for getting stats. Lets say I want to get the kills and deaths from www.oc.tc/MasterEjzz and print them on the screen. I know that Jsoup is a good API to use, but I am unfamiliar with it.
我想制作一个Android应用程序来获取统计数据。让我们说我想从www.oc.tc/MasterEjzz中获取杀戮和死亡并将其打印在屏幕上。我知道Jsoup是一个很好用的API,但我不熟悉它。
Any help would be appreciated.
任何帮助,将不胜感激。
1 个解决方案
#1
2
From Jsoup
introduction documentation,
从Jsoup介绍文档,
To connect and download the document, you can use
要连接和下载文档,您可以使用
Document doc = Jsoup.connect("http://en.wikipedia.org/").get();
Then to extract content from the Document
,
然后从文档中提取内容,
Element content = doc.getElementById("content");
Elements links = content.getElementsByTag("a");
for (Element link : links) {
String linkHref = link.attr("href");
String linkText = link.text();
}
For more information on DOM Navigation
, see
有关DOM导航的更多信息,请参阅
#1
2
From Jsoup
introduction documentation,
从Jsoup介绍文档,
To connect and download the document, you can use
要连接和下载文档,您可以使用
Document doc = Jsoup.connect("http://en.wikipedia.org/").get();
Then to extract content from the Document
,
然后从文档中提取内容,
Element content = doc.getElementById("content");
Elements links = content.getElementsByTag("a");
for (Element link : links) {
String linkHref = link.attr("href");
String linkText = link.text();
}
For more information on DOM Navigation
, see
有关DOM导航的更多信息,请参阅