我想制作一个能够检索网址信息的程序。 例如我给出下面的网址,来自 librarything
I want to make a program that will retrieve some information a url. For example i give the url below, from librarything
如何检索TAGS标签下方的所有字词,例如
How can i retrieve all the words below the "TAGS" tab, like
Black Library fantasy Thanquol& Boneripper Thanquol和Bone Ripper Warhammer?
Black Library fantasy Thanquol & Boneripper Thanquol and Bone Ripper Warhammer ?
我正在考虑使用java,并设计一个数据挖掘包装器,但我不知道如何开始。任何人都可以给我一些建议吗?
I am thinking of using java, and design a data mining wrapper, but i am not sure how to start. Can anyone give me some advice?
编辑:你给了我很好的帮助,但我想问别的。 对于每个标签,当我们按下数字按钮时,我们可以看到每个标签的使用次数。我怎样才能检索这个号码?
You gave me excellent help, but I want to ask something else. For every tag we can see how many times each tag has been used, when we press the "number" button. How can I retrieve that number also?
推荐答案你可以使用像 Jsoup 。它允许您使用简单的 CSS选择器选择感兴趣的HTML元素:
You could use a HTML parser like Jsoup. It allows you to select HTML elements of interest using simple CSS selectors:
例如
Document document = Jsoup.connect("www.librarything/work/9767358/78536487").get(); Elements tags = document.select(".tags .tag a"); for (Element tag : tags) { System.out.println(tag.text()); }打印
Black Library fantasy Thanquol & Boneripper Thanquol and Bone Ripper Warhammer请注意你应该阅读网站的 robots.txt -if any-并阅读网站的服务条款 - 如果 - 或者您的服务器迟早会被IP禁止。
Please note that you should read website's robots.txt -if any- and read the website's terms of service -if any- or your server might be IP-banned sooner or later.
更多推荐
从网址中检索信息
发布评论