1 var cheerio = require("cheerio"); 2 var request = require(‘request‘); 3 var iconv = require(‘iconv-lite‘); 4 5 request.get({url:‘http://mil.news.sina.com.cn/2015-07-21/1454835521.html‘,encoding:null},function(error,response,body){ 6 var html = iconv.decode(body, ‘gb2312‘); 7 console.log(html); 8 $ = cheerio.load(body,{decodeEntities: false}); 9 // console.log($("#artibody").html()); 10 11 12 });
时间: 2024-10-11 20:28:48