更新时间:2023-12-03 20:35:10
你需要 元素# absUrl()
提取绝对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 + "\"/>";
// ...
}