Pergunta

I wish to use Wikipedia api to extract the result of this page:

http://en.wikipedia.org/wiki/Special:PrefixIndex

When searching "something" on it, for example this:

http://en.wikipedia.org/w/index.php?title=Special%3APrefixIndex&prefix=tal&namespace=4

Then, I would like to access each of the resulting pages and extract their information.

What api call might I use?

Foi útil?

Solução

You can use list=allpages and specify apprefix. For example:

http://en.wikipedia.org/w/api.php?format=xml&action=query&list=allpages&apprefix=tal&aplimit=max

This query will give you the id and title of each article that starts with tal. If you want to get more information about each page, you can use this list as a generator:

http://en.wikipedia.org/w/api.php?format=xml&action=query&generator=allpages&gapprefix=tal&gaplimit=max&prop=info

You can give different values to the prop parameter to get different information about the page.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top