Im trying to screen scape a site with authentication in node.js, but when i try to submit the form i get this:
"Your browser "for others" does not support our site."
The username gets set, but the password seems to be blank.
im using the request node module.
My code:
router.get('/scrape', function(req, respond){
var credentials = {
username: 'kevin',
password: 'secret'
};
request.post({
uri: my site url here,
headers: { 'content-type': 'application/x-www-form-urlencoded' },
body: require('querystring').stringify(credentials)
}, function(err, res, body){
if(err) {
respond.end(err);
}
respond.send(body);
});
});
Probably u need to specify User-Agent header, like :
var credentials = {
username: 'kevin',
password: 'secret'
};
request.post({
uri: my site url here,
headers: {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36'
},
form:credentials
}, function(err, res, body){
if(err) {
respond.end(err);
}
respond.send(body);
});