Skip to content

Instantly share code, notes, and snippets.

@dkordik
Created August 19, 2011 18:42
Show Gist options
  • Save dkordik/1157640 to your computer and use it in GitHub Desktop.
Save dkordik/1157640 to your computer and use it in GitHub Desktop.
Outputs a JS function that will automatically click "Awesome" every 45 sec in turntable.fm
#!/bin/bash
#put your cookie in here. get it by putting javascript:alert(document.cookie) into the address bar
#when you're on turntable.fm and hit ctrl+c to copy it.
cookie='PASTE YOUR COOKIES IN HERE'
echo "Scraping..."
wget -4 -O OUTPUT --user-agent='Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.04 (lucid) Firefox/3.6.17' --no-cookies --header "Cookie: $cookie" -r -q http://turntable.fm/zzzapp
id=`grep -o block\;cursor\:pointer\;\}#.*\{background\:url\(\'https\:\/\/s3\.amazonaws\.com\/static\.turntable\.fm\/roommanager_assets\/props\/vote_btns\.png OUTPUT | awk -F '#' '{print $2}' | awk -F '{' '{print $1}'`
echo "
var awesome = function(domId) {
var elem = jQuery('#' + domId);
if (elem.length > 0) {
console.log('Clicked awesome button: ',elem, Date().toString());
} else {
console.log('Could not find awesome button.');
clearInterval(awesomeInterval);
return false;
}
var event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, true, window,1, 0, 0, elem.offset().left, elem.offset().top, false, false, false, false, 0, null);
document.getElementById(domId).dispatchEvent(event);
};
awesomeInterval = setInterval('awesome(\"$id\")', 45000)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment