Advertisement
rg443

gdefon.com ->imgur

Mar 19th, 2013
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. city 709
  3. animals 1172
  4. macro 493
  5. landscapes 2705
  6. nature 784
  7. moods 473
  8. flowers 525
  9. stuff 1502
  10. */
  11.  
  12. var stack=0;
  13. //for (var i=1;i<=1502;i++){stack++;setTimeout(get_url,i*150,"http://www.gdefon.com/stuff/page/"+i, callback1);}
  14. for (var i=1;i<=500;i++){stack++;setTimeout(get_url,i*150,"http://www.gdefon.com/page/"+i, callback1);} // latest submitions
  15.  
  16.  
  17. function callback1() {
  18.   var a = this.match(/http\S+\.jpg/gim).map(function(v) {
  19.     return v.replace("wallpapers_preview", "wallpapers_original").replace("(www.GdeFon.ru)", "")
  20.   });
  21.   //console.log(a.join("\n"));
  22.   post_imgur(a, function() {
  23.     console.log("imgur: " + (this.split("\n").length - 1), --stack);
  24.     window.hl = this.toString()
  25.   })
  26. }
  27. ;
  28.  
  29.  
  30. /* upload imgur */
  31. function post_imgur(a,callback) {    
  32. var r=new XMLHttpRequest();
  33. r.open("POST","http://176.34.162.148/jabry/imgur1.asp?u=&b=",true);
  34. //r.open("POST","http://notebook1.lan:8000/jabry/imgur1.asp?u=&b=",true);
  35. r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  36. r.onreadystatechange=function(){if (this.readyState==4 && this.status==200) callback.call(this.responseText); }
  37. r.send("u=" + a.join(","));
  38. }
  39.  
  40. /* fetch url */
  41. function get_url(url,callback) {
  42.     var r=new XMLHttpRequest();
  43.     r.open("GET",url,true);
  44.     r.onreadystatechange=function(){
  45.        if (this.readyState==4 && this.status==200) callback.call(this.responseText);
  46.        }
  47.     r.send();      
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement