Nodejs Request 并行请求与 Bluebird 响应

Nodejs Request Parallel request with Bluebird response

我有两个 url,我一直在请求并使用 Bluebird promise 库想用 cheerio 处理 url 的 html。我似乎无法得到结果 html。我应该在内部传播中使用什么?

    let url1 = request('http://example1.com')
    let url2 = request('http://example2.com')

    Promise.all([url1, url2])
    .spread(function (url1RqRes, url2RqRes) {

        // How do I get access to the response html here ???

    })
    .catch(function (err) {
        console.log(err)
    });
var cheerio = require('cheerio'); // Basically jQuery for node.js
var rp = require('request-promise');

let url1 = rp('http://example1.com')
let url2 = rp('http://example2.com')

Promise.all([url1, url2])
.then(function (results) {
    console.log('results', results)
    let pages = results.map((resp) => cheerio.load(resp))
    // you will get the result in the same order of promise passed as array
})
.catch(function (err) {
    console.log(err)
});

供参考request-promise with cheerio