soundchaos core
♥0 |
Line 54 |
Modified 2011-03-19 14:06:51 |
MIT License
archived:2017-03-29 13:17:02
ActionScript3 source code
/**
* Copyright wh0 ( http://wonderfl.net/user/wh0 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mZkv
*/
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.utils.*;
public class SoundChaos extends Sprite {
private static const PROXY:String = 'http://p.jsapp.us/proxy/';
private static const SERVER:String = 'http://www.google.com/recaptcha/api/';
private static const KEY:String = '6Ld4iQsAAAAAAM3nfX_K0vXaUudl2Gk0lpTF3REf';
private const scrapeChallenge:RegExp = /challenge : '(.+?)'/;
private const scrapeReload:RegExp = /Recaptcha.finish_reload\('(.+)', 'audio'\);/;
private var c:String;
public function SoundChaos() {
challenge();
}
private function challenge():void {
var req:URLRequest = new URLRequest(PROXY + SERVER + 'challenge');
req.method = URLRequestMethod.GET;
req.data = new URLVariables();
req.data['k'] = KEY;
var ul:URLLoader = new URLLoader();
ul.addEventListener(Event.COMPLETE, handleChallenge);
ul.load(req);
}
private function handleChallenge(e:Event):void {
c = scrapeChallenge.exec(e.target.data)[1];
reload('a');
}
private function reload(r:String='r'):void {
var req:URLRequest = new URLRequest(PROXY + SERVER + 'reload');
req.method = URLRequestMethod.GET;
req.data = new URLVariables();
req.data['c'] = c;
req.data['k'] = KEY;
req.data['type'] = 'audio';
req.data['lang'] = 'en';
req.data['new_audio_default'] = '1';
var ul:URLLoader = new URLLoader();
ul.addEventListener(Event.COMPLETE, handleReload);
ul.load(req);
}
private function handleReload(e:Event):void {
c = scrapeReload.exec(e.target.data)[1];
var req:URLRequest = new URLRequest(SERVER + 'image');
req.method = URLRequestMethod.GET;
req.data = new URLVariables();
req.data['c'] = c;
new Sound(req).play();
setTimeout(reload, 3000);
}
}
}