Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random picture generator inoperable #1435

Open
FrumpyMonk opened this issue Aug 19, 2024 · 16 comments
Open

Random picture generator inoperable #1435

FrumpyMonk opened this issue Aug 19, 2024 · 16 comments
Labels
bug Something isn't working

Comments

@FrumpyMonk
Copy link

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

@FrumpyMonk FrumpyMonk added the bug Something isn't working label Aug 19, 2024
@snowfield516
Copy link

image
same problem

@marvincyk
Copy link

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.

@linglilongyi
Copy link

Is it something with the 'archived api'?

@stephen-xyz
Copy link

Also having same issue

@Zachatoo
Copy link
Collaborator

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 added a commit that referenced this issue Aug 21, 2024
@FrumpyMonk
Copy link
Author

@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!

@linglilongyi
Copy link

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.

@Zachatoo
Copy link
Collaborator

Zachatoo commented Aug 22, 2024

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.

@Zachatoo
Copy link
Collaborator

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.

@snowfield516
Copy link

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

@Zachatoo
Copy link
Collaborator

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

@get6
Copy link

get6 commented Aug 24, 2024

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!

@Zachatoo Zachatoo reopened this Sep 2, 2024
@Zachatoo
Copy link
Collaborator

Zachatoo commented Sep 2, 2024

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.

@Zachatoo
Copy link
Collaborator

Zachatoo commented Sep 2, 2024

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.

@stephen-xyz
Copy link

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

@Zachatoo
Copy link
Collaborator

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants