项目作者: devilking15292

项目描述 :
Imdb python api to get movie details
高级语言: Python
项目地址: git://github.com/devilking15292/IMDB_Api_python.git
创建时间: 2018-02-07T15:36:53Z
项目社区:https://github.com/devilking15292/IMDB_Api_python

开源协议:GNU General Public License v3.0

下载


IMDB_Api_python

PyPI

Install

  1. pip install IMDBAPI

windows

  1. py -m pip install IMDBAPI

with setup.py

  1. py setup.py install

API

getRating(movieName ):

  1. which returns the rating of the requsted movie by passing Movie Name as a parameter

getRatingByImdbId(IMDB_ID ):

  1. which returns the rating of the requsted movie by IMDB ID as a prameter

getDirector(movieName):

  1. which returns the Directors name of the requsted movie by passing Movie Name as a parameter

getDirectorByImdbId(IMDB_ID ):

  1. which returns the Directors name of the requsted movie by IMDB ID as a prameter

getCasting(movieName, length=10, all=False):

  1. which returns the cast list of the requsted movie by passing Movie Name as a parameter

length: No of castlist which will be returned (default “10”)

all: if set to True returns all the cast list (default “False”)

getCastingByImdbId(IMDB_ID , length=10, all=False):

  1. which returns the cast list of the requsted movie by IMDB ID as a prameter

length: No of castlist which will be returned (default “10”)

all: if set to True returns all the cast list (default “False”)

getSummary(movieName ):

  1. which returns the summary of the requsted movie by passing Movie Name as a parameter

getSummaryByImdbId(IMDB_ID ):

  1. which returns the summary of the requsted movie by IMDB ID as a prameter

getMovie(movieName ):

  1. which returns the an object with data of the requsted movie by passing Movie Name as a parameter (see getMovieByImdbId() for more deatails)

getMovieByImdbId(IMDB_ID ):

  1. which returns the data of the requsted movie by IMDB ID as a prameter, data is as follows
  2. title - Movie full tile
  3. runTime - duration of the movie
  4. titleYear - year of the movie title
  5. releaseDate - date of the movie
  6. gener - gener as an array
  7. posterUrl - url of the movie poster
  8. rating - rating of the movie
  9. summary - summary text
  10. director - name of the director
  11. casting - list of top 10 cast (can be tweaked to print all the casting)

Example

  1. from IMDBAPI import IMDB
  2. imdb = IMDB()
  3. print("Movie rated: "+imdb.getRating('darknight rises')+" out of 10")
  4. Movie: The Dark Knight Rises
  5. Movie rated: '8.4' out of 10
  6. Sample1.py output: (pretty printed just for viewing)
  7. Enter a movie: darknight rises
  8. Movie: The Dark Knight Rises
  9. Movie Rated: 8.4 out Of 10
  10. Movie: The Dark Knight Rises
  11. Summary: Eight years after the Joker's reign of anarchy, Batman, with the help of the enigmatic Catwoman, is forced from his exile to save Gotham City, now on the edge of total annihilation, from the brutal guerrilla terrorist Bane.
  12. Movie: The Dark Knight Rises
  13. Director: ChristopherNolan
  14. Movie: The Dark Knight Rises
  15. Cast_list size: 10
  16. {
  17. 'actor': 'Christian Bale',
  18. 'role': 'Bruce Wayne'
  19. } {
  20. 'actor': 'Gary Oldman',
  21. 'role': 'Commissioner Gordon'
  22. } {
  23. 'actor': 'Tom Hardy',
  24. 'role': 'Bane'
  25. } {
  26. 'actor': 'Joseph Gordon-Levitt',
  27. 'role': 'Blake'
  28. } {
  29. 'actor': 'Anne Hathaway',
  30. 'role': 'Selina'
  31. } {
  32. 'actor': 'Marion Cotillard',
  33. 'role': 'Miranda'
  34. } {
  35. 'actor': 'Morgan Freeman',
  36. 'role': 'Fox'
  37. } {
  38. 'actor': 'Michael Caine',
  39. 'role': 'Alfred'
  40. } {
  41. 'actor': 'Matthew Modine',
  42. 'role': 'Foley'
  43. } {
  44. 'actor': 'Alon Aboutboul',
  45. 'role': 'Dr. Pavel (as Alon Moni Aboutboul)'
  46. }
  47. Movie Details:
  48. Movie: The Dark Knight Rises
  49. {
  50. "title": "The Dark Knight Rises",
  51. "runTime": "2h44min",
  52. "titleYear": "2012",
  53. "releaseDate": "2012-07-20",
  54. "gener": ["Action", "Thriller"],
  55. "posterUrl": "https://m.media-amazon.com/images/M/MV5BMTk4ODQzNDY3Ml5BMl5BanBnXkFtZTcwODA0NTM4Nw@@._V1_UX182_CR0,0,182,268_AL__QL50.jpg",
  56. "rating ": "8.4 ",
  57. "summary ": "Eight years after the Joker 's reign of anarchy,Batman with the help of the enigmatic Catwoman,is forced from his exile to save Gotham City",
  58. "director ": "ChristopherNolan ",
  59. "casting ": [{
  60. 'actor': 'Christian Bale',
  61. 'role': 'Bruce Wayne'
  62. }, {
  63. 'actor': 'Gary Oldman',
  64. 'role': 'Commissioner Gordon'
  65. }, {
  66. 'actor': 'Tom Hardy',
  67. 'role': 'Bane'
  68. }, {
  69. 'actor': 'Joseph Gordon-Levitt',
  70. 'role': 'Blake'
  71. }, {
  72. 'actor': 'Anne Hathaway',
  73. 'role': 'Selina'
  74. }, {
  75. 'actor': 'Marion Cotillard',
  76. 'role': 'Miranda'
  77. }, {
  78. 'actor': 'Morgan Freeman',
  79. 'role': 'Fox'
  80. }, {
  81. 'actor': 'Michael Caine',
  82. 'role': 'Alfred'
  83. }, {
  84. 'actor': 'Matthew Modine',
  85. 'role': 'Foley'
  86. }, {
  87. 'actor': 'Alon Aboutboul',
  88. 'role': 'Dr. Pavel (as Alon Moni Aboutboul)'
  89. }
  90. ]
  91. }

IMDB_ID :

  1. is an unique ID given by IMDB to a movie or series or a celebrity, IMDB_ID can be found in the URL.
  2. if you open IMDB for a movie, say "The Dark night rises" the URL will be "https://www.imdb.com/title/tt1345836/"
  3. this last text "tt1345836" is the IMDB ID of the movie