Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // wallpaperscraft.com
- 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();
- }
- function post_imgur(a,callback) {
- var r=new XMLHttpRequest();
- 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(","));
- }
- function fetch_wallpapers(tag,i2){
- var queue1=0,queue2=0;
- for (var i=1;i<=i2;i++) queue1++&&get_url("http://wallpaperscraft.com/"+tag+"/page"+i,function(){
- queue1--;
- var a=this.toString().match(/http:\/\/wallpaperscraft.com\/image\/\S+.jpg/gim).map(function(v){return v.replace("_preview.jpg","_1920x1200.jpg")});
- console.log(tag,queue1,a.length);
- queue2++;
- post_imgur(a,function(){
- queue2--;
- console.log("imgur",queue2,this.toString().split("\n").length-1);
- });
- });
- }
- /*
- all/downloads/widescreen/1920x1200
- catalog/nature/downloads
- nature 501, animals 556 city 240, flowers 499, girls 233, macro 303, nature 501 food 114, other 289, hi-tech 51
- */
- //fetch_wallpapers("all/downloads/widescreen/1920x1200",2863);
- fetch_wallpapers("catalog/nature",501);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement