最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Css选择器在img Cheerio中采用特殊的src

网站源码admin22浏览0评论

Css选择器在img Cheerio中采用特殊的src

Css选择器在img Cheerio中采用特殊的src

我不知道如何获取特定的src

const img1 = selector
  .find("li.gallery_thumbItem.s-gallery_thumbItem:nth-child(3) span.gallery_thumbIn> img:last-child")
  .attr("src");

此html页面:

但是只想从html中获取第一个img,这是我抓取到的结果,

回答如下:

您可以尝试使用此selector.find("li.gallery_thumbItem:first .gallery_thumbIn > img").attr("src")将搜索类别为li的第一个gallery_thumbItem

发布评论

评论列表(0)

  1. 暂无评论