Limit The Results Number of Each Page In The API Response

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Limit The Results Number of Each Page In The API Response

Tal Barda
Hi!
I know that I'm able to get the "linkshere" prop for multiple pages like this:

<a href="https://en.wikipedia.org/w/api.php?format=json&amp;action=query&amp;prop=linkshere&amp;pageids=9379691|5442968&amp;lhlimit=10&amp;lhnamespace=0&amp;lhshow=!redirect">https://en.wikipedia.org/w/api.php?format=json&action=query&prop=linkshere&pageids=9379691|5442968&lhlimit=10&lhnamespace=0&lhshow=!redirect

My problem is with the "lhlimit" parameter. I'd like to get 10 results for each page, but it's currently gives my 10 results for ALL of the pages, which means I have to call "lhcontinue" each time. 

Is it possible to get 10 results for each page when asking for multiple pages? 
Or should I make a different call for each article in order to achieve this? 

Thanks,
Tal


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|

Re: Limit The Results Number of Each Page In The API Response

Brad Jorsch (Anomie)
On Fri, Mar 23, 2018 at 6:18 AM, Tal Barda <[hidden email]> wrote:
My problem is with the "lhlimit" parameter. I'd like to get 10 results for each page, but it's currently gives my 10 results for ALL of the pages, which means I have to call "lhcontinue" each time. 

Is it possible to get 10 results for each page when asking for multiple pages?

No. You can get more results total by increasing lhlimit, but trying to limit results per page gets complicated in the API module's code, and would be even more complicated to provide continuation.
 
 Or should I make a different call for each article in order to achieve this? 

That would be one way to do it.

--
Brad Jorsch (Anomie)
Senior Software Engineer
Wikimedia Foundation

_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api