IMDbPY get the stars of a movie
Question: I was able to get the cast of the movie like this:

    
    
    #!/usr/bin/env python
    import imdb
    ia = imdb.IMDb()
    s_result = ia.search_movie('The Untouchables')
    the_unt = s_result[0]
    print the_unt['cast']
    

However, that gave all the _cast_ , i am looking for just the _stars_ of the
movie. for example, al pacino is a star in god father


Answer: As stated in the comments, IMDb does not know the concept of a "star", but it
does somewhat know the "top actors" from the cast lineup.

It is probably based on the credits of the film, but even IMDb says _first
billed only_ for some movies.

The cast ordering is entirely dependent on the movie and who verifies the data
on IMDb. If it says "credits order", that means "in the order they were
introduced in the film credits", **but** , the credit ordering could be some
arbitrary ordering that the director of the film felt like placing them in.

For example, some films say "And introducing... (some actor no one knows
about)" or like a TV Show says "Special Guest Star... (someone most people
recognize)". In both cases, those are either before / after the entire regular
cast is introduced.

* * *

So, if you wanted the top 5 actors for a given film, you could do something
like this

    
    
    import imdb
    ia = imdb.IMDb()
    search_results = ia.search_movie('The Godfather')
    
    if search_results:
         movieID = search_results[0].movieID
         movie = ia.get_movie(movieID)
         if movie:
             cast = movie.get('cast')
             topActors = 5
             for actor in cast[:topActors]:
                 print "{0} as {1}".format(actor['name'], actor.currentRole)
    

Output

    
    
    Marlon Brando as Don Vito Corleone
    Al Pacino as Michael Corleone
    James Caan as Sonny Corleone
    Richard S. Castellano as Clemenza
    Robert Duvall as Tom Hagen
    

