Created
April 29, 2013 16:00
-
-
Save molant/5482576 to your computer and use it in GitHub Desktop.
Problem with cookie handling and some websites
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
"use strict"; | |
var request = require('request'), | |
request = request.defaults({ | |
// jar: false, | |
headers: { | |
'Accept': 'text/html, application/xhtml+xml, */*', | |
'Accept-Language': 'en-US,en;q=0.5', | |
'User-Agent': 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)'}}), | |
websites = ['http://cnet.com', | |
'http://walmart.com', | |
'http://cnet.com'], | |
i = 0, | |
max = websites.length; | |
function next() { | |
if (i < max) { | |
request(websites[i], function (err, res, body) { | |
console.log(i + ' ' + (res ? res.statusCode : err) + ' ' + (res ? res.request.href : websites[i])); | |
i++; | |
next(); | |
}); | |
} else { | |
console.log('finished'); | |
} | |
} | |
next(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment