Last active
February 1, 2021 10:21
-
-
Save gsimone/d2b076a860ec4e1e1c7c to your computer and use it in GitHub Desktop.
Url for a random article in JSON format from wikipedia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://en.wikipedia.org/w/api.php?action=query&generator=random&grnnamespace=0&prop=extracts&exchars=500&format=json | |
http://en.wikipedia.org/w/api.php? | |
action=query & | |
generator=random & | |
grnnamespace=0 & | |
prop=extracts & | |
exchars=500 & // must be > 0 | |
format=json | |
response example: | |
{"query":{"pages":{"41571479":{"pageid":41571479,"ns":0,"title":"Babes in Toyland discography","extract":"<p><b>Babes in Toyland</b> was an American punk rock band formed in Minneapolis, Minnesota in 1987. The band was formed by Oregon native Kat Bjelland (lead vocals and guitar), with Lori Barbero (drums) and Michelle Leon (bass), who was later replaced by Maureen Herman in 1992. Courtney Love had a very brief stint in the band in 1987 as a bass player, before being kicked out and forming Hole in 1989.</p>\n<p>Between 1989 and 1995, Babes in Toyland released three studio albums; <i>Spanking Machine</i></p>..."}}}} | |
get pageid and req | |
http://en.wikipedia.org/wiki?curid=pageid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to get 10 pages from api?
if i am adding the grnlimit=10 with url as below it not giving the "extract" value in response please check below url
https://en.wikipedia.org/w/api.php?action=query&generator=random&grnnamespace=0&prop=extracts&exchars=500&format=json&grnlimit=10
can you help with this?