Advertisement
rg443

view community

Feb 17th, 2013
137
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.  
  23. function fetch_vc(tag,i2){
  24.    var queue1=0,queue2=0;
  25.    for (var i=1;i<=i2;i++) queue1++&&get_url("http://view.stern.de/de/"+tag+"/?page="+i,function(){
  26.       queue1--;
  27.       var a=this.toString().match(/http:\/\/view\S*\/picture\/\S*\.jpg/gim).map(function(v){var x=v.match(/(\d+\/.*)-\d+\.jpg/);return "http://view.stern.de/de/original/"+ x[1]+".jpg";});
  28.       console.log(tag,queue1,a.length);
  29.       //console.log(a.join("\n"));
  30.       queue2++;
  31.       if (true) post_imgur(a,function(){
  32.          queue2--;
  33.          console.log("imgur",queue2,this.toString().split("\n").length-1);
  34.          });
  35.       });
  36.      
  37.  
  38.    }
  39. /*
  40. gallery/1
  41. 0 563
  42. 1 118
  43. 2 145
  44. 3 135
  45. 4 117
  46. 5 117
  47. 6 175
  48. 7 190
  49. 8 70
  50. 9 121
  51. 10 102
  52. 11 89
  53. 12 86
  54. 13 111
  55.  
  56. category/1
  57. 1  1548
  58. 13 2597
  59. */
  60.  
  61. //fetch_vc("category/13",2597);
  62. //fetch_vc("gallery/13",111);
  63. fetch_vc("topimages/0",563)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement