Created
September 18, 2014 21:10
-
-
Save JonAbrams/af4020ea3dd31cf3ffc2 to your computer and use it in GitHub Desktop.
Scrape list of URLs and prints them - Uses promises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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