Strategies to Overcome High Request Blocks on Imgur

As I slowly realize the value that images have to seo, I’ve noticed that many of my images are still being hotlinked from Imgur. That is, my old forum didn’t have any upload function so people would use Imgur to share an image. Since moving to Discourse almost 2 years ago it seems that most of the images are still undownloaded and are being hosted by Imgur (despite having the setting to download remote images checked :heavy_check_mark:)

I’ve come to realize this is because the number of requests to Imgur from my server IP is too high and it gets (temporarily?) blocked. Any tips on how to work around this limit?

Maybe a watched word to just disallow imgur images and/or some othe campain to train people to just drag and drop the images straight to Discourse?

Are they displaying properly? Maybe you don’t care?

I think the thing you might do would be to have some proxy that made the imgur request from some other IP. It’s perhaps slighly shady, and likely against their terms of service.

Oh! But wait. Maybe a plugin that used the API would solve your problem.

curl --location -g 'https://api.imgur.com/3/image/{{imageHash}}' \
--header 'Authorization: Client-ID {{clientId}}'

Imgur API.

I think a plugin could do that. I think the code in question is in lib/file_helper.rb starting with def self.download. Or maybe make another job like pull_hotlinked_images that processed only imgur files and didn’t bother with overriding anything. Maybe once your backlog got processed you’d not get hit by rate limits on new posts.

It seems improbable that it would get moved to core, but I don’t make such decisions so don’t blame me or team if I’m wrong. :slight_smile:

1 Like

Thanks for the tips! Just it clarify, my users aren’t uploading from imgur anymore, there is just a large backlog from imported posts that is not being downloaded and replaced (or is being processed at such a slow rate I can’t tell). Our previous platform didn’t allow for image uploads.

1 Like

In that case, my idea of a plugin that created a job that used the imgur API to download them should do the trick. Jus thow tricky it is, I’m not quite sure.

1 Like

Yeah the API/plugin approach seems like the most viable option, now it’s just a question of whether the effort to build the plugin is worth the reward :smile:

1 Like

That was my question from the beginning!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.