On Mon, 19 Sept 2022 at 17:03, Julius Hamilton <[email protected]>
wrote:

> Hey,
>
> It seems the following API call works for Wikipedia pages:
>
>
> https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exsentences=10&titles=Pet_door
>
> But not for Wikisource pages:
>
>
> https://en.wikisource.org/w/api.php?action=query&prop=extracts&exsentences=10&titles=A_Simplified_Grammar_of_the_Swedish_Language
>
> Is there documentation somewhere about the API not working for Wikisource
> or perhaps only certain actions / props working for certain sites?
>

Did you look at the wikitext of that page?
https://en.wikisource.org/w/index.php?title=A_Simplified_Grammar_of_the_Swedish_Language&action=edit

prop=extracts works, but I would say it's a poor fit for many (most?)
wikisource pages.
https://en.wikisource.org/w/api.php?action=query&prop=extracts&exsentences=10&titles=Wikisource:Community_collaboration/Monthly_Challenge/September_2022


How can I get the full plaintext from an entire book on Wikisource with the
> API?
>

Plaintext as in wikitext or in parsed html converted to plaintext?

You could use something like this to fetch every page under
A_Simplified_Grammar_of_the_Swedish_Language:
https://en.wikisource.org/w/api.php?generator=allpages&action=query&prop=revisions&rvprop=content&rvslots=main&gapprefix=A_Simplified_Grammar_of_the_Swedish_Language


Regards
_______________________________________________
Mediawiki-api mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to