bangumi / bangumi/api

The length of list not match with the given max_results in search API

Open
#195 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
1.2k
Forks
41
PR merge metrics
No merged PRs in 30d

Description

How to reproduce this

```bash
curl -X 'GET' \
'https://api.bgm.tv/search/subject/Railgun?start=0&max_results=15' \
-H 'accept: application/json'
```

Request URL

```
https://api.bgm.tv/search/subject/Railgun?start=0&max_results=15
```

And this is the response json

```
{
"results": 23,
"list": [
{
"id": 303221,
"url": "http://bgm.tv/subject/303221",
"type": 3,
"name": "only my railgun -version2020-",
"name_cn": "",
"summary": "",
"air_date": "",
"air_weekday": 0,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/ae/4f/303221_uHIYo.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/ae/4f/303221_uHIYo.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/ae/4f/303221_uHIYo.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/ae/4f/303221_uHIYo.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/ae/4f/303221_uHIYo.jpg"
}
},
{
"id": 3227,
"url": "http://bgm.tv/subject/3227",
"type": 3,
"name": "only my railgun",
"name_cn": "",
"summary": "",
"air_date": "",
"air_weekday": 0,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/aa/c6/3227_KxXT7.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/aa/c6/3227_KxXT7.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/aa/c6/3227_KxXT7.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/aa/c6/3227_KxXT7.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/aa/c6/3227_KxXT7.jpg"
}
},
{
"id": 262940,
"url": "http://bgm.tv/subject/262940",
"type": 2,
"name": "とある科学の超電磁砲T",
"name_cn": "某科学的超电磁炮T",
"summary": "",
"air_date": "",
"air_weekday": 0,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/aa/db/262940_z2mQQ.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/aa/db/262940_z2mQQ.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/aa/db/262940_z2mQQ.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/aa/db/262940_z2mQQ.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/aa/db/262940_z2mQQ.jpg"
}
},
{
"id": 2585,
"url": "http://bgm.tv/subject/2585",
"type": 2,
"name": "とある科学の超電磁砲",
"name_cn": "某科学的超电磁炮",
"summary": "",
"air_date": "",
"air_weekday": 0,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/36/e7/2585_pn2eP.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/36/e7/2585_pn2eP.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/36/e7/2585_pn2eP.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/36/e7/2585_pn2eP.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/36/e7/2585_pn2eP.jpg"
}
},
{
"id": 51928,
"url": "http://bgm.tv/subject/51928",
"type": 2,
"name": "とある科学の超電磁砲S",
"name_cn": "某科学的超电磁炮S",
"summary": "",
"air_date": "",
"air_weekday": 0,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/99/8c/51928_wuG5D.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/99/8c/51928_wuG5D.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/99/8c/51928_wuG5D.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/99/8c/51928_wuG5D.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/99/8c/51928_wuG5D.jpg"
}
},
{
"id": 98371,
"url": "http://bgm.tv/subject/98371",
"type": 2,
"name": "OVA とある科学の超電磁砲",
"name_cn": "某科学的超电磁炮 OVA",
"summary": "",
"air_date": "",
"air_weekday": 0,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/37/5a/98371_zdWKw.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/37/5a/98371_zdWKw.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/37/5a/98371_zdWKw.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/37/5a/98371_zdWKw.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/37/5a/98371_zdWKw.jpg"
}
},
{
"id": 3582,
"url": "http://bgm.tv/subject/3582",
"type": 1,
"name": "とある魔術の禁書目録外伝 とある科学の超電磁砲",
"name_cn": "某科学的超电磁炮",
"summary": "",
"air_date": "",
"air_weekday": 0,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/9d/68/3582_JKSTo.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/9d/68/3582_JKSTo.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/9d/68/3582_JKSTo.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/9d/68/3582_JKSTo.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/9d/68/3582_JKSTo.jpg"
}
},
{
"id": 26950,
"url": "http://bgm.tv/subject/26950",
"type": 4,
"name": "とある科学の超電磁砲",
"name_cn": "某科学的超电磁炮",
"summary": "",
"air_date": "",
"air_weekday": 0,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/ec/78/26950_zToFZ.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/ec/78/26950_zToFZ.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/ec/78/26950_zToFZ.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/ec/78/26950_zToFZ.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/ec/78/26950_zToFZ.jpg"
}
},
{
"id": 70434,
"url": "http://bgm.tv/subject/70434",
"type": 1,
"name": "とある科学の超電磁砲 ナビゲーションブック",
"name_cn": "",
"summary": "",
"air_date": "",
"air_weekday": 0,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/91/32/70434_a033K.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/91/32/70434_a033K.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/91/32/70434_a033K.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/91/32/70434_a033K.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/91/32/70434_a033K.jpg"
}
},
{
"id": 217840,
"url": "http://bgm.tv/subject/217840",
"type": 1,
"name": "とある科学の超電磁砲外伝 アストラル・バディ",
"name_cn": "某科学的超电磁炮外传 Astral Buddy",
"summary": "",
"air_date": "",
"air_weekday": 0,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/fb/12/217840_hBiSs.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/fb/12/217840_hBiSs.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/fb/12/217840_hBiSs.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/fb/12/217840_hBiSs.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/fb/12/217840_hBiSs.jpg"
}
}
]
}
```

The length of `list` is 10, but the `max_results`'s value is `15`.

And, of course, the total count is `23`, which means as for the 1st page, it should be `15` items.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the request against the search API endpoint with max_results=15 and inspect how results and list are generated. The fix is done when the first page returns up to 15 items when at least 15 matches exist, while results still reports the total count.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.