The Movie Database 支持

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 回复(第 1 页,共 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.

找不到电影或节目?登录并创建它吧。

全站通用

s 聚焦到搜索栏
p 打开个人资料菜单
esc 关闭打开的窗口
? 打开键盘快捷键窗口

在媒体页面

b 返回(或返回上级)
e 进入编辑页面

在电视季页面

(右箭头)下一季
(左箭头)前一季

在电视集页面

(右箭头)下一集
(左箭头)上一集

在所有图像页面

a 打开添加图片窗口

在所有编辑页面

t 打开翻译选择器
ctrl+ s 提交

在讨论页面

n 创建新讨论
w 切换关注状态
p 设为公开 / 私密讨论
c 关闭 / 开放讨论
a 打开活动页
r 回复讨论
l 跳转至最新回复
ctrl+ enter 发送信息
(右箭头)下一页
(左箭头)前一页

设置

想给这个条目评分或将其添加到片单中?

登录

还不是会员?

注册加入社区