Skip to content

Instantly share code, notes, and snippets.

@loraxx753
Created April 17, 2019 16:40
Show Gist options
  • Save loraxx753/c970bee5544149ff1f42a738b7e8b0a6 to your computer and use it in GitHub Desktop.
Save loraxx753/c970bee5544149ff1f42a738b7e8b0a6 to your computer and use it in GitHub Desktop.
Scrapes the information from the info box on wikipedia pages
// Works on https://en.wikipedia.org/wiki/Electron.
(function() {
console.clear()
const response = {}
const values = [ ...document.querySelectorAll('.infobox td') ].slice(1).map(el => el.innerText)
;[ ...document.querySelectorAll('.infobox th') ].map(el => el.innerText.replace(/ /g, '')).map(keyText => {
response[keyText] = values.shift()
})
return { ...response}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment