rg443

avantos-live -> imgur (detail page)

Jun 9th, 2013
133
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<=206;i++){stack++;setTimeout(get_url,i*100,"http://avantos-live.ru/page/"+i+"/", callback1);}
  3.  
  4.  
  5. function callback1() {
  6.   var a = this.toString().match(/http:\/\/avantos.files.wordpress.com\/\S+.jpg/gim).map(function(v){return ''+v  });
  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.   /* detail page */
  15.   var x=this.toString().match(/http:\/\/avantos-live.ru\/\S+(?=#more-\d+)/gim)
  16.   if (x) x.forEach(function(v,i){
  17.      stack++;
  18.      console.log(stack,i,v);
  19.      setTimeout(get_url,i*100,v, callback1);
  20.      });
  21.  
  22. }
  23. ;
  24.  
  25.  
  26. /* upload imgur */
  27. function post_imgur(a,callback) {    
  28. var r=new XMLHttpRequest();
  29. r.open("POST","http://176.34.162.148/jabry/imgur1.asp?u=&b=",true);
  30. //r.open("POST","http://notebook1.lan:8000/jabry/imgur1.asp?u=&b=",true);
  31. r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  32. r.onreadystatechange=function(){if (this.readyState==4 && this.status==200) callback.call(this.responseText); }
  33. r.send("u=" + a.join(","));
  34. }
  35.  
  36. /* fetch url */
  37. function get_url(url,callback) {
  38.     var r=new XMLHttpRequest();
  39.     r.open("GET",url,true);
  40.     r.onreadystatechange=function(){
  41.        if (this.readyState==4 && this.status==200) callback.call(this.responseText);
  42.        }
  43.     r.send();      
  44.  
  45. }
Add Comment
Please, Sign In to add comment