|
var http = require('http');var cheerio = require('cheerio')var url = 'http://www.dodzz.com/links.html'function filterChapters(html){var $ = cheerio.load(html)var chapters = $('meta')chapters.each(function(item){var chapter = $(this).find('keywords').attr('content')//这里运行后 没有任何提示(我想问下怎么爬取html页面中meta属性内容)console.log(chapter)})http.get(url,function(res){var html = ''res.on('data',function(data){html += data})res.on('end',function(){filterChapters(html)})}).on('error',function(){console.log('error')}) |