Monday, February 5, 2007

Upvoting *EVERY* link on reddit

(Doing this hack requires you to be using Firefox with Firebug installed. )

Using this hack you can upvote any number of links at a time. However use this at you own risk. If you end up getting banned, sued or anything else, I probably cant help you.

1. Get the user hash which Reddit uses to uniquely identify you.
1.1 Right click in the page and choose "View source".
1.2 Search(CTRL+F) for 'onclick="javascript:mod' , without the quotes.
1.3 This would show something like
onclick="javascript:mod(1813204, 0, '479733a478a35011111b4e70000000000').
1.4 Note the last string, this is your user hash.

2 Start the firebug console.
2.1. Once you have both firefox and firebug installed, you would see a green check box in your bottom-right corner.
2.2. Click it to start firebug.
2.3 Click on console tab and paste this code after typing your user hash

for(i=100; i <200; i++)
{
id = i;

uh = ''[your user hash]";
dir = 1;
new Ajax.Request('/ajax', {parameters: "action=mod&id="+id+"&dir="+dir+"&uh="+uh});
}
3. Click on run. You have just upvoted a hundred links.

(Please do not abuse this. If you upvote thousands of link, the reddit servers would get overloaded and this hack probably banned).

(Explaination of the hack for the programatically inclined.)

When you upvote a link on Reddit, the function mod(id, uc, uh) from reddit.js?v=2 is called.

The arguments used are
1. id = id of the link. (My guess is that it is the primary key of the links table in the reddit database)
2. uc = Whether we want to upvote or downvote?
3. uh = User hash. This is used to uniquely determine which user has voted for the link. This probably is the salted hash of your username.

It does a number of things like checking if you are logged in, and those do not interest us. The last line is the only interesting line for us.

new Ajax.Request('/ajax', {parameters: "action=mod&id="+id+"&dir="+dir+"&uh="+uh});
This makes a HTTP Post request to upvote the link you choose. Since we want to upvote ten requests at a time, we use a loop and make that post requests ten times, or hundered times as needed.

No comments: