Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // window.fetch(), queue_len=5
- var page = 1, pages = 1E3, ql = 1, maxql = 5, pageu = 1, photos = [];
- call1(page);
- function call1(page) {
- fetch("https://api.500px.com/v1/photos/?feature=popular&rpp=100&tags=1&image_size=3,4,2048&consumer_key=cGxWLkAk4zp6XK8mkz95UR7ksy17FsEPo8VfXBCm&page=" + page).then(function(response) {
- return response.json();
- }).then(function(v) {
- console.log(v);
- photos = photos.concat(v.photos);
- ql--;
- v.total_pages && v.total_pages < 1E3 && (pages = v.total_pages);
- while (pageu < pages && ql < maxql) {
- pageu++;
- ql++;
- call1(pageu);
- }
- });
- }
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement