【问题标题】:Web scraping Nodejs cheerio网页抓取 Nodejs Cheerio
【发布时间】:2018-07-18 01:10:21
【问题描述】:

我必须在网站中获取<script> 标签的内容。但是有很多<script> 标签并且没有id 属性。当我这样称呼 Cheerio 时,它没有得到 <script> 标签内容:

$('script').text()

.html();

这样做的方法是什么?

【问题讨论】:

  • {xmlMode: true} 我相信这是解决方法(作为cheerio.load 的第二个参数)。

标签: node.js web-scraping cheerio


【解决方案1】:

你应该使用$('script').html()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多