The Movie Database 支持

Hello,

I noticed something about the discover movie endpoint. Unlike what is written on its documentation page, if I specify a page parameter greather than 500 I get the 22 error code "Invalid page: Pages start at 1 and max at 500. They are expected to be an integer.". Then, is it an error on the documentation page ? If it's normal, why is it like this while much more results can exist (in function of the request of course) ?

Best regards

8 回复(第 1 页,共 1 页)

Jump to last post

Only the 500 first pages of results from a query can be returned, even if there are more results available.

Okay, so there is a mistake in the docs. But then what about these results, it's possible that they can never be reached ? Can you explain why this technical choice was made ?

I can't explain the choice as I wasn't a designer of the API.

Okay no problem. Can you do some internal research on this ? I would really like to know, and I'm sure I'm not the only one slight_smile : maybe it could be clarified in the docs.

@LucasUlmer said:
Okay, so there is a mistake in the docs.
But then what about these results, it's possible that they can never be reached ?

It depends on the API Request you are making.
If it is Discover you can use all available filters and sort by &sort_by=primary_release_date.des and use the date parameters &primary_release_date.gte and &primary_release_date.lte.
Make a first Request and see what date came in the response.
And make a second Request limiting the initial date.
And so on until you get all the items.

Can you explain why this technical choice was made ?

I think the initial reason, about 15 years ago, was to save processing resources.
Besides, the greatest asset of a Database is its data.
It is not interesting to allow someone to get ALL the data and build their own data site.
But that is just my guess.

@LucasUlmer said:
Querying specific pages
Hello,
I noticed something about the discover movie endpoint.
Unlike what is written on its documentation page, if I specify a page parameter greather than 500 I get the 22 error code "Invalid page: Pages start at 1 and max at 500. They are expected to be an integer.".
Then, is it an error on the documentation page ?

Maybe it would be better if it was written there that the limit is 500.
Where it says "page int32 Defaults to 1" add "Maximum 500".

If it's normal, why is it like this while much more results can exist (in function of the request of course) ?

I believe I already answered in my previous comment.

The number/quantity of Items per Page and the number/quantity of Pages
cannot be changed, configured, specified, restricted, or anything like that.
There will always be up to 20 items per page.
And a maximum of 500 pages.
Therefore, at most 10,000 items.

Of course, depending on the parameters used in your API Request
this number/quantity can be much smaller.
Eventually zero.

Here's what Travis Bell, the Administrator, said on 2022-06-28:
https://www.themoviedb.org/talk/62bb2ea18b959e00526428c9#62bb37d2c613ce0094222e71

Unfortunately, there is no planned change on the page limit.
We still show the total results so one can get an accurate count but that is all.

I believe that only if you make several API Requests.
For example, for decades.

https://api.themoviedb.org/3/discover/movie?api_key=THE_KEY&language=en-US&sort_by=release_date.asc&page=1&primary_release_date.gte=1860-01-01&primary_release_date.lte=1910-12-31  

If I'm not mistaken the movie count must be over 650,000.
EDIT: over 706,322 (2022-06-28)
EDIT2: over 1,010,724 (2025-01-06)

Increasing Answer items from 10,000 to 1,010,724 means multiplying the items by 100.
I believe it would demand a lot from the system.

Thanks for the answers. About the documentation, maybe yeah "maximum 500", but there is also the info box when you click in the page field which shows PHP's minimum and maximum integer values.

@LucasUlmer said:
Thanks for the answers.
About the documentation, maybe yeah "maximum 500",
but there is also the info box when you click in the page field which shows PHP's minimum and maximum integer values.

I'm not a code programmer.
I've always understood this as a general field characteristic.

type:integer
format:int32
minimum:-2147483648
maximum:2147483647

Also because a negative number of pages wouldn't make sense.
But anyway, it's something for admin Travis Bell to resolve.

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

全站通用

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

在媒体页面

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

在电视季页面

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

在电视集页面

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

在所有图像页面

a 打开添加图片窗口

在所有编辑页面

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

在讨论页面

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

设置

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

登录

还不是会员?

注册加入社区