The Movie Database-ondersteuning

Sorry for my novice understanding, but I'm trying to get a simple listing of movie details from 2004 with a specific genre using python. I've referenced the developers.themoviedb.org section for support on this but can't get it to work. Any suggested approaches or resources where I can get some help?

3 antwoorden (op pagina 1 van 1)

Jump to last post

In order for someone to help you with API Request questions, it is critical that you post here the API Request you are using / creating / building.
Remember to replace your Key with [MY_KEY].

What I can anticipate is that it will probably be a two-step operation.
The first step will be to search for and receive the list of movies that fit your criteria / filter.
https://developers.themoviedb.org/3/discover/movie-discover
The second step, now with the IDs, will be to get the details of each movie.
https://developers.themoviedb.org/3/movies/get-movie-details


First of all, you need to know what the ID of each genre is.
https://developers.themoviedb.org/3/genres/get-movie-list
For this you need to have the list that can be received with the following Requisition:
https://api.themoviedb.org/3/genre/movie/list?api_key=[MY_KEY]&language=en-US
For example Comedy = 35


Example for first step:
https://api.themoviedb.org/3/discover/movie?api_key=[MY_KEY]&language=en-US&sort_by=original_title.asc&page=1&primary_release_year=2004&with_genres=35
And you will get something like that:

{
  "page": 1,
  "total_results": 1125,
  "total_pages": 57,
  "results": [
    {
      "vote_count": 204,
      "id": 9805,
      "video": false,
      "vote_average": 6.3,
      "title": "Dreamship Surprise - Period 1",
      "popularity": 7.289,
      "poster_path": "/w4EZC3GeNwLNo5KNkj4QLOWyGII.jpg",
      "original_language": "de",
      "original_title": "(T)Raumschiff Surprise - Periode 1",
      "genre_ids": [
        35,
        878
      ],
      "backdrop_path": "/A41kszh8uig7nWIAgEFdY6MzrLx.jpg",
      "adult": false,
      "overview": "Hundreds of years after humans have settled on Mars, Regulator Rogul and Lord Jens Maul, lead a force of Martians to Earth in order to conquer the planet. Queen Metaphor looks to the gay heroes aboard the spaceship Surprise -- Captain Kork, Mr. Spuck, and first engineer Schrotty",
      "release_date": "2004-07-14"
    },
    {
      "vote_count": 9,
      "id": 59700,
      "video": false,
      "vote_average": 5.4,
      "title": "12 Days of Christmas Eve",
      "popularity": 1.4,
      "poster_path": "/bz9uNLaf9mzopYT6aw6iuCT8E4L.jpg",
      "original_language": "en",
      "original_title": "12 Days of Christmas Eve",
      "genre_ids": [
        10770,
        10751,
        14,
        35,
        18
      ],
      "backdrop_path": "/cUd2qXmRzJEqNcn1XQcGu3CSo3y.jpg",
      "adult": false,
      "overview": "Calvin Carter, a successful business executive, has it all, but neglects those closest to him. On Christmas Eve, all that changes when the sign on his office building falls on him. He awakes in a hospital bed, attended to by Angie, a nurse who soon lets him know he has 12 days (12 chances) to get his act together and achieve the \"perfect\" Christmas Eve. If he doesn't, there will be dire consequences.",
      "release_date": "2004-12-07"
    },
    {
      "vote_count": 2354,
      "id": 10096,
      "video": false,
      "vote_average": 6.5,
      "title": "13 Going on 30",
      "popularity": 9.725,
      "poster_path": "/iSvz2Nk1vzgm7bEMqMazhQ1F3zA.jpg",
      "original_language": "en",
      "original_title": "13 Going on 30",
      "genre_ids": [
        35,
        14,
        10749
      ],
      "backdrop_path": "/1sJoLA3bjKvblPh7GR9URBWZsDO.jpg",

    etc...
    etc...
    etc...

If the details you want did not come in this answer then you will have to make a Request for each ID to receive the details you want.

Thanks for the reply. I was able to work through it by trial and error. The resulting request ended up as follows:

payload = "{}"
URL="/3/discover/movie?with_genres=35&primary_release_year=2004&page=1&language=en-US&api_key=&sort_by=popularity.desc"
conn.request("GET", URL, payload)
res = conn.getresponse()
data = res.read()

I can only help in this part of what you posted:
/3/discover/movie?with_genres=35&primary_release_year=2004&page=1&language=en-US&api_key=&sort_by=popularity.desc
And I think it does not meet the requirements. Compare with the one I posted:

https://api.themoviedb.org/3/discover/movie?api_key=[MY_KEY]&language=en-US&sort_by=original_title.asc&page=1&primary_release_year=2004&with_genres=35  
_________________________/3/discover/movie?with_genres=35&primary_release_year=2004&page=1&language=en-US&api_key=[MY_KEY]&sort_by=popularity.desc

I added the beginning to yours and tested it.
https://api.themoviedb.org/3/discover/movie?with_genres=35&primary_release_year=2004&page=1&language=en-US&api_key=[MY_KEY]&sort_by=popularity.desc
The result is the same as mine. So I think it's settled .

Film of tv-serie niet gevonden? Log dan in om deze te creëren.

Wereldwijd

s focus op zoekbalk
p open profielmenu
esc sluit een open venster
? open sneltoetsen venster

Op media pagina's

b ga terug (of ga naar bovenliggend item)
e ga naar beweken

Op TV seizoenspagina's

(rechter pijl) ga naar volgende seizoen
(linker pijl) ga naar vorig seizoen

Op pagina's met TV-programma's

(rechter pijl) ga naar volgende aflevering
(linker pijl) ga naar vorige aflevering

Op alle afbeeldingspagina's

a open venster afbeelding toevoegen

Op alle bewerkte pagina's

t open vertaalmenu
ctrl+ s verstuur formulier

Op discussiepagina's

n start nieuwe discussie
w Verander kijk status
p privé of openbaar
c gesloten of open
a open activiteit
r beantwoord discussie
l ga naar laatste antwoord
ctrl+ enter verstuur uw bericht
(rechter pijl) volgende pagina
(linker pijl) vorige pagina

Instellingen

Want to rate or add this item to a list?

Inloggen