Does IMDB provide an API? [closed]

2018-12-31 08:57发布

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?

19条回答
旧人旧事旧时光
2楼-- · 2018-12-31 09:24

new api @ http://www.omdbapi.com

edit: due to legal issues had to move the service to a new domain :)

查看更多
浅入江南
3楼-- · 2018-12-31 09:28

that deanclatworthy still seems to work and there's another one: http://imdbapi.poromenos.org/

查看更多
看淡一切
4楼-- · 2018-12-31 09:28

If you want movie details api you can consider

OMDB API which is Open movies Database Returns IBDB Rating, IMDB Votes and you can include Rotten Tomato rating too.

Or else You can use

My Api Films which allows you to search with IMDB ID and returns detailed information but it has request limits.

查看更多
素衣白纱
5楼-- · 2018-12-31 09:30

ok i found this one IMDB scraper

for C#: http://web3o.blogspot.de/2010/11/aspnetc-imdb-scraping-api.html

PHP here: http://web3o.blogspot.de/2010/10/php-imdb-scraper-for-new-imdb-template.html

alternatively a imdbapi.org implementation for c#:

using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Xml.Linq;
using HtmlAgilityPack; // http://htmlagilitypack.codeplex.com/


public class IMDBHelper
{

    public static imdbitem GetInfoByTitle(string Title)
    {
        string url = "http://imdbapi.org/?type=xml&limit=1&title=" + Title;
        HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
        req.Method = "GET";
        req.UserAgent = "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))";
        string source;
        using (StreamReader reader = new StreamReader(req.GetResponse().GetResponseStream()))
        {
            source = reader.ReadToEnd();
        }
        HtmlDocument doc = new HtmlDocument();
        doc.LoadHtml(source);        
        XDocument xdoc = XDocument.Parse(doc.DocumentNode.InnerHtml, LoadOptions.None);
        imdbitem i = new imdbitem();
        i.rating = xdoc.Descendants("rating").Select(x => x.Value).FirstOrDefault();
        i.rating_count = xdoc.Descendants("rating_count").Select(x => x.Value).FirstOrDefault();
        i.year = xdoc.Descendants("year").Select(x => x.Value).FirstOrDefault();
        i.rated = xdoc.Descendants("rated").Select(x => x.Value).FirstOrDefault();
        i.title = xdoc.Descendants("title").Select(x => x.Value).FirstOrDefault();
        i.imdb_url = xdoc.Descendants("imdb_url").Select(x => x.Value).FirstOrDefault();
        i.plot_simple = xdoc.Descendants("plot_simple").Select(x => x.Value).FirstOrDefault();
        i.type = xdoc.Descendants("type").Select(x => x.Value).FirstOrDefault();
        i.poster = xdoc.Descendants("poster").Select(x => x.Value).FirstOrDefault();
        i.imdb_id = xdoc.Descendants("imdb_id").Select(x => x.Value).FirstOrDefault();
        i.also_known_as = xdoc.Descendants("also_known_as").Select(x => x.Value).FirstOrDefault();
        i.language = xdoc.Descendants("language").Select(x => x.Value).FirstOrDefault();
        i.country = xdoc.Descendants("country").Select(x => x.Value).FirstOrDefault();
        i.release_date = xdoc.Descendants("release_date").Select(x => x.Value).FirstOrDefault();
        i.filming_locations = xdoc.Descendants("filming_locations").Select(x => x.Value).FirstOrDefault();
        i.runtime = xdoc.Descendants("runtime").Select(x => x.Value).FirstOrDefault();
        i.directors = xdoc.Descendants("directors").Descendants("item").Select(x => x.Value).ToList();
        i.writers = xdoc.Descendants("writers").Descendants("item").Select(x => x.Value).ToList();
        i.actors = xdoc.Descendants("actors").Descendants("item").Select(x => x.Value).ToList();
        i.genres = xdoc.Descendants("genres").Descendants("item").Select(x => x.Value).ToList();
        return i;
    }

    public class imdbitem
    {
        public string rating { get; set; }
        public string rating_count { get; set; }
        public string year { get; set; }
        public string rated { get; set; }
        public string title { get; set; }
        public string imdb_url { get; set; }
        public string plot_simple { get; set; }
        public string type { get; set; }
        public string poster { get; set; }
        public string imdb_id { get; set; }
        public string also_known_as { get; set; }
        public string language { get; set; }
        public string country { get; set; }
        public string release_date { get; set; }
        public string filming_locations { get; set; }
        public string runtime { get; set; }
        public List<string> directors { get; set; }
        public List<string> writers { get; set; }
        public List<string> actors { get; set; }
        public List<string> genres { get; set; }
    }

}
查看更多
与君花间醉酒
6楼-- · 2018-12-31 09:32

There is a JSON API for use by mobile applications at http://app.imdb.com

However, the warning is fairly severe:

For use only by clients authorized in writing by IMDb.
Authors and users of unauthorized clients accept full legal exposure/liability for their actions.

I presume this is for those developers that pay for the licence to access the data via their API.

EDIT: Just for kicks, I wrote a client library to attempt to read the data from the API, you can find it here: api-imdb

Obviously, you should pay attention to the warning, and really, use something like TheMovieDB as a better and more open database.

Then you can use this Java API wrapper (that I wrote): api-themoviedb

查看更多
冷夜・残月
7楼-- · 2018-12-31 09:34

IMDB themselves seem to distribute data, but only in text files:

http://www.imdb.com/interfaces

there are several APIs around this that you can Google. Screen scraping is explicitly forbidden. A official API seems to be in the works, but has been that for years already.

查看更多
登录 后发表回答