Skip to content

Instantly share code, notes, and snippets.

@audstanley
Created January 13, 2016 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save audstanley/45931df1d7b1f427ff8b to your computer and use it in GitHub Desktop.
Save audstanley/45931df1d7b1f427ff8b to your computer and use it in GitHub Desktop.
request({'uri' : 'http://' + 'admin' + ':' + 'password2' + '@localhost:8080/gui/token.html'}, function(error, response, body) {
var regex = new RegExp('<div id=(?:\'|")token(?:\'|")[^>]+>(.*)</div>');
var matches = regex.exec(body);
var ourToken = matches[1];
console.log(response.body);
request({'uri' : 'http://' + 'admin' + ':' + 'password2' + '@localhost:8080/gui/?token=' + ourToken + '&action=add-url&s=' + lastTorrent, 'cookie': response.headers['set-cookie'].GUID}, function(error, more) {
console.log(more.body);
});
jf.writeFileSync('/home/audstanley/slackberrypiratebot/json/output.json', response);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment