本文介绍了Android HTML Jsoup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图从我的拼贴新闻网站获取图像的绝对URL,但到目前为止还没有成功。我在这个网站上工作提取绝对URL而不是 Element#toString()
以获取整个HTML元素的文本表示。
You need Element#absUrl()
to extract the absolute URL instead of Element#toString()
to get the text representation of the whole HTML element.
Elements imgs = docs.select("img[src$=.jpg]");
for (Element img : imgs) {
String url = img.absUrl("src");
String newImg = "<img src=\"" + url + "\"/>";
// ...
}
这篇关于Android HTML Jsoup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!