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

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

问题描述

在我的Ruby on Rails应用程序中,我使用imdb gem(https://rubygems.org/gems/imdb)按标题搜索电影,并抓取海报网址并将其添加到我拥有的电影模型中我的数据库。然后在我看来,我把这个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 API上列出了一些。 Movie DB 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海报网址返回引荐被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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