Advertisement
Guest User

Untitled

a guest
Mar 6th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var USERNAME = 'juuhelikkas15';
  2. var PASSWORD = 'juuhelikkas15';
  3.  
  4. var page = require('webpage').create();
  5.  
  6. page.open('http://www.dalaran-wow.com/', function(status) {
  7.     console.log('/: ' + status);
  8.     if (status !== 'success') {
  9.         phantom.exit();
  10.     } else {
  11.         setTimeout(function() {
  12.             login();
  13.             setTimeout(function() {
  14.                 vote(1);
  15.             }, 10000)
  16.         }, 10000);
  17.     }
  18. });
  19.  
  20. function login() {
  21.     page.open('http://www.dalaran-wow.com/loginframe.php', function(status) {
  22.         console.log('/loginframe.php: ' + status);
  23.         setTimeout(function() {
  24.             page.evaluate(function(cred) {
  25.                 document.getElementById('accountName').value = cred.u;
  26.                 document.getElementById('password').value = cred.p;
  27.                 $(document.querySelector('.button1')).click();
  28.             }, {u: USERNAME, p: PASSWORD});
  29.         }, 3000);
  30.     })
  31. }
  32.  
  33. function vote(i) {
  34.     var max = 4;
  35.     if (i > max) {
  36.         phantom.exit();
  37.     }
  38.     page.open('http://www.dalaran-wow.com/account/vote/' + i, function(status) {
  39.         console.log('/account/vote/' + i + ': ' + status);
  40.         if (status !== 'success') {
  41.             phantom.exit();
  42.         } else {
  43.             setTimeout(function() {
  44.                 vote(i + 1);
  45.             }, 10000);
  46.         }
  47.     });
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement