rg443

fwallpapers.com -> imgur

May 12th, 2013
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var stack=0;
  2. for (var i=1;i<=200;i++){stack++;setTimeout(get_url,i*100,"http://fwallpapers.com/latest?page="+i, callback1);}
  3. /* popular latest top  */
  4.  
  5. function callback1() {
  6.   var a = this.toString().match(/http:\/\/.*?\.jpg/gim).map(function(v){return v.replace("imagecache/thumbs175/","") });
  7.  
  8.   console.log(a.join("\n"));
  9.  
  10.   post_imgur(a, function() {
  11.     console.log("imgur: " + (this.split("\n").length - 1), --stack);
  12.     window.hl = this.toString()
  13.   })
  14. }
  15. ;
  16.  
  17.  
  18. /* upload imgur */
  19. function post_imgur(a,callback) {    
  20. var r=new XMLHttpRequest();
  21. r.open("POST","http://176.34.162.148/jabry/imgur1.asp?u=&b=",true);
  22. //r.open("POST","http://notebook1.lan:8000/jabry/imgur1.asp?u=&b=",true);
  23. r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  24. r.onreadystatechange=function(){if (this.readyState==4 && this.status==200) callback.call(this.responseText); }
  25. r.send("u=" + a.join(","));
  26. }
  27.  
  28. /* fetch url */
  29. function get_url(url,callback) {
  30.     var t=new Date();
  31.     var r=new XMLHttpRequest();
  32.     r.open("GET",url,true);
  33.     r.onreadystatechange=function(){
  34.        if (this.readyState==4 && this.status==200) callback.call(this.responseText);
  35.        if (this.readyState==4) console.log(new Date()-t,url);
  36.        }
  37.     r.send();      
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment