【发布时间】:2012-04-18 01:10:55
【问题描述】:
我知道在 Jsoup 中,当你想找到某个带有链接的 Element 时,你可以这样做:
Document doc = Jsoup.parse(text);
Element links = doc.select("[href]");
但是,这会将所有链接带到页面中的每个网站...
但是如果我有多个链接,我只想检索那些专门链接到谷歌的链接。例如:
<a href="http://www.google.com">Google</a>
<a href="http://www.bing.com">Bing</a>
<a href="http://www.google.com">Another Google</a>
而且我希望它只接收那些有 google 的人。我试着做这样的事情:
Element links = doc.select("[href=\"http://www.google.com\"]");
但这不起作用...有人有建议吗?
【问题讨论】:
标签: android html-parsing jsoup elements