我最近发现了一个从IMDB数据库获取数据的电影管理应用程序。
IMDB是否为此提供API,或任何可用的第三方API ?
我最近发现了一个从IMDB数据库获取数据的电影管理应用程序。
IMDB是否为此提供API,或任何可用的第三方API ?
当前回答
IMDb有一个公共API,虽然没有文档记载,但是快速可靠(在官方网站上通过AJAX使用)。
搜索建议API
https://sg.media-imdb.com/suggests/h/hello.json https://v2.sg.media-imdb.com/suggests/h/hello.json (as of 2019) Format: JSON-P Caveat: It's in JSON-P format, and the callback parameter can not customised. To use it cross-domain you'll have to use their function name for the callback (which is in the imdb${searchphrase} format). Alternatively, one could strip or replace the padding via a local proxy. https://v2.sg.media-imdb.com/suggestion/h/hello.json (as of 2020) Format: JSON Caveat: It's not CORS-enabled. This is fine for use in apps and server-side scripts. For use in a web app, you'll need to route it through a simple proxy (and consider enabling caching, too!)
// 1) Vanilla JavaScript (JSON-P)
function addScript(src) { var s = document.createElement('script'); s.src = src; document.head.appendChild(s); }
window.imdb$foo = function (results) {
/* ... */
};
addScript('https://sg.media-imdb.com/suggests/f/foo.json');
// 2) Using jQuery (JSON-P)
jQuery.ajax({
url: 'https://sg.media-imdb.com/suggests/f/foo.json',
dataType: 'jsonp',
cache: true,
jsonp: false,
jsonpCallback: 'imdb$foo'
}).then(function (results) {
/* ... */
});
// 3) Pure JSON (with jQuery)
// Use a local proxy to the clean `/suggestion` API.
jQuery.getJSON('/api/imdb/?q=foo', function (results) {
/* ... */
});
// 4) Pure JSON (plain JavaScript; Modern ES6, ES2017, and Fetch API)
// Serve a "/api" route in your app, that proxies (and caches!)
// to v2.sg.media-imdb.com/suggestion/h/hello.json
const resp = await fetch('/api/imdb/?q=foo');
const results = await resp.json();
高级搜索
名称搜索(json): http://www.imdb.com/xml/find?json=1&nr=1&nm=on&q=jeniffer+garner 标题搜索(xml): http://www.imdb.com/xml/find?xml=1&nr=1&tt=on&q=lost 格式:XML 优点:同时支持电影名称和演员名称(与建议API不同)。
请注意,这些api是非官方的,随时都可能更改!
更新(2019年1月):高级API不再存在。好消息是,建议API现在支持“高级”功能,即通过电影名称和演员名称进行搜索。
其他回答
NetFilx更多的是个性化的媒体服务,但你也可以用它来提供有关电影的公共信息。它支持Javascript和OData。 还可以查看JMDb:这些信息基本上与使用IMDb网站时获得的信息相同。
那么TMDb API呢?
您可以使用GET /find/{external_id}通过imdb_id进行搜索
https://developers.themoviedb.org/3/find/find-by-id
另一个获取电影信息的合法选择是烂番茄API(由Fandango提供)。
新火@ http://www.omdbapi.com
编辑:由于法律问题不得不将服务转移到一个新的域名:)
https://deanclatworthy.com/tools.html是一个IMDB API,但由于滥用已经关闭。