jsoup - 如何使用 Jsoup 提取此图像?
jsoup - How to extract this image using Jsoup?
我正在寻找这张 div
中的主图
<div id="imgTagWrapperId" >
<img src ="www.example.com">
</div>
我试过这个:
Document document = Jsoup.connect(url).get();
Elements img = document.select("div[id=imgTagWrapperId] img[src]");
String imgSrc = img.attr("src");
这对我有用:
Document document = Jsoup.connect(url).get();
Element img = document.getElementById("landingImage");
String imgSrc = img.attr("data-old-hires");
Document document = Jsoup.connect(url).get();
Elements img = document.select("img[id=landingImage]");
String imgSrc = img.attr("src");
我正在寻找这张 div
中的主图<div id="imgTagWrapperId" >
<img src ="www.example.com">
</div>
我试过这个:
Document document = Jsoup.connect(url).get();
Elements img = document.select("div[id=imgTagWrapperId] img[src]");
String imgSrc = img.attr("src");
这对我有用:
Document document = Jsoup.connect(url).get();
Element img = document.getElementById("landingImage");
String imgSrc = img.attr("data-old-hires");
Document document = Jsoup.connect(url).get();
Elements img = document.select("img[id=landingImage]");
String imgSrc = img.attr("src");