使用Cheerio时,我该如何获得HREF
我想在此代码中使用Cheerio时具有链接。
<div class="someClass">
<a href="someLink">Link</a>
</div>
我已经尝试过,但是它不起作用。
let link = $('.someClass a href').text();
I want to have the link while using cheerio with this code.
<div class="someClass">
<a href="someLink">Link</a>
</div>
I have tried this but it doesn't work.
let link = $('.someClass a href').text();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在尝试从属性提取节点文本,这不是正确的方法。如果要提取属性值尝试
You're trying to extract node text from attribute and it is not correct approach. If you want to extract attribute value try