1 回答
TA贡献1808条经验 获得超4个赞
Jsoup 是您的问题的不错选择。链接在这里
您应该知道如何通过 XML Query、CSS Query 将 HTML 解析为字符串。...
一步步:
建立与您要解析的网站的连接。
准备查询以获取“信息”字符串。
将字符串放入对象并显示它。
下面是我使用 css 查询和 JSOUP 在市场 googleplay 中获取我的应用程序版本代码的代码:
try {
newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + "com.example.myapp" + "&hl=en")
.timeout(5000)
.userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
.referrer("http://www.google.com")
.get()
.select("div.hAyfc:nth-child(4) > span:nth-child(2) > div:nth-child(1) > span:nth-child(1)")
.first()
.ownText();
} catch (Exception e) {
e.printStackTrace();
}
添加回答
举报
