Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
35
rated 0 times [  38] [ 3]  / answers: 1 / hits: 42269  / 13 Years ago, sat, april 30, 2011, 12:00:00

I'm on https://twitter.com/#!/username/followers ; is there any greasemonkey script to follow all the twitter users on that page?


More From » twitter

 Answers
67

Here's a new one which also employs a delay to prevent spam issues.



var FOLLOW_PAUSE = 1250;
var FOLLOW_RAND = 250;
var PAGE_WAIT = 2000;
__cnt__ = 0;
var f;
f = function() {
var eles;
var __lcnt__ = 0;
eles = jQuery('.Grid-cell .not-following .follow-text').each(function(i, ele) {
ele = jQuery(ele);
if (ele.css('display') != 'block') {
console.trace('Already following: ' + i);
return;
}
setTimeout(function() {
console.trace(Following + i + of + eles.length);
ele.click();
if ((eles.length - 1) == i) {
console.trace(Scrolling...);
window.scrollTo(0, document.body.scrollHeight);
setTimeout(function() {
f();
}, PAGE_WAIT);
}
}, __lcnt__++ * FOLLOW_PAUSE + Math.random()*(FOLLOW_RAND) - FOLLOW_RAND/2);
__cnt__++;
});
}
f();


What it does:




  • Looks for follow buttons

  • Checks that you aren't already following or pending (display: block check)

  • Sets a timer to click the FOLLOW buttons every 500ms to prevent spam issues.

  • NEW! When it's done them all, scrolls the page and waits a couple seconds for the next loads to appear, then repeats the whole process!



Notes for hackers:




  • Works on Chrome latest version and Twitter as of the 30th of Sep 2016.

  • You seem to need to click the DIV inside the A tag, not the A tag itself.

  • HOMEWORK: Maybe try jQuery's live() function to auto-click any new buttons which show up after the initial page load :)



Disclaimer: This is not a hack...just a technique to save some wrist and finger RSI :) Regardless, use cautiously and respectfully.



UPDATE: Improved for latest twitter. Now employs randomness in the timing to make you look less like a bot


[#92468] Thursday, April 28, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kinsley

Total Points: 352
Total Questions: 84
Total Answers: 94

Location: Denmark
Member since Tue, Jul 19, 2022
2 Years ago
;