The Movie Database 支持

I'm trying to get the quantity of total pages a query in https://api.themoviedb.org/3/search/movie has. I would use this value for pagination. Instead, I only get the 20 results with information for the 20 first movies, but I can't see no total_pages information in the retrieved data. I've seen people talking about this value in these forums through a research I've made. So my question is: is total_pages still available?

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

Jump to last post

I found what I was doing wrong. Instead of retrieving response.data I was retrieving response.data.results.

Hi @vitorary90,

It's there point_down_tone2

Request

curl -v "http://api.themoviedb.org/3/search/movie?api_key=###&query=star+wars"

*   Trying [2600:9000:201e:1000:c:174a:c400:93a1]:80...
* Connected to api.themoviedb.org (2600:9000:201e:1000:c:174a:c400:93a1) port 80 (#0)
> GET /3/search/movie?api_key=###&query=star+wars HTTP/1.1
> Host: api.themoviedb.org
> User-Agent: curl/8.1.2
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=utf-8
< Content-Length: 12877
< Connection: keep-alive
< Date: Wed, 29 Nov 2023 17:00:17 GMT
< Server: openresty
< X-Memc: HIT
< X-Memc-Key: 6e73ab37df6c33cdea7c53426075afd8
< X-Memc-Age: 16536
< X-Memc-Expires: 7109
< ETag: W/"fb95317bb1dd498d6ae360256d0ece71"
< Vary: Accept-Encoding
< X-Cache: Miss from cloudfront
< Via: 1.1 98e30e5953336545df428a8f5923a288.cloudfront.net (CloudFront)
< X-Amz-Cf-Pop: IAD89-C3
< Alt-Svc: h3=":443"; ma=86400
< X-Amz-Cf-Id: jHpcM6qnqqNifjJieHa59DiCOL49qvXdVQdOFZDHe7ME3ZiDmXyRBA==
< Vary: Origin
<
* Connection #0 to host api.themoviedb.org left intact

Response

{
    "page": 1,
    "results": [
        {
            "adult": false,
            "backdrop_path": "/4qCqAdHcNKeAHcK8tJ8wNJZa9cx.jpg",
            "genre_ids": [
                12,
                28,
                878
            ],
            "id": 11,
            "original_language": "en",
            "original_title": "Star Wars",
            "overview": "Princess Leia is captured and held hostage by the evil Imperial forces in their effort to take over the galactic Empire. Venturesome Luke Skywalker and dashing captain Han Solo team together with the loveable robot duo R2-D2 and C-3PO to rescue the beautiful princess and restore peace and justice in the Empire.",
            "popularity": 80.819,
            "poster_path": "/6FfCtAuVAW8XJjZ7eWeLibRLWTw.jpg",
            "release_date": "1977-05-25",
            "title": "Star Wars",
            "video": false,
            "vote_average": 8.2,
            "vote_count": 19347
        },
        ...
    ],
    "total_pages": 9,
    "total_results": 177
}

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

全站通用

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

在媒体页面

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

在电视季页面

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

在电视集页面

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

在所有图像页面

a 打开添加图片窗口

在所有编辑页面

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

在讨论页面

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

设置

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

登录

还不是会员?

注册加入社区