IMDB 海报 URL 返回推荐被拒绝 [英] IMDB Poster URL Returns Referral Denied

查看:21
本文介绍了IMDB 海报 URL 返回推荐被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Ruby on Rails 应用程序中,我使用 imdb gem (https://rubygems.org/gems/imdb) 按标题搜索电影并获取海报 URL 并将其添加到我拥有的电影模型中我的数据库.然后在我看来,我将该 url 放在图像源标记中并将图像显示给用户.

In my Ruby on Rails app, I use the imdb gem (https://rubygems.org/gems/imdb) to search for a movie by title and grab the poster url and add it to the movie model I have in my database. Then in my view, I put that url in an image source tag and display the image to the user.

我在本地运行应用程序时没有任何问题,但是当我将其部署到 Heroku 时,有时会成功渲染一些图像,但在大多数情况下,它们无法正确显示.我尝试了多种浏览器,结果在我尝试加载图像时收到推荐被拒绝"消息,内容为:

I don't have any problems when I'm running my application locally, but when I deploy it to Heroku, sometimes a few images are rendered successfully but for the most part, they aren't displayed properly. I've tried multiple browsers and as it turns out when I try to load the image, I get a "Referral Denied" message saying:

You don't have permission to access "[poster url here]" on this server. Reference #[some ref. number here]

我将如何解决这个问题?我猜这是因为 IMDB 服务器拒绝了我的访问,因为我从我的应用程序发出了太多请求,或者因为我的应用程序没有必要的凭据来获取数据,或者可能是两者的某种组合.有没有办法绕过这个?

How would I go about fixing this? I'm guessing it's because the IMDB server is denying my access because either I'm making too many requests from my application or because my application doesn't have the necessary credentials to get the data or maybe some combination of both. Is there a way to bypass this at all?

推荐答案

IMDB 阻止将来自他们网站的图像直接链接到其他网站,我认为这是 上一个问题 涵盖了该主题.

IMDB blocks the direct linking of images from their site on other sites, I think this previous question covers the topic.

解决此问题的最简单方法是下载图像并自行托管,而不是链接 IMDB 的副本.或者,您可以调查替代电影数据库,看看它们是否可以提供您想要的 - 这个问题的答案在 IMDB APIs 上列出了一些.电影数据库 API 看起来不错.

The easiest way to get around this is to download the image and host it yourself rather than linking IMDB's copy. Alternatively you could investigate alternative movie DBs to see if they can offer what you want - the answers to this question on IMDB APIs lists a few. The Movie DB API looks like a good bet.

这篇关于IMDB 海报 URL 返回推荐被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆