Assistance de TMDB

Hi,

Having my first play with the API and have found a problem that I can't see mentioned in the documentation anywhere.

I am trying to use the API to retrieve the latest movie a user rated, but the problem is that the rated movies aren't coming back in the same order each time. I was hoping they would come back in the order they were rated, but it doesn't seem to be, and nor does there appear to be any logic in how they are ordered as when you refresh it, it can be different.

For example with the request http://api.themoviedb.org/3/account/LevysFace/rated_movies?api_key=XXXX&session_id=YYY&sort_by=created_at

On first attempt I got the following:

{"page":1,"results":[{"adult":false,"backdrop_path":"/mbiOyoOhVVgQ8nqIbMDwklqvvuW.jpg","id":329,"original_title":"Jurassic Park","release_date":"1993-06-08","poster_path":"/jdS21ipvYzLHqeVuLZrMxSUZsZ9.jpg","popularity":5.52003842235647,"title":"Jurassic Park","vote_average":7.0,"vote_count":457,"rating":9.5},{"adult":false,"backdrop_path":"/22DQWwjaam1LHTAEapxO2Wg7s2H.jpg","id":47964,"original_title":"A Good Day to Die Hard","release_date":"2013-02-14","poster_path":"/c2SQMd00CCGTiDxGXVqA2J9lmzF.jpg","popularity":25.4288388673309,"title":"A Good Day to Die Hard","vote_average":5.2,"vote_count":949,"rating":2.0},{"adult":false,"backdrop_path":"/hbn46fQaRmlpBuUrEiFqv0GDL6Y.jpg","id":24428,"original_title":"The Avengers","release_date":"2012-05-04","poster_path":"/cezWGskPY5x7GaglTTRN4Fugfb8.jpg","popularity":14.4544686726208,"title":"The Avengers","vote_average":7.1,"vote_count":1987,"rating":10.0},{"adult":false,"backdrop_path":"/rRhoMIqgdX9wEtRUOLsqXKkH9I0.jpg","id":70981,"original_title":"Prometheus","release_date":"2012-06-07","poster_path":"/idXq7NctkwoH59DRAIQlHEPtn95.jpg","popularity":12.962345374753,"title":"Prometheus","vote_average":6.1,"vote_count":782,"rating":5.5},{"adult":false,"backdrop_path":"/5XPPB44RQGfkBrbJxmtdndKz05n.jpg","id":19995,"original_title":"Avatar","release_date":"2009-12-15","poster_path":"/8Ic8rRVoVrDJJlXzVzGxAesufUV.jpg","popularity":12.2318794497128,"title":"Avatar","vote_average":7.1,"vote_count":2255,"rating":0.5},{"adult":false,"backdrop_path":"/7NhgUfvLRkE7rWWaAbeqihiQTQs.jpg","id":72190,"original_title":"World War Z","release_date":"2013-06-21","poster_path":"/nVfFmQEjf7i0bkxFg3py4bwQmry.jpg","popularity":47.3452768895967,"title":"World War Z","vote_average":6.2,"vote_count":187,"rating":7.5},{"adult":false,"backdrop_path":"/jjAq3tCezdlQduusgtMhpY2XzW0.jpg","id":49051,"original_title":"The Hobbit: An Unexpected Journey","release_date":"2012-12-12","poster_path":"/h1XjBJoWdOh8aegBoVYKgABQZSL.jpg","popularity":39.1547146455406,"title":"The Hobbit: An Unexpected Journey","vote_average":6.6,"vote_count":1644,"rating":6.5},{"adult":false,"backdrop_path":"/txNuyfTR6wr9j3aCpDRucW0E7pB.jpg","id":72710,"original_title":"The Host","release_date":"2013-03-26","poster_path":"/jnPOLAPQLhqMeDLV2BsQfrd6R11.jpg","popularity":24.6898054740569,"title":"The Host","vote_average":6.2,"vote_count":114,"rating":4.0},{"adult":false,"backdrop_path":"/qUcmEqnzIwlwZxSyTf3WliSfAjJ.jpg","id":68718,"original_title":"Django Unchained","release_date":"2012-12-25","poster_path":"/5WJnxuw41sddupf8cwOxYftuvJG.jpg","popularity":13.6069589768497,"title":"Django Unchained","vote_average":7.3,"vote_count":1837,"rating":9.0}],"total_pages":1,"total_results":9}

It then returned the same thing for half a dozen refreshed, but then on the next refresh, it returned the following, which is in a totally different order:

{"page":1,"results":[{"adult":false,"backdrop_path":"/5XPPB44RQGfkBrbJxmtdndKz05n.jpg","id":19995,"original_title":"Avatar","release_date":"2009-12-15","poster_path":"/8Ic8rRVoVrDJJlXzVzGxAesufUV.jpg","popularity":12.2318794497128,"title":"Avatar","vote_average":7.1,"vote_count":2255,"rating":0.5},{"adult":false,"backdrop_path":"/7NhgUfvLRkE7rWWaAbeqihiQTQs.jpg","id":72190,"original_title":"World War Z","release_date":"2013-06-21","poster_path":"/nVfFmQEjf7i0bkxFg3py4bwQmry.jpg","popularity":47.3452768895967,"title":"World War Z","vote_average":6.2,"vote_count":187,"rating":7.5},{"adult":false,"backdrop_path":"/jjAq3tCezdlQduusgtMhpY2XzW0.jpg","id":49051,"original_title":"The Hobbit: An Unexpected Journey","release_date":"2012-12-12","poster_path":"/h1XjBJoWdOh8aegBoVYKgABQZSL.jpg","popularity":39.1547146455406,"title":"The Hobbit: An Unexpected Journey","vote_average":6.6,"vote_count":1644,"rating":6.5},{"adult":false,"backdrop_path":"/txNuyfTR6wr9j3aCpDRucW0E7pB.jpg","id":72710,"original_title":"The Host","release_date":"2013-03-26","poster_path":"/jnPOLAPQLhqMeDLV2BsQfrd6R11.jpg","popularity":24.6898054740569,"title":"The Host","vote_average":6.2,"vote_count":114,"rating":4.0},{"adult":false,"backdrop_path":"/qUcmEqnzIwlwZxSyTf3WliSfAjJ.jpg","id":68718,"original_title":"Django Unchained","release_date":"2012-12-25","poster_path":"/5WJnxuw41sddupf8cwOxYftuvJG.jpg","popularity":13.6069589768497,"title":"Django Unchained","vote_average":7.3,"vote_count":1837,"rating":9.0},{"adult":false,"backdrop_path":"/mbiOyoOhVVgQ8nqIbMDwklqvvuW.jpg","id":329,"original_title":"Jurassic Park","release_date":"1993-06-08","poster_path":"/jdS21ipvYzLHqeVuLZrMxSUZsZ9.jpg","popularity":5.52003842235647,"title":"Jurassic Park","vote_average":7.0,"vote_count":457,"rating":9.5},{"adult":false,"backdrop_path":"/22DQWwjaam1LHTAEapxO2Wg7s2H.jpg","id":47964,"original_title":"A Good Day to Die Hard","release_date":"2013-02-14","poster_path":"/c2SQMd00CCGTiDxGXVqA2J9lmzF.jpg","popularity":25.4288388673309,"title":"A Good Day to Die Hard","vote_average":5.2,"vote_count":949,"rating":2.0},{"adult":false,"backdrop_path":"/hbn46fQaRmlpBuUrEiFqv0GDL6Y.jpg","id":24428,"original_title":"The Avengers","release_date":"2012-05-04","poster_path":"/cezWGskPY5x7GaglTTRN4Fugfb8.jpg","popularity":14.4544686726208,"title":"The Avengers","vote_average":7.1,"vote_count":1987,"rating":10.0},{"adult":false,"backdrop_path":"/rRhoMIqgdX9wEtRUOLsqXKkH9I0.jpg","id":70981,"original_title":"Prometheus","release_date":"2012-06-07","poster_path":"/idXq7NctkwoH59DRAIQlHEPtn95.jpg","popularity":12.962345374753,"title":"Prometheus","vote_average":6.1,"vote_count":782,"rating":5.5}],"total_pages":1,"total_results":9}

Is there any way to get a more consistent result from this?

Cheers

Pete

4 réponses (sur la page 1 sur 1)

Jump to last post

Are you setting a sort_order param? It doesn't look like it, try this:

http://api.themoviedb.org/3/account/LevysFace/rated_movies?api_key=###&session_id=###&sort_by=created_at&sort_order=desc

I'm seeing consistent results with this.

Thanks for the reply. I wasn't using that parameter, but I am now. Unfortunately it doesn't seem to have helped though, I'm still getting inconsistent results.

For example, for my first 28 refreshes I got the following (which I think is the correct order):

{"page":1,"results":[{"adult":false,"backdrop_path":"/5bKy4O0WQTa3MG2wPWViUNUTIEG.jpg","id":82992,"original_title":"Fast & Furious 6","release_date":"2013-05-24","poster_path":"/3Izae8UATwSHizQiEVZEWf53wjM.jpg","popularity":26.8458140459715,"title":"Fast & Furious 6","vote_average":6.4,"vote_count":930,"rating":6.5},{"adult":false,"backdrop_path":"/qUcmEqnzIwlwZxSyTf3WliSfAjJ.jpg","id":68718,"original_title":"Django Unchained","release_date":"2012-12-25","poster_path":"/5WJnxuw41sddupf8cwOxYftuvJG.jpg","popularity":13.6069589768497,"title":"Django Unchained","vote_average":7.3,"vote_count":1837,"rating":9.0},{"adult":false,"backdrop_path":"/txNuyfTR6wr9j3aCpDRucW0E7pB.jpg","id":72710,"original_title":"The Host","release_date":"2013-03-26","poster_path":"/jnPOLAPQLhqMeDLV2BsQfrd6R11.jpg","popularity":24.6898054740569,"title":"The Host","vote_average":6.2,"vote_count":114,"rating":4.0},{"adult":false,"backdrop_path":"/jjAq3tCezdlQduusgtMhpY2XzW0.jpg","id":49051,"original_title":"The Hobbit: An Unexpected Journey","release_date":"2012-12-12","poster_path":"/h1XjBJoWdOh8aegBoVYKgABQZSL.jpg","popularity":39.1547146455406,"title":"The Hobbit: An Unexpected Journey","vote_average":6.6,"vote_count":1648,"rating":6.5},{"adult":false,"backdrop_path":"/7NhgUfvLRkE7rWWaAbeqihiQTQs.jpg","id":72190,"original_title":"World War Z","release_date":"2013-06-21","poster_path":"/nVfFmQEjf7i0bkxFg3py4bwQmry.jpg","popularity":47.3452768895967,"title":"World War Z","vote_average":6.2,"vote_count":187,"rating":7.5},{"adult":false,"backdrop_path":"/5XPPB44RQGfkBrbJxmtdndKz05n.jpg","id":19995,"original_title":"Avatar","release_date":"2009-12-15","poster_path":"/8Ic8rRVoVrDJJlXzVzGxAesufUV.jpg","popularity":12.2318794497128,"title":"Avatar","vote_average":7.1,"vote_count":2255,"rating":0.5},{"adult":false,"backdrop_path":"/rRhoMIqgdX9wEtRUOLsqXKkH9I0.jpg","id":70981,"original_title":"Prometheus","release_date":"2012-06-07","poster_path":"/idXq7NctkwoH59DRAIQlHEPtn95.jpg","popularity":12.962345374753,"title":"Prometheus","vote_average":6.1,"vote_count":785,"rating":5.5},{"adult":false,"backdrop_path":"/hbn46fQaRmlpBuUrEiFqv0GDL6Y.jpg","id":24428,"original_title":"The Avengers","release_date":"2012-05-04","poster_path":"/cezWGskPY5x7GaglTTRN4Fugfb8.jpg","popularity":14.4544686726208,"title":"The Avengers","vote_average":7.1,"vote_count":1989,"rating":10.0},{"adult":false,"backdrop_path":"/22DQWwjaam1LHTAEapxO2Wg7s2H.jpg","id":47964,"original_title":"A Good Day to Die Hard","release_date":"2013-02-14","poster_path":"/c2SQMd00CCGTiDxGXVqA2J9lmzF.jpg","popularity":25.4288388673309,"title":"A Good Day to Die Hard","vote_average":5.2,"vote_count":949,"rating":2.0},{"adult":false,"backdrop_path":"/mbiOyoOhVVgQ8nqIbMDwklqvvuW.jpg","id":329,"original_title":"Jurassic Park","release_date":"1993-06-08","poster_path":"/jdS21ipvYzLHqeVuLZrMxSUZsZ9.jpg","popularity":5.52003842235647,"title":"Jurassic Park","vote_average":7.0,"vote_count":458,"rating":9.5}],"total_pages":1,"total_results":10}

Then on the 29th refresh I got this, which is not the order the films were rated in:

{"page":1,"results":[{"adult":false,"backdrop_path":"/5bKy4O0WQTa3MG2wPWViUNUTIEG.jpg","id":82992,"original_title":"Fast & Furious 6","release_date":"2013-05-24","poster_path":"/3Izae8UATwSHizQiEVZEWf53wjM.jpg","popularity":26.8458140459715,"title":"Fast & Furious 6","vote_average":6.4,"vote_count":930,"rating":6.5},{"adult":false,"backdrop_path":"/qUcmEqnzIwlwZxSyTf3WliSfAjJ.jpg","id":68718,"original_title":"Django Unchained","release_date":"2012-12-25","poster_path":"/5WJnxuw41sddupf8cwOxYftuvJG.jpg","popularity":13.6069589768497,"title":"Django Unchained","vote_average":7.3,"vote_count":1837,"rating":9.0},{"adult":false,"backdrop_path":"/txNuyfTR6wr9j3aCpDRucW0E7pB.jpg","id":72710,"original_title":"The Host","release_date":"2013-03-26","poster_path":"/jnPOLAPQLhqMeDLV2BsQfrd6R11.jpg","popularity":24.6898054740569,"title":"The Host","vote_average":6.2,"vote_count":114,"rating":4.0},{"adult":false,"backdrop_path":"/rRhoMIqgdX9wEtRUOLsqXKkH9I0.jpg","id":70981,"original_title":"Prometheus","release_date":"2012-06-07","poster_path":"/idXq7NctkwoH59DRAIQlHEPtn95.jpg","popularity":12.962345374753,"title":"Prometheus","vote_average":6.1,"vote_count":785,"rating":5.5},{"adult":false,"backdrop_path":"/hbn46fQaRmlpBuUrEiFqv0GDL6Y.jpg","id":24428,"original_title":"The Avengers","release_date":"2012-05-04","poster_path":"/cezWGskPY5x7GaglTTRN4Fugfb8.jpg","popularity":14.4544686726208,"title":"The Avengers","vote_average":7.1,"vote_count":1989,"rating":10.0},{"adult":false,"backdrop_path":"/22DQWwjaam1LHTAEapxO2Wg7s2H.jpg","id":47964,"original_title":"A Good Day to Die Hard","release_date":"2013-02-14","poster_path":"/c2SQMd00CCGTiDxGXVqA2J9lmzF.jpg","popularity":25.4288388673309,"title":"A Good Day to Die Hard","vote_average":5.2,"vote_count":949,"rating":2.0},{"adult":false,"backdrop_path":"/mbiOyoOhVVgQ8nqIbMDwklqvvuW.jpg","id":329,"original_title":"Jurassic Park","release_date":"1993-06-08","poster_path":"/jdS21ipvYzLHqeVuLZrMxSUZsZ9.jpg","popularity":5.52003842235647,"title":"Jurassic Park","vote_average":7.0,"vote_count":458,"rating":9.5},{"adult":false,"backdrop_path":"/jjAq3tCezdlQduusgtMhpY2XzW0.jpg","id":49051,"original_title":"The Hobbit: An Unexpected Journey","release_date":"2012-12-12","poster_path":"/h1XjBJoWdOh8aegBoVYKgABQZSL.jpg","popularity":39.1547146455406,"title":"The Hobbit: An Unexpected Journey","vote_average":6.6,"vote_count":1648,"rating":6.5},{"adult":false,"backdrop_path":"/7NhgUfvLRkE7rWWaAbeqihiQTQs.jpg","id":72190,"original_title":"World War Z","release_date":"2013-06-21","poster_path":"/nVfFmQEjf7i0bkxFg3py4bwQmry.jpg","popularity":47.3452768895967,"title":"World War Z","vote_average":6.2,"vote_count":187,"rating":7.5},{"adult":false,"backdrop_path":"/5XPPB44RQGfkBrbJxmtdndKz05n.jpg","id":19995,"original_title":"Avatar","release_date":"2009-12-15","poster_path":"/8Ic8rRVoVrDJJlXzVzGxAesufUV.jpg","popularity":12.2318794497128,"title":"Avatar","vote_average":7.1,"vote_count":2255,"rating":0.5}],"total_pages":1,"total_results":10}

Cheers

Pete

Hey Pete,

Not sure then. I've created a new ticket for this here but I'm in the middle of some fairly large features and won't likely find time for this in the next few weeks.

Thanks for spotting the issue.

No worries, thanks for looking into it Travis.

Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.

Général

s Mettre le curseur dans la barre de recherche
p Ouvrir le menu du profil
esc Fermer une fenêtre ouverte
? Ouvrir la fenêtre des raccourcis clavier

Sur les pages des médias

b Retour (ou vers le parent si faisable)
e Afficher la page de modification

Sur les pages des saisons des émissions télévisées

Afficher la saison suivante (flèche droite)
Afficher la saison précédente (flèche gauche)

Sur les pages des épisodes des émissions télévisées

Afficher l'épisode suivant (flèche droite)
Afficher l'épisode précédent (flèche gauche)

Sur toutes les pages des images / photos

a Ouvrir la fenêtre d'ajout d'image / photo

Sur toutes les pages de modifications

t Ouvrir le sélecteur de traduction
ctrl+ s Envoyer le formulaire

Sur les pages des discussions

n Créer une nouvelle discussion
w Basculer le statut de suivi
p Basculer publique / privée
c Basculer fermer / ouvrir
a Ouvrir l'activité
r Répondre à la discussion
l Afficher la dernière réponse
ctrl+ enter Envoyer votre message
Page suivante (flèche droite)
Page précédente (flèche gauche)

Paramètres

Vous souhaitez évaluer ou ajouter cet élément à une liste ?

Connexion