Pergunta

I'm trying to get "Table" content of a page by wiki api query:

the "Table-Content" is block content numbered as 3

I tried this query, but it doesn't work

http://en.wikipedia.org/w/api.php?action=query&prop=revisions&format=json&rvprop=content&rvlimit=10&rvparse=1&rvsection=1&rvsection=2&titles=Ha%20Noi&redirects=

BTW, How can I get 2 very first section, instead of only one section with query like this Thanks

Foi útil?

Solução 2

If you want to get the table of contents, or, in other words, the list of sections of a page, you can use action=parse&prop=sections:

http://en.wikipedia.org/w/api.php?action=parse&format=json&prop=sections&page=Ha%20Noi&redirects

Outras dicas

If you want to get contents from a specific section you have to add &section=4 , like this:

https://en.wikipedia.org/w/api.php?action=parse&format=json&prop=sections&page=Ha%20Noi&redirects&section=4
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top