Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Scrape list of URLs and prints them - Uses promises
var Promise = require('bluebird'); // The best promise library out there
var request = require('request-promise'); // Scrapes the specified url, returns promise e.g. request(url)
var urls = process.argv.slice(2); // List of URLs to scrape
Promise.map(urls, request) // Returns an array of promises to the results of scraping the url
.each(console.log) // Call console.log on each resolved promise
.catch(console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment