Advertisement
rg443

twistedsifter.com -> imgur

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