?

Log in

No account? Create an account
entries friends calendar profile Previous Previous Next Next
Rick Astley - Ed's journal
sobrique
sobrique
Rick Astley
OK, so I presume you all know what a Rick Roll is?
Please see this Wikipedia link: http://en.wikipedia.org/wiki/Rickrolling if you don't.

Well, it seems that we have the MTV music awards up 'soon'.
And wouldn't you know? Rick's up, for 'Best Act Ever'. http://news.bbc.co.uk/1/hi/entertainment/7646807.stm

It seems that MTV are good at this voting thing. They have their website: http://ema.mtv.co.uk/vote

And it even says... 'please vote again, to make sure your favourite wins'.

4chan noticed.

So now there's a little bit of Python doing the rounds, which submits votes to MTV.

It seems somehow a cutting irony that he's doing so well, with a 20 year old song, based ... pretty much on how funny 4chan thinks it is.



#!/usr/bin/env python
import urllib2
import urllib
import time

num = 1000000 # The number of times to iterate

params = {}
params['fields[category]'] = 'Best Act Ever'
params['fields[artist]'] = 'Rick Astley'
params['action[suggestions]'] = 'Vote'
params = urllib.urlencode(params)

for x in range(num):
  try:
   print "Running iteration #%s" % x
   time.sleep(1)
   req = urllib2.Request(url='http://ema.mtv.co.uk/vote/', data=params)
   urllib2.urlopen(req)
  except:
   print "MTV server seems stressed. BUT THE SPAM MUST GO ON"



I'm quite impressed at how simple a language it is, to do that. You may need to download a python interpreter to run it, mind. Which you can get from: http://www.python.org/download/

I've installed a copy, purely for academic curiousity you under stand. But really, what better reason to learn Python?
2 comments or Leave a comment
Comments
_gh0st_ From: _gh0st_ Date: October 2nd, 2008 09:16 pm (UTC) (Link)
Ha! genius :)
cthulahoops From: cthulahoops Date: October 4th, 2008 12:18 am (UTC) (Link)
Don't learn too much from this code.

That's a good example my most hated thing to never, ever, ever to do in python. (An instant banned from computers offense.) I've already lost days of my life to people doing that. That unqualified except block will catch any type of error (syntax errors, missing modules, typos, bad function arguments) and convert them into a message that probably lies about what the problem is.
2 comments or Leave a comment