Hi Mediawiki-api mailing listers!
I'm trying to get the intro to a list of Wikipedia pages using the "extracts" property with "exintro=True". This works fine for most sites, but for a few of them the API returns an empty extract field. See for example: https://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles...
When looking at the page "https://en.wikipedia.org/wiki/Anthem" there definitely seems to be text before the first section, so I think I should be getting something. Indeed without the "exintro" parameter, I get the expected return.
Any idea why this occurs?
Best,
Bertel
On Sat, Aug 24, 2019 at 7:02 AM Bertel Teilfeldt Hansen geilfeldt@gmail.com wrote:
Hi Mediawiki-api mailing listers!
I'm trying to get the intro to a list of Wikipedia pages using the "extracts" property with "exintro=True". This works fine for most sites, but for a few of them the API returns an empty extract field. See for example:
https://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles...
When looking at the page "https://en.wikipedia.org/wiki/Anthem" there definitely seems to be text before the first section, so I think I should be getting something. Indeed without the "exintro" parameter, I get the expected return.
Any idea why this occurs?
"exintro" assumes that the first heading tag (<h1> to <h6>) indicates the end of the intro. In the HTML of that page, the {{TOC_Right}} causes the table of contents to be before the visible text, and the table of contents includes an <h2>, so it chops it off there.
Hi Brad,
Sorry, for some reason I didn't see your email till just now : / But thank you for that reply, it makes total sense. Although it is probably not the desired behavior.
Keep up the radical Wiki work - love the site!
Best,
Bertel
Den man. 26. aug. 2019 kl. 16.59 skrev Brad Jorsch (Anomie) < bjorsch@wikimedia.org>:
On Sat, Aug 24, 2019 at 7:02 AM Bertel Teilfeldt Hansen < geilfeldt@gmail.com> wrote:
Hi Mediawiki-api mailing listers!
I'm trying to get the intro to a list of Wikipedia pages using the "extracts" property with "exintro=True". This works fine for most sites, but for a few of them the API returns an empty extract field. See for example:
https://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles...
When looking at the page "https://en.wikipedia.org/wiki/Anthem" there definitely seems to be text before the first section, so I think I should be getting something. Indeed without the "exintro" parameter, I get the expected return.
Any idea why this occurs?
"exintro" assumes that the first heading tag (<h1> to <h6>) indicates the end of the intro. In the HTML of that page, the {{TOC_Right}} causes the table of contents to be before the visible text, and the table of contents includes an <h2>, so it chops it off there.
-- Brad Jorsch (Anomie) Senior Software Engineer Wikimedia Foundation _______________________________________________ Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org