// https://s.hc360.com/?w= + keyword//在拼接網(wǎng)址字符串時(shí),需要對(duì)關(guān)鍵字進(jìn)行encodeURIComponent()編碼處理,否則中文字會(huì)出現(xiàn)亂碼。const superagent = require('superagent');const charset = require('superagent-charset');charset(superagent);superagent.get('https://s.hc360.com/?w=輪轂拉絲機(jī)') .charset('gb2312') .end((err,res)=>{ if(err) return console.log('爬取失敗'); console.log(res.text); })這段代碼無法輸出正確的結(jié)果,有人知道代碼哪里出錯(cuò)了嗎?謝謝啦
nodejs爬蟲--superagent結(jié)果出錯(cuò)
慕虎7371278
2019-02-05 07:43:04