如果你对该文章中的内容有疑问/不解,可以点击此处链接提问
要注明问题和此文章链接地址 点击此处跳转
var http = require('http')
var url = 'http://www.imooc.com/learn/348'
var cheerio = require('cheerio')
http.get(url,function(res){
var html = ''
res.on('data',function(data){
html += data
})
res.on('end',function(){
console.log(html)//打印HTML
// filterChapters(html)
})
}).on('error',function(){
console.log("获取失败")
})
// //安装模块 npm install cheerio
// function filterChapters(html){
// var $ = cheerio.load(html)
// var chapters = $('.learnchapter')
// }
王明昌博客


