跟源代碼一模一樣 報錯了
_http_client.js:131
? ? throw new Error('Protocol "' + protocol + '" not supported. ' +
? ? ^
Error: Protocol "https:" not supported. Expected "http:"
? ? at new ClientRequest (_http_client.js:131:11)
? ? at request (http.js:38:10)
? ? at Object.get (http.js:42:13)
? ? at Object.<anonymous> (E:\eclipse\node\http\imooc-crawler.js:3:6)
? ? at Module._compile (module.js:653:30)
? ? at Object.Module._extensions..js (module.js:664:10)
? ? at Module.load (module.js:566:32)
? ? at tryModuleLoad (module.js:506:12)
? ? at Function.Module._load (module.js:498:3)
? ? at Function.Module.runMain (module.js:694:10)
2018-11-07
var http = require('http');
var url = "http://www.xianlaiwan.cn/learn/348";
2018-11-07
引入 https?
var http = require('https')