Advertisement
Tumblrisms

Gab.ai Follow Bot (for Greasemonkey / Tampermonkey)

Aug 25th, 2016
1,951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Gab.ai Follow Bot
  3. // @author    @Tumblrisms on twitter, @Fact on gab.ai
  4. // @description Make sure Greasemonkey/Tampermonkey is ON and then load any /followers or /following page on gab.ai, for example https://gab.ai/fact/following. After a few seconds the script will follow everyone who isn't already followed and then load a random new /followers page to repeat the process. Leave it running in a tab while you do something else and pretty soon you will have 1000+ follows and a couple hundred followers.
  5. // @namespace   gabai
  6. // @include  https://gab.ai/*/followers*
  7. // @include  https://gab.ai/*/following*
  8. // @version  1.1
  9. // @grant      none
  10. // ==/UserScript==
  11.  
  12. var pctChanceUndo = 75; // 1 to 100 chance of reverting to a random earlier success page if we get stuck, rather than trying a following/follower page switch
  13.  
  14. var urlParams = new URLSearchParams(window.location.search);
  15. var success1 = urlParams.get("success1");
  16. var success2 = urlParams.get("success2");
  17. var success3 = urlParams.get("success3");
  18.  
  19. function GoToRandomUser()
  20. {
  21.     // Find all usernames on the current page
  22.     var nodes = document.evaluate("//a[@class='profile-badge__username']", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  23.  
  24.     // Did we find any?
  25.     if (nodes.snapshotLength > 0)
  26.     {
  27.         // More than 10 so keep a note of this page in case we get stuck on a private page in the future
  28.         if (nodes.snapshotLength > 10)
  29.         {
  30.             success3 = success2;
  31.             success2 = success1;
  32.             success1 = window.location.pathname;
  33.         }
  34.  
  35.         // Let's go to a random one next
  36.         var url = "https://gab.ai/" + nodes.snapshotItem(Math.floor((Math.random() * nodes.snapshotLength) + 0)).text.slice(1) + "/followers";
  37.     }
  38.     else
  39.     {
  40.         if (Math.floor((Math.random() * 100) + 1) < pctChanceUndo)
  41.         {
  42.             var roll = Math.floor((Math.random() * 3) + 1);
  43.  
  44.             if (roll == 3 && success3 != null && success3 != "null")
  45.             {
  46.                 url = "https://gab.ai" + success3;
  47.             }
  48.             else if (roll == 2 && success2 != null && success2 != "null")
  49.             {
  50.                 url = "https://gab.ai" + success2;
  51.             }
  52.             else if (roll == 1 && success1 != null && success1 != "null")
  53.             {
  54.                 url = "https://gab.ai" + success1;
  55.             }
  56.             else
  57.             {
  58.                 // User started the script on a page with no available users, so use my page as a start instead
  59.                 url = "https://gab.ai/fact/followers";
  60.             }
  61.         }
  62.         else
  63.         {
  64.             // No users found here, so we'll use their /following instead
  65.             var splits = window.location.href.split("/");
  66.             var url = "https://gab.ai/" + splits[3] + "/following";
  67.         }
  68.     }
  69.  
  70.     // Engage!
  71.     window.location.href = url + "?success1=" + success1 + "&success2=" + success2 + "&success3=" + success3;
  72. }
  73.  
  74. function FollowEveryoneOnThisPage()
  75. {
  76.     // Find all follow buttons on the current page
  77.     var nodes = document.evaluate("//a[contains(text(),'Follow')]", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
  78.  
  79.     // Loop through and click all the found follow buttons that are visible
  80.     for (var i = 0; i < nodes.snapshotLength; i++)
  81.     {
  82.         if (nodes.snapshotItem(i).text == "Follow" && nodes.snapshotItem(i).style.display != "none")
  83.         {
  84.             nodes.snapshotItem(i).click();
  85.         }
  86.     }
  87.  
  88.     // In two seconds all the follow requests will definitely have gone through and we can go to another user
  89.     setTimeout(GoToRandomUser, 2000);
  90. }
  91.  
  92. // Random 2 to 5 second delay to give the page time to load and tricky tricky @a ;-)))))
  93. setTimeout(FollowEveryoneOnThisPage, Math.floor((Math.random() * 5000) + 2000));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement