Advertisement
rg443

wallpaperscraft.com -> imgur

Feb 16th, 2013
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // wallpaperscraft.com
  2. function get_url(url,callback) {
  3.         var r=new XMLHttpRequest();
  4.         r.open("GET",url,true);
  5.         //r.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  6.         //r.setRequestHeader("Accept-Encoding", "gzip");
  7.         r.onreadystatechange=function(){
  8.        if (this.readyState==4 && this.status==200 && callback) callback.call(this.responseText);
  9.        }
  10.     r.send();      
  11.  
  12. }
  13.  
  14. function post_imgur(a,callback) {        
  15. var r=new XMLHttpRequest();
  16. r.open("POST","http://176.34.162.148/jabry/imgur1.asp?u=&b=",true);
  17. //r.open("POST","http://notebook1.lan:8000/jabry/imgur1.asp?u=&b=",true);
  18. r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  19. r.onreadystatechange=function(){if (this.readyState==4 && this.status==200) callback&&callback.call(this.responseText); }
  20. r.send("u=" + a.join(","));
  21. }
  22.  
  23.  
  24. function fetch_wallpapers(tag,i2){
  25.    var queue1=0,queue2=0;
  26.    for (var i=1;i<=i2;i++) queue1++&&get_url("http://wallpaperscraft.com/"+tag+"/page"+i,function(){
  27.       queue1--;
  28.       var a=this.toString().match(/http:\/\/wallpaperscraft.com\/image\/\S+.jpg/gim).map(function(v){return v.replace("_preview.jpg","_1920x1200.jpg")});
  29.       console.log(tag,queue1,a.length);
  30.       queue2++;
  31.       post_imgur(a,function(){
  32.          queue2--;
  33.          console.log("imgur",queue2,this.toString().split("\n").length-1);
  34.          });
  35.       });
  36.      
  37.  
  38.    }
  39. /*
  40. all/downloads/widescreen/1920x1200
  41. catalog/nature/downloads
  42. nature 501, animals 556 city 240, flowers 499, girls 233, macro 303, nature 501 food 114, other 289, hi-tech 51
  43. */
  44.  
  45. //fetch_wallpapers("all/downloads/widescreen/1920x1200",2863);
  46. fetch_wallpapers("catalog/nature",501);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement