【问题标题】:Node can't scrape certain pages节点无法抓取某些页面
【发布时间】:2015-04-25 08:06:19
【问题描述】:

我不知道这是与coldfusion页面有关还是什么,但我无法抓取这些.cfm页面

在带有request的目录的命令行中运行:

node> var request = require('request');
node> var url = 'http://linguistlist.org/callconf/browse-conf-action.cfm?confid=173395';
node> request(url, function (err, res, body) { if (err) { console.log(err) } else { console.log('body:', body) }; });

我尝试过使用其他一些 .cfm 网站,但它们可以正常工作,而且只得到空白结果,所以我不知道它可能是什么

注意:我也尝试过使用准系统 require('http').get(url,…) 路由,但得到相同的空白结果

【问题讨论】:

    标签: node.js request scrape


    【解决方案1】:

    我明白了! (最后)

    这个网络服务器真的需要知道如何回答你。 试试这个(它对我有用)

    var request = require('request');
    var options = {
      url: 'http://linguistlist.org/callconf/browse-conf-action.cfm?confid=173395',
      headers: {
       'Accept-Encoding':'none'
      }
    };
    request(options, function (err, res, body) { if (err) { console.log(err) } else { console.log('body:', body) }; });
    

    【讨论】:

    • 哈哈,我从浏览器中复制了所有标题后得出了相同的结论。欣赏!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-14
    • 2014-08-19
    • 2019-03-23
    相关资源
    最近更新 更多