Coding Challenge #75: Wikipedia API
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