I recently found a movie organizer application which fetches its data from the IMDB database.
Does IMDB provide an API for this, or any third party APIs available?
The IMDb has a public API that, although undocumented, is fast and reliable (used on the official website through AJAX).
imdb${searchphrase}
format). Alternatively, one could strip or replace the padding via a local proxy.// 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 that strips the "padding" of JSON-P,
// e.g. "imdb$foo(" and ")", leaving pure JSON only.
jQuery.getJSON('/api/imdb/?q=foo', function (results) {
/* ... */
});
// 4) Pure JSON (ES2017 and Fetch API)
// Using a custom proxy at "/api" that strips the JSON-P padding.
const resp = await fetch('/api/imdb/?q=foo');
const results = await resp.json();