rg443

listofimages -> imgur

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