Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get more than default 10 results from Wikipedia API?

I am using Wikipedia API where I get the images of certain string I input. It always returns 10 result but I want more than that approx 50.

https://en.wikipedia.org/w/api.php?action=query&prop=pageimages&format=json&piprop=thumbnail&pithumbsize=500&pilimit=50&generator=prefixsearch&gpssearch=game of thrones

How do I get 50 results?

like image 519
WISHY Avatar asked Jun 02 '16 05:06

WISHY


2 Answers

Solved also need to add

&gpslimit=100

enter image description here it should be in the range 1-100

like image 87
WISHY Avatar answered Nov 06 '22 06:11

WISHY


By default most of the generators and props used in query action are with limit of 10. Always when you need to increase the limit for your query you have to set the corresponding limit value for all them, because the resulting query limit is equal to smallest of all them.

So, if your query uses generator=geosearch with prop=links|extracts|categories|images and you need 20 results, you must set the limit parameters for geosearch, links, extracts, categories and images to 20.

https://en.wikipedia.org/w/api.php?...&ggslimit=20&pllimit=20&exlimit=20&cllimit=20&imlimit=20

Of course this has to comply with the allowed max limit for each parameter. For example, for extracts the allowed max limit is 20 (default: 1), which means that you can't get more than 20 pages in your final response, although others are more than 20. This also means that in your case above the effect of gpslimit=100 will be the same as gpslimit=50, because pilimit=50.

like image 30
Termininja Avatar answered Nov 06 '22 04:11

Termininja