5

I have done extensive research and found that I couldn't find an API. Is there any available API to get the TOP 250 list?

Or another way to get access to the list?

I tried accessing the page HTML and parsing in my JSP backend. But the problem here is that I get only a skeleton, the list loads as AJAX.

Any way of web scraping it?

Any usage Idea would be appreciated...

vivek_jonam
  • 3,237
  • 8
  • 32
  • 44

5 Answers5

6

The easiest way is to just download the data from the IMDb alternate interfaces.

The file you want is ratings.list.gz. The Top 250 films are listed in the first section.

David Chappelle
  • 1,243
  • 5
  • 13
  • 29
  • 1
    I believe they are updated weekly. And the top 250 movies would not change very much day to day, anyway. – David Chappelle Mar 26 '13 at 13:41
  • I have written a script that converts all the `.list.gz` files to JSON which should make it easier to work with: https://github.com/oxplot/imdb2json – Mansour Oct 31 '15 at 01:23
  • Mansour: those files are enormous already, and I'd guess JSON is even larger due to the tags for formatting. What most people do is load them into a relational database for queries. I have done this for SQL Server and others have written a parser for python/mysql. – David Chappelle Nov 02 '15 at 13:37
2

Yes now there is a API called the omdbapi

http://www.omdbapi.com/
Jaysheel Utekar
  • 1,171
  • 1
  • 19
  • 37
1

I came across this problem too and I solved it with some scraping. Here is the Python code:

import requests
import re

top250_url = "http://akas.imdb.com/chart/top"


def get_top250():
    r = requests.get(top250_url)
    html = r.text.split("\n")
    result = []
    for line in html:
        line = line.rstrip("\n")
        m = re.search(r'data-titleid="tt(\d+?)">', line)
        if m:
            _id = m.group(1)
            result.append(_id)
    #
    return result

It returns the IMDb IDs of the Top 250 movies. Then, using the imdbpy package you can ask all the information about a movie, since you have the movie ID.

Jabba
  • 19,598
  • 6
  • 52
  • 45
0

Available from there:

http://api.myapifilms.com/imdb.do

Get url for it is there: (You'll need a free token)

 http://api.myapifilms.com/imdb/top?token=GET A FREE API KEY&format=json&data=0

(Not my site)

Callombert
  • 1,099
  • 14
  • 38
0

https://www.theimdbapi.com/ this one is great, i am usng from sometime now

Chali
  • 1,100
  • 3
  • 12
  • 18