我正在尝试提取一些广告的图片来源,但是我不明白我在做什么错了:( 我要提取的html标签如下所示:
代码:
Elements pageSearchImg = page2.select("a[id^=item] > div[class=placeholder] > div[class=overflow_image] > img");
for (int m = 0; m < pageSearchImg.size(); m++) {
String img = pageSearchImg.get(m).attr("src");
System.out.println(img);
}
我猜标签可能有问题吗?
编辑:如果我查看页面源,它看起来像这样:
<a id="item_1574320" href="https://carzz.ro/dacia-logan-14-mpipreferancefab-2006originala-anunt_1574320.html" class="main_items item_cart ">
<div class="placeholder">
<div class="overflow_image">
<div id="ad_img_loader_1574320" class="ad_img_loader">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="50px" height="50px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<path fill="#d32f2f" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
<animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/>
</path>
</svg>
</div>
</div>