Advertisement
rg443

jpeg / page -> imgur (context)

Nov 2nd, 2013
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var tmp=location.href.match(/^\S+\b(\d+)\S*/),url=tmp[0].replace(tmp[1],"$i"),i2=parseInt(tmp[1]);
  2. var arr=[];
  3. for (var i=i2,j=0;i>0;i--,j+=500) setTimeout(function(i){
  4.    var r=new XMLHttpRequest();
  5.    r.open("GET",url.replace("$i",i),true);
  6.    r.i=i;
  7.    r.t1=new Date();
  8.    r.onload=function(){
  9.        var a=this.response.match(/http[^=]+jpg/gim)||[];a=a.map(function(v){return v.replace(/-\d+x\d+/,"");});
  10.        console.log(a.join("\n"),this.i,a.length);
  11.        a.length&&post_imgur(a,function(){console.log(i,(new Date()-r.t1)+"ms");});
  12.        arr=arr.concat(a);
  13.        }
  14.    r.send();
  15.  
  16.    },j,i);
  17.  
  18. function post_imgur(a,callback) {        
  19. var r=new XMLHttpRequest();
  20. r.open("POST","http://176.34.162.148/jabry/imgur1.asp?u=&b=&x=",true);
  21. r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  22. r.onreadystatechange=function(){if (this.readyState==4 && this.status==200) callback.call(this.responseText); }
  23. r.send("u=" + a.join(","));
  24. }
  25. /*
  26. http://www.travelwalls.net/page/336/
  27.  
  28. http://500px.com/rhophotos?nolayout=true&page=17
  29. var a=this.response.match(/\/\d+\/\S+\/(?=3\.jpg)/gim)||[];a=a.map(function(v){return "http://pcdn.500px.net"+v+"5.jpg"});
  30. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement