last year’s model

There are too many folks competing in this year’s MediaBistro beauty pageant for me to take sides. But I’m always eager to convince my friends to learn some scripting mojo (seriously, it’ll make your life better). So here’s the code that worked last year. How to configure it, modify it, and run it is left as an exercise for the reader.

#!/usr/bin/perl
use WWW::Mechanize;
my $num_votes_to_make = 9999; # this would be a bit obvious, wouldn't it?
my $min_sleep_time = 1; # sleep at least a second between votes
my $max_sleep_time = 10; # but no more than ten seconds
my $mech = WWW::Mechanize->new();
$mech->proxy(['http', 'ftp'], 'http://127.0.0.1:8118/'); # use a Tor proxy on port 8118 to hide our IP address (http://tor.eff.org)
for(my $i=0;$i<$num_votes_to_make;$i++)
{
print "voting...\n";
my $url = 'http://mediabistro.com/articles/poll/000091/';
$mech->get( $url );
$mech->submit_form(
form_number => 0,
fields => {
rsld => '330'
}
);
my  $random_sleep_time = int(rand( $max_sleep_time-$min_sleep_time+1 ) ) + $min_sleep_time;
print "sleeping " . $random_sleep_time . " seconds...\n";
sleep $random_sleep_time;
}

4 Responses to “last year’s model”

  1. Karen says:

    Hey. This has nothing to do with this post, but I bet you know the answer to this question: what is the best free application for taking little clips out of a bunch of MP3s and splicing them together into one long song? I tried Audion 3 and it worked great for half an hour, then cut off the end of my song and drove me insane. -Karen

  2. Tom says:

    I’d probably just use Audacity. It’s open source, free and available on a lot of platforms. You may have to download some additional software to make it export to MP3 — let me know if you have any trouble finding the codecs to do that.

  3. valerie says:

    hahaha! we looked at the results-so-far last night and ian was convinced that “tom is behind this.”
    i mean, not that our pals aren’t obvious choices regardless…

  4. Tom says:

    I claim innocence! Go check the top few threads at Unfogged — some folks adapted my code, I think, but some original bots were developed, too.

Leave a Reply