Coding Challenge #75: Wikipedia API

Subscribers:
1,750,000
Published on ● Video Link: https://www.youtube.com/watch?v=RPz75gcHj18



Duration: 24:51
312,212 views
6,004


In this coding challenge, I make a "Wikipedia web crawler" in JavaScript. It randomly crawls from topic to topic on Wikipedia using the API and the p5.js library. Code: https://thecodingtrain.com/challenges/75-wikipedia-api

🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/A4u07unm5

🎥 Previous video: https://youtu.be/E4RyStef-gY?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
🎥 Next video: https://youtu.be/bEyTZ5ZZxZs?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
🎥 All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
🌐 Wikipedia API Help: https://www.mediawiki.org/wiki/API:Main_page

Videos:
🚂 Videos on working with data and APIs: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6YxDKpFzf_2D84p0cyk4T7X
🚂 My Videos on Regular Expressions: https://www.youtube.com/watch?v=7DG3kCDx53c
🔴 Coding Train Live 101: https://youtu.be/PQwfop4bewM?t=5024s

Related Coding Challenges:
🚂 #84 Word Definition Chrome Extension: https://youtu.be/GWDx1GnxhOw

Timestamps:
0:00 Introducing today's topic: a Wikipedia web crawler
1:17 Add an input box to the html
2:48 Handle the user input event
4:45 The Wikipedia search URL
6:45 Use loadJSON to request a page
9:52 Pick a random article title
11:36 Use a regular expression to replace the white space
12:28 Retrieve the content using the content URL
14:58 Look at the json file with the Chrome extension Json formatter
16:37 Use the key to get the page Id
19:53 Use a regular expression to get the words on a page
21:55 Use a random word to crawl a bunch of random articles
22:55 Add an exit condition
24:12 Conclusion

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

🚂 Website: http://thecodingtrain.com/
👾 Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
🚩 Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
💡 GitHub: https://github.com/CodingTrain
💬 Discord: https://thecodingtrain.com/discord
💖 Membership: http://youtube.com/thecodingtrain/join
🛒 Store: https://standard.tv/codingtrain
🖋️ Twitter: https://twitter.com/thecodingtrain
📸 Instagram: https://www.instagram.com/the.coding.train/

🎥 Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
🎥 Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

🔗 p5.js: https://p5js.org
🔗 p5.js Web Editor: https://editor.p5js.org/
🔗 Processing: https://processing.org

📄 Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new

#webcrawler #wikipediaapi #regularexpressions #loadjson #javascript #p5js







Tags:
JavaScript (Programming Language)
live
programming
daniel shiffman
creative coding
coding challenge
tutorial
coding
challenges
coding train
the coding train
live stream
itp nyu
challenge
javascript
p5.js
p5.js tutorial
programming challenge
wikipedia
wikipedia crawler
wikipedia web crawler
web crawler
wikipedia api
wiki api
regular expressions
json
load json
api
js
p5js
tutorials
rest api
wiki
asynchronous requests
network requests
restful api