:function(url) { return new Promise(function(resolve, reject) { request(url, function (error, response, html) { if (error) { reject(error); } var $ = cheerio.load(html); var title = $(‘title').text(); resolve(title); } } }
{ return request(url).then(function(result){ var html = result[1]; var $ = cheerio.load(html); var title = $(‘title’).text(); return title; } } //===========