机器人:解析HTML页面,从 [英] android: parse html from page

查看:92
本文介绍了机器人:解析HTML页面,从的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想分析出从一个网页一些文本。

i would like to parse out some text from a page.

有没有一种简单的方法,以保存产品信息,以一个字符串的例子吗?示例URL: http://upcdata.info/upc/7310870008741

Is there an easy way to save the product info in to a string for example? Example url: http://upcdata.info/upc/7310870008741

感谢

推荐答案

Jsoup是优秀的,在分析从Android应用程序简单的HTML:

Jsoup is excellent at parsing simple HTML from Android applications:

http://jsoup.org/

要获取的页面,只是这样做:

To get the page, just do this:

URL url = new URL("http://upcdata.info/upc/7310870008741");
Document document = Jsoup.parse(url, 5000);

然后就可以解析出任何你从文件需要。看看这个链接,如何提取网页的部分简要说明:

Then you can parse out whatever you need from the Document. Check out this link for a brief description of how to extract parts of the page:

<一个href="http://jsoup.org/cookbook/extracting-data/dom-navigation">http://jsoup.org/cookbook/extracting-data/dom-navigation

这篇关于机器人:解析HTML页面,从的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆