[当我用cheerio抓取img src时,我得到了一个巨大的字符串,而不仅仅是链接
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[当我用cheerio抓取img src时,我得到了一个巨大的字符串,而不仅仅是链接相关的知识,希望对你有一定的参考价值。
const img = $('div.class a).attr('src')
我确定总体上缺少src属性和图像的某些内容,但是如何只获得显示在src属性后的短链接而不是整个图像数据呢?
从]中拉出>
<img alt="" src="https://images-na.ssl-images-amazon.com/images/I/51f%2B2GYfneL._SX323_BO1,204,203,200_.jpg" onload="if(this.width/this.height > 0.84){this.className += ' a-stretch-horizontal'}else{this.className += ' a-stretch-vertical'};this.onload='';" class="a-dynamic-image image-stretch-vertical frontImage a-stretch-vertical" id="imgBlkFront" data-a-dynamic-image="{"https://images-na.ssl-images-amazon.com/images/I/51f%2B2GYfneL._SX323_BO1,204,203,200_.jpg":[325,499],"https://images-na.ssl-images-amazon.com/images/I/51f%2B2GYfneL._SY344_BO1,204,203,200_.jpg":[226,346]}" style="max-width: 226px; max-height: 346px; position: absolute; top: 0px; left: 0px; width: 174.181px; height: 266.667px;">
返回
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABQODxIPDRQSEBIXFRQYHjIhHhwcHj0sLiQySUBMS0dARkVQWnNiUFVtVkVGZIhlbXd7gYKBTmCNl4x9lnN+gXz/2wBDARUXFx4aHjshITt8U0ZTfHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHz/wAARCAElAL8DASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqr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MDPNDQaEOoXd1qV49zdKxduAACAo7AVt6NrtnpWnfZfsNxI0mTM3HzEjGB7YrK/trVcc39wDj++aQa3qv8Az/3H/fZpWAqzIvnv9njlWAt8u5csF966qLxRYw28NumlzNHDjy9+CQR3+tc//bWq841Cf/vs0f21quP+QhP9N5osw0NqfxBZzQzlNMaO7ZSIZfLUkE8Zz1GK5YgxgqSQwOCpHQ1d/tvVev2+fIPTeaos7SSM7nLMck+pouJRsrDgV7jP8q0/CxP/AAkFqOx3/wDoBrJLHNa3hc58Q2v/AAP/ANAahspI27rwf9ruprn7ds852k2+TnGTnGd1Rf8ACEf9RD/yD/8AZUUVAw/4Qj/qIf8AkH/7Kj/hCf8AqIf+Qf8A7KiincA/4Qk/9BD/AMg//ZUv/CF8f8hD/wAg/wD2VFFHMwsH/CFn/oIf+Qf/ALKl/wCEMP8A0EP/ACD/APZUUUczCyF/4Q1sYGoYH/XH/wCypn/CE9v7Q/8AIP8A9lRRRzMLIP8AhCj/ANBD/wAg/wD2VL/whRz/AMhD/wAg/wD2VFFF2FgPgonrqH/kH/7Kk/4Qk/8AQQ/8g/8A2VFFF2Af8IT/ANRD/wAg/wD2VL/whZzkahj/ALY//ZUUUXYWD/hCz/0EP/IP/wBlSf8ACEntqP8A5B/+yooouwsH/CFH/oIf+Qf/ALKj/hCv+oh/5A/+yooouwsH/CEf9RD/AMg//ZUf8IR/1EP/ACD/APZUUUXAP+EI/wCoh/5B/wDsqtab4X/su+ivPtnm+Xn5PK25yCOuT60UUgP/2Q==
我期望
"https://images-na.ssl-images-amazon.com/images/I/51f%2B2GYfneL._SX323_BO1,204,203,200_.jpg"
const img = $('div.class a).attr('src')我确定总体上我缺少src属性和图像,但是如何获得短链接我看到显示在...之后]]
答案
您可以在html元素中添加'class'或'id'并使用它代替'src'属性。
const img = $('div.class a).attr('class');
以上是关于[当我用cheerio抓取img src时,我得到了一个巨大的字符串,而不仅仅是链接的主要内容,如果未能解决你的问题,请参考以下文章
如何在网站页面完全加载时抓取它(js,css all loaded)