simonmicro / better-backgrounds

A Cinnamon desktop applet to change your wallpaper to random images from many sources
GNU General Public License v3.0
2 stars 1 forks source link

Problems with Unsplash? #22

Closed simonmicro closed 2 years ago

simonmicro commented 2 years ago

URI does't work check it in http://source.unsplash.com/ , i see it in your source code. Change your uri to the uri wich works pls.

Originally posted by @DRR0B0T in https://github.com/linuxmint/cinnamon-spices-applets/issues/4457#issuecomment-1242958759

simonmicro commented 2 years ago

Your posted URI does not look correct! The URI should look like this (excerpt from the logs):

info t=2022-09-13T12:00:10Z [better-backgrounds@simonmicro] Downloading image https://source.unsplash.com/featured/?nature

What is it for you? And yes, Unsplash can be pretty slow - but they are not down (yet): https://status.unsplash.com/

DRR0B0T commented 2 years ago

@simonmicro i know how it's look like right, i sayed earlyer , URI in his source code look like not correct, maybe in this been this problem. This link is work for me https://status.unsplash.com/. I found it here line 257 ,a few days ago the link was wrong:

else if(this.image_source == 'unsplash') {
            let resStr = 'featured';
            if(this.image_res_manual)
                resStr = this.image_res_width + 'x' + this.image_res_height;
            let tagStr = '';
            if(this.image_tag)
                tagStr = '?' + this.image_tag_data;
            this._download_image('https://source.unsplash.com/' + resStr + '/' + tagStr).then(defaultEnd).catch(errorEnd);
DRR0B0T commented 2 years ago

@simonmicro At now it works , how expected

simonmicro commented 2 years ago

You can see, that the final URI is a little bit more than just 'https://source.unsplash.com/', right? It will be expanded as needed - with filters for the search query as well as resolution constraints, so the final URI may look like the one I posted before.

But I'll add a little warning into the settings, that Unsplash can be unreliable due to high demand.

fredcw commented 2 years ago

There may be a deliberate delay as the url is not rate limited. An alternative may be to use their API url, api.unsplash.com. The problem with this is that you'll have to create a developer account and there is a rate limit of 5000 requests per hour, although I expect this will easily be enough. Another bonus of this is that it might give you some idea of the popularity of usplash option in your applet because you could check the X-Ratelimit-Remaining value. https://unsplash.com/documentation#rate-limiting

DRR0B0T commented 2 years ago

@simonmicro Thank you, good luck! App realy is very comfortable!