
Wikipedia Has a Free API — Extract Any Article, Summary, or Image Programmatically
Wikipedia is the largest encyclopedia ever created — 6.8 million English articles. And it has a completely free API with no rate limits and no API key. Here is how to use it. Get a Summary of Any Topic curl -s "https://en.wikipedia.org/api/rest_v1/page/summary/Python_(programming_language)" | jq '{title: ".title, extract: .extract}' " Response: { "title" : "Python (programming language)" , "extract" : "Python is a high-level, general-purpose programming language..." } No API key. No signup. Just call it. Search Wikipedia const response = await fetch ( ' https://en.wikipedia.org/w/api.php? ' + new URLSearchParams ({ action : ' query ' , list : ' search ' , srsearch : ' machine learning ' , format : ' json ' , origin : ' * ' }) ); const data = await response . json (); const results = data . query . search ; results . forEach ( r => { console . log ( ` ${ r . title } — ${ r . snippet . replace ( /< [^ > ] *>/g , '' )} ` ); }); Returns title, snippet, word count, and timestamp for each re
Continue reading on Dev.to JavaScript
Opens in a new tab




