Share your repls and programming experiences

← Back to all posts
Randowiki - Random wikipedia articles
h
heyitsmarcus (314)

Press the spacebar and you'll get a random word to be looked up on Wikipedia and then see which article is chosen based on that word! And then, every 5 seconds, a new word is chosen and a new article unleashed!

Any articles that have images should have an image in the app.

A quick demo:
https://www.youtube.com/watch?v=2MjyhKlg0sU&feature=youtu.be

Commentshotnewtop
jajoosam (728)

I love this marcus, it's really cool! I got some funny and unexpected results since it picks randomly out of 10 😂

Also, I didn't know wikipedia had a JSON api - I've always been scraping 😅

heyitsmarcus (314)

@jajoosam Wow, I appreciate that! I had to take certain words out of there when I made the list because I didn't even realize that there were NSFW entries in Wikipedia XD

Oh yea, if you visit the base link: https://www.mediawiki.org/wiki/API:Main_page They have a few different versions of their API and there are tons of customization options. They even have an API Sandbox where you can play around with the various query parameters and see the results in an easy to use format. I thought it was really nifty!

mat1 (3296)

Fun fact: You can get a random list of Wikipedia articles with only their api https://en.wikipedia.org/w/api.php?action=query&list=random&rnlimit=20&rnnamespace=0

heyitsmarcus (314)

@mat1 That is just a json response, and I'm doing more than just presenting a JSON response, since I'm presenting random articles based on random words and if those articles have images, the images are shown, too. I just thought it was a fun, little project.

mat1 (3296)

@heyitsmarcus Yes, but you can get the random article's names instead of using random words

heyitsmarcus (314)

@mat1 Sure, except I wanted to use random words and a query response, and that's what I did on MY challenge. I don't expect to win at all. I wanted to do something fun, and this was fun for me. Now shoo, go bother someone else.