Advertisement
rg443

mrwallpaper -> imgur (v2)

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