MediaWiki API:return 来自生成器的结果少于默认值 10

MediaWiki API: return less results from a generator than the default of 10

以下link returns信息共10页。

http://en.wikipedia.org/w/api.php?action=query&generator=search&gsrsearch=Skydive&format=json&gsrprop=snippet&prop=info&inprop=url&rawcontinue

我如何查询 return 一页的信息?

将 ptlimit、cmlimit 等设置为 1 会出现以下错误。

Unrecognized parameter ptlimit

gsroffset 默认为 10。我尝试将此参数放入查询中,但它只是添加了我放入 10 的任何数字。

您使用了 generator=search,因此您必须检查 API:Search where you discover it's called srlimit; prefix a g because you use it as generator 中的参数,这给出了 gsrlimit=1

https://en.wikipedia.org/w/api.php?action=query&generator=search&gsrsearch=Skydive&format=json&gsrprop=snippet&prop=info&inprop=url&rawcontinue&gsrlimit=1

{"query-continue":{"search":{"gsroffset":1}},"query":{"pages":{"19723982":{"pageid":19723982,"ns":0,"title":"Parachuting","index":1,"contentmodel":"wikitext","pagelanguage":"en","touched":"2015-07-21T16:28:32Z","lastrevid":670810888,"length":44466,"fullurl":"https://en.wikipedia.org/wiki/Parachuting","editurl":"https://en.wikipedia.org/w/index.php?title=Parachuting&action=edit","canonicalurl":"https://en.wikipedia.org/wiki/Parachuting"}}}}