I'm using wiki api to embed search on my site. User types some keyword, then script searches pages connected to keyword and displays thumbnail/title/description/categories (example: http://drive.google.com/uc?export=view&id=0B77izt5MEPt2TUw3eUEyVVg3SUE)
Now I'm using:
GET //en.wikipedia.org/w/api.php?action=query&list=search&srsearch=KEYWORD
foreach TITLE:
GET //en.wikipedia.org/w/api.php?action=query&titles=TITLE&prop=extracts|pageimages|categories&exchars=300
Works fine, but the amount of api calls is too big. So I'm looking for some way to optimize it. It's possible to pass multiple titles in second GET, but the wiki server will split response (using continue) so there are no difference.
Any ideas?
Have a look at how generators work: