thehattery
thehattery

Reputation: 125

How can I get Wikipedia API results within alphabetical parameters?

I'm using the Wikipedia API to retrieve links within pages, and backlinks to those pages. Is there any way to filter results of prop=links, prop=linkshere or list=backlinks to retrieve only results that e.g. begin with a certain letter? Something like from=La&to=Lz would be nice - but it doesn't appear to be available.

At the moment the solution I have is to get ALL the links, using the continuation parameters, then just pull out those that match my criteria. But this can sometimes require numerous API calls, and seems a bit inelegant. Have I missed any other options?

Upvotes: 2

Views: 108

Answers (2)

thehattery
thehattery

Reputation: 125

I've now had an answer from the Wikimedia API mailing list: "There isn't anything like this available at the moment. It might be able to be added, but that doesn't help you right now."

Upvotes: 1

Tgr
Tgr

Reputation: 28200

If you don't need to results to be perfectly up-to-date, you can use the database dumps (published once a month or so) and then it's just a trivial SQL query.

Alternatively, you can implement that API yourself on Wikimedia Labs which allows you to create web services which have access to a live DB mirror of Wikipedia.

Upvotes: 1

Related Questions