hellokitty111
7/26/2014 - 1:29 AM

获取豆瓣最新电影

获取豆瓣最新电影

var request = require("request");
var cheerio = require("cheerio");

var url = "http://movie.douban.com/trailers";
request(url,function(error,response,body){if(!error && response.statusCode == 200){
		var $=cheerio.load(body);
		console.log('%s\n',$('h1').text());
		$('.list-item').each(function(){
        console.log("%s  %s %s",$(this).find('a').text(),$(this).find('.meta').text().trim(),$(this).find('a').attr('href'));
		});
	}
});


//Example:老男孩猛龙过江  2014-07-25上传 http://movie.douban.com/trailer/159812/?from=latest