如何获得电影评级

时间:2015-09-16 14:36:03

标签: web-services imdb

我希望从IMDB获得电影评级。当我从互联网上搜索来源时,我发现imdb的网络服务不是免费的,很多开发人员都使用www.omdbapi.com。而且,我找不到正确的api或者ims的ws。但是,由于费率和imdb政策的真实信息,我不确定要使用它。 任何人都可以提出任何建议吗? 感谢

2 个答案:

答案 0 :(得分:3)

来自www.omdbapi.com的信息是从原始IMDB数据库中提取的。你几乎应该得到同样的准确度。

您可以看到两侧的评分相同,imdbVotes相似(但IMDB版本比OMDBApi更新。)

答案 1 :(得分:0)

@Begum imdb可以查询一个独特的电影如下 -

i参数与来自imdb的唯一电影ID一起使用,例如tt1347007可以获取Norweigan 2009电影Hidden返回json中的信息 -

http://www.omdbapi.com/?i=tt1347007&plot=short&r=json

返回信息如下所示,并且可以使用getJSON进行处理,例如,如果您使用的是javascript:

 {"Title":"Hidden","Year":"2009","Rated":"R","Released":"03 Apr 2009",
 "Runtime":"95 min","Genre":"Horror, Thriller","Director":"Pål Øie",
 "Writer":"Pål Øie","Actors":"Kristoffer Joner, Cecilie A. Mosli, Bjarte Hjelmeland,
  Marko Iversen Kanic","Plot":"Painful memories arise when Kai Koss goes 
  back to his childhood home after 19 years and inherits his dead mother's house.",
  "Language":"Norwegian, Swedish","Country":"Norway","Awards":"1 win & 2 nominations.",
   "Poster":"http://ia.media-imdb.com/images/M/MV5BNTM3OTEyMjA1NV5BMl5BanBnXkFtZTcwMzQxNjQyMw@@._V1_SX300.jpg",
 "Metascore":"N/A","imdbRating":"5.7","imdbVotes":"2,295","imdbID":"tt1347007",
  "Type":"movie","Response":"True"}

将此与2005年另一部名为Hidden的电影相比较,网址为http://www.imdb.com/title/tt0478411/,因此itt0478411,并且对omdbapi的调用将为 -

http://www.omdbapi.com/?i=tt0478411&plot=short&r=json

返回数据你可以看到这是一部新西兰电影:

  {"Title":"Hidden","Year":"2005","Rated":"N/A","Released":"N/A",
 "Runtime":"93 min","Genre":"Thriller","Director":"Tim McLachlan",
 "Writer":"Tim McLachlan","Actors":"Luke Alexander, Dana Bernard, 
 Daniel Betty, Ellie Cragg","Plot":"Deep within a dark, twisted forest, at a 
 faraway adventure camp, a group of young 'camp leaders' play a fast and 
 furious game of 'hide and seek'. The atmosphere is strange and thick with ...",
 "Language":"English","Country":"New Zealand",
 "Awards":"N/A","Poster":"http://ia.media-imdb.com/images/M/MV5BMTQ4NTgyNTUwOV5BMl5BanBnXkFtZTcwNzY0OTM4NA@@._V1_SX300.jpg",
  "Metascore":"N/A","imdbRating":"5.0","imdbVotes":"99","imdbID":"tt0478411",
 "Type":"movie","Response":"True"}

如果按名称搜索omdbapi将返回一个包含所有匹配项的JSON对象,然后您自己解析并排序或显示给用户,这取决于您想要做什么。

OMDBAPI的另一个有用功能是能够在同一个电话中同时从同一部电影的rottentomatoes返回所选信息,如下所示:

http://www.omdbapi.com/?i=tt0478411&plot=short&r=json&tomatoes=true

完整的文档可以在http://www.omdbapi.com/找到,许多使用API​​的代码示例可以在github和codepen这样的地方找到,这是一个非常好的API。