2017-04-01 123 views
0

我目前正在对一个大学项目进行原型设计,我需要知道是否可以使用C++从imdb.comrottentomatoes.com获取电影的评分。如果是这样,那么是否有可能以某种方式根据标题单独搜索该评分?从着名电影网站检索数据

+1

他们都不具有HTTP请求公共API。您可以刮取数据,但这可能会导致许可问题。 IMDbs数据库也是公开可用的IIRC,但是,然后再次,你必须看看他们的许可政策 – user2176127

回答

1

最快的方法是使用网站https://www.omdbapi.com/。 只需发送HTTP请求,就可以查询有关电影的信息。网站将返回有关电影信息的JSON。

例子:

HTTP请求 https://www.omdbapi.com/?t=Ghost 将返回JSON

{ "Title":"Ghost", "Year":"1990", "Rated":"PG-13", "Released":"13 Jul 1990", "Runtime":"127 min", "Genre":"Drama, Fantasy, Romance", "Director":"Jerry Zucker", "Writer":"Bruce Joel Rubin", "Actors":"Patrick Swayze, Demi Moore, Whoopi Goldberg, Tony Goldwyn", "Plot":"After a young man is murdered, his spirit stays behind to warn his lover of impending danger, with the help of a reluctant psychic.", "Language":"English", "Country":"USA", "Awards":"Won 2 Oscars. Another 16 wins & 22 nominations.", "Poster":"https://images-na.ssl-images-amazon.com/images/M/[email protected]_V1_SX300.jpg", "Ratings":[ { "Source":"Internet Movie Database", "Value":"7.0/10" }, { "Source":"Rotten Tomatoes", "Value":"74%" }, { "Source":"Metacritic", "Value":"52/100" } ], "Metascore":"52", "imdbRating":"7.0", "imdbVotes":"160,136", "imdbID":"tt0099653", "Type":"movie", "DVD":"24 Apr 2001", "BoxOffice":"N/A", "Production":"Paramount Pictures", "Website":"N/A", "Response":"True" }

要发送您可以使用升压短耳或CPP-NETLIB(https://github.com/cpp-netlib/cpp-netlib

+0

哇,非常感谢。这正是我期待的! –