Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 500px page through image gallery (following)
- var t1=new Date(),stack=0;tag="following",page=6511;
- //tag="following",page=6511;
- //tag="rg443/favorites",page=884;
- //tag="popular",page=1112;
- //tag="editors",page=324;
- //tag="upcoming",page=1065;
- //tag="fresh/today",page=3361;
- //tag="fresh/yesterday",page=1421;
- //tag="fresh/week",page=5749;
- // tag="blog",page=61;
- tag="following",page=100;
- /* fetch url */
- function get_url(url,callback) {
- var r=new XMLHttpRequest();
- r.open("GET",url,true);
- //r.setRequestHeader("X-Requested-With", "XMLHttpRequest");
- //r.setRequestHeader("Accept-Encoding", "gzip");
- r.onreadystatechange=function(){
- if (this.readyState==4 && this.status==200 && callback) callback.call(this.responseText);
- }
- r.send();
- }
- /*
- Array.prototype.unique = function(){
- return this.filter(function(s, i, a){ return i == a.lastIndexOf(s); });
- }
- */
- function post_imgur(a,callback) {
- var r=new XMLHttpRequest();
- r.posted=a.length;
- r.open("POST","http://176.34.162.148/jabry/imgur1.asp?u=&b=",true);
- //r.open("POST","http://notebook1.lan:8000/jabry/imgur1.asp?u=&b=",true);
- r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- r.onreadystatechange=function(){if (this.readyState==4 && this.status==200 && callback) callback.call(this.responseText); }
- r.send("u=" + a.join(","));
- stack++;
- }
- function parse_page(s){
- var m=s.toString().match(/http:\/\/pcdn.500px.net\/\d+\/\w+\/\d.jpg/gim);
- m && m.forEach(function(v,i,a){a[i]=v.replace(/\d.jpg$/,"4.jpg")});
- //console.log(m);
- m && post_imgur(m,function(){console.log("imgur rcvd: "+ (this.split("\n").length-1),--stack) });
- };
- function callback1(s){
- parse_page(s.toString());
- console.log(page,(new Date()-t1));
- if (--page>0) get_url("http://500px.com/"+tag+"?page="+page,function(){callback1(this.toString())})
- t1=new Date();
- }
- callback1("");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement