SilentVoid13/Templater

Random picture generator inoperable

FrumpyMonk opened this issue · 16 comments

Hello,

As the subject line indicates, it looks like the web call for random picture generator is no longer working. Here are the details.

  • OS = MacOS 14.6.1
  • Templater 2.4.1
  • Obsidian 1.7.0

Describe the bug

The templater code <% tp.web.random_picture() %> produces the response "Error generating random picture".

Expected behavior
As of last week Wendesday, the same code produced a random picture from unsplashed.

Additional context
The direct link that accompanies this function, https://templater-unsplash.fly.dev, is no longer producing an image, either.

Is there any indication whether unsplahed has changed its APIs and/or if this feature will return?

Thank you

image
same problem

I'm facing the same problem. I generate the random image at the start of my Daily Notes template and this issue with the API is causing the rest of my template to delay loading.

Is it something with the 'archived api'?

Also having same issue

Looks like for whatever reason, the proxy for unsplash that shabegom added went down. I do not expect they will be available to bring it back up. I will investigate hosting my own proxy or finding another way to bring this functionality back.

@Zachatoo

Your help would be terrific. Generating the random image is a small thing, but it does make a big difference in a wide array of workflows. Thanks!

Looks like for whatever reason, the proxy for unsplash that shabegom added went down. I do not expect they will be available to bring it back up. I will investigate hosting my own proxy or finding another way to bring this functionality back.

I test it yesterday, but it seems that the new proxy [[https://templater-unsplash-2.fly.dev]] went down again. Would somebody have a try on it?

the error message from dev tools:

Access to fetch at 'https://templater-unsplash-2.fly.dev/' from origin 'app://obsidian.md' has been blocked by CORS policy: No > 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the > > request's mode to 'no-cors' to fetch the resource with CORS disabled.

The new proxy isn't ready yet. I was hoping to just reuse the same code, but the app keeps crashing. I certainly appreciate your enthusiasm to test it though!

I'll comment here once I'm confident the new proxy is ready.

The new proxy should be up and running! Please let me know if it isn't working for you. Please keep in mind that we are rate limited. I'll keep an eye on the metrics to see how we're doing on staying below the rate limit.

So does the daily_quote: <% tp.web.daily_quote() %>
image

We're tracking daily quotes not working here #1407 , it's an unrelated issue.

get6 commented

I updated Templater to version 2.4.2

The result of this command(<% tp.web.random_picture() %>) is shown below

스크린샷 2024-08-24 오전 11 24 43

When I pass in a parameter(<% tp.web.random_picture("768x432") %>)
I got an error statement. Error generating random picture.

What should I do?!

Anyway Thanks you for solving the issue so quickly!

We're hitting about 400 requests an hour, which is well above the limit. I'll need to look into increasing the limit, having each user create their own API key instead of sharing a single API key, or switching services.

Each user having their own API key is against the TOS, so I will not be doing that.

I have applied for increased limits, I should hear back in 5-10 business days.

It's been working for me for several days/weeks now. Thanks for fixing it!

@get6 I just tested your example and it appears to be working for me.

Keep in mind that we are still rate limited, I've gone back and forth with the Unsplash team a few times and have not gotten accepted for higher rate limits yet. Will post here once we are accepted or rejected.