shrx
shrx

Reputation: 718

Can't get data of a problematic section with Wikipedia API

I'd like to get the contents of the "Goalscorers" section from the Wikipedia page http://en.wikipedia.org/wiki/2014_FIFA_World_Cup#Goalscorers. I used the command

http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=2014_FIFA_World_Cup&rvprop=content&rvsection=32

but I get an empty section:

<?xml version="1.0"?>
<api>
  <query>
    <normalized>
      <n from="2014_FIFA_World_Cup" to="2014 FIFA World Cup" />
    </normalized>
    <pages>
      <page pageid="656933" ns="0" title="2014 FIFA World Cup">
        <revisions>
          <rev contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve">===Goalscorers===
{{2014 FIFA World Cup Goalscorers}}</rev>
        </revisions>
      </page>
    </pages>
  </query>
</api>

How can I get the actual data of this section with the Wikipedia API?

Upvotes: 0

Views: 95

Answers (1)

MaxSem
MaxSem

Reputation: 3547

It's not an empty section, it's a section that contains the 2014 FIFA World Cup Goalscorers template. You need to get this template's content: http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Template:2014%20FIFA%20World%20Cup%20Goalscorers&rvprop=content But oh shi~~, it's a redirect to another template called 2014 FIFA World Cup goalscorers (note the difference!), so you need to get its content too: http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Template:2014%20FIFA%20World%20Cup%20goalscorers&rvprop=content

Upvotes: 1

Related Questions