Skip to content

Instantly share code, notes, and snippets.

@AbhinavMadahar
Created October 10, 2015 14:50
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 AbhinavMadahar/adb7e9e9960e57c5568c to your computer and use it in GitHub Desktop.
Save AbhinavMadahar/adb7e9e9960e57c5568c to your computer and use it in GitHub Desktop.
var Horseman = require('node-horseman');
var request = require("request");
var horseman = new Horseman();
var timesHit = 0;
var title = "Shrek";
var url = "https://en.wikiquote.org/w/api.php?action=parse&page=" + title + "&format=json"
request(url, function(error, responseCode, body) {
var request = require("request");
var striptags = require("striptags");
var quotes = body.match(/<li>[\s\S]*?<\/li>/g).map(striptags);
var i = 0;
var main = function() {
horseman
.userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0")
.open('http://hackmhs.com/live/')
.type('#newMsg', quotes[i])
.keyboardEvent("keypress", 16777221)
.finally(function() {
console.log(quotes[i]);
i++;
main();
});
};
main();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment