Advertisement
rg443

fetch_fotoblur

Feb 12th, 2013
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function get_url(url,callback) {
  2.         var r=new XMLHttpRequest();
  3.         r.open("GET",url,true);
  4.         //r.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  5.         //r.setRequestHeader("Accept-Encoding", "gzip");
  6.         r.onreadystatechange=function(){
  7.        if (this.readyState==4 && this.status==200 && callback) callback.call(this.responseText);
  8.        }
  9.     r.send();      
  10.  
  11. }
  12.  
  13. function post_imgur(a,callback) {        
  14. var r=new XMLHttpRequest();
  15. r.open("POST","http://176.34.162.148/jabry/imgur1.asp?u=&b=",true);
  16. //r.open("POST","http://notebook1.lan:8000/jabry/imgur1.asp?u=&b=",true);
  17. r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  18. r.onreadystatechange=function(){if (this.readyState==4 && this.status==200) callback&&callback.call(this.responseText); }
  19. r.send("u=" + a.join(","));
  20. }
  21.  
  22. function fetch_fotoblur(tag,pages) {
  23. console.log(tag,pages);
  24. var stack=0,stack2=0;
  25. for (var i=1;i<=pages;i++) stack++&&get_url("http://www.fotoblur.com/gallery?filter="+tag+"&page="+i,function(){
  26.    var a=this.toString().match(/\/imgs\/.*?jpg/g)
  27.    if(a)a=a.map(function(v){return "http://www.fotoblur.com"+v.replace("sm_","")});
  28.    console.log(--stack,a&&a.length);
  29.    stack2++
  30.    a&&post_imgur(a,function(){console.log("imgur:",--stack2,this.toString().split("\n").length-1);});
  31.    });
  32. };
  33.  
  34. fetch_fotoblur("features",109);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement