
Wikipedia Has a Free API — Query 60M+ Articles in Any Language (No Key, No Limits)
Most Developers Don't Know This Exists Wikipedia has a powerful REST API and a MediaWiki API that lets you programmatically access 60M+ articles across 300+ languages. No API key. No rate limits (with polite use). Get Any Article's Summary import requests def get_summary ( title , lang = " en " ): url = f " https:// { lang } .wikipedia.org/api/rest_v1/page/summary/ { title } " r = requests . get ( url ) data = r . json () return { " title " : data [ " title " ], " extract " : data [ " extract " ], " thumbnail " : data . get ( " thumbnail " , {}). get ( " source " ), " url " : data [ " content_urls " ][ " desktop " ][ " page " ] } info = get_summary ( " Python_(programming_language) " ) print ( info [ " extract " ][: 200 ]) Search Articles def search_wiki ( query , limit = 5 ): url = " https://en.wikipedia.org/w/api.php " params = { " action " : " query " , " list " : " search " , " srsearch " : query , " srlimit " : limit , " format " : " json " } r = requests . get ( url , params = pa
Continue reading on Dev.to Tutorial
Opens in a new tab


