从网址中检索信息

编程入门 行业动态 更新时间:2024-10-11 09:26:36
本文介绍了从网址中检索信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想制作一个能够检索网址信息的程序。 例如我给出下面的网址,来自 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.

更多推荐

从网址中检索信息

本文发布于:2023-11-06 08:30:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563199.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:网址   信息

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!