Skip to content

Instantly share code, notes, and snippets.

@Be1zebub
Created December 15, 2025 12:29
Show Gist options
  • Select an option

  • Save Be1zebub/6ef356ee6c0bc0ce504e3b8d8c0b7205 to your computer and use it in GitHub Desktop.

Select an option

Save Be1zebub/6ef356ee6c0bc0ce504e3b8d8c0b7205 to your computer and use it in GitHub Desktop.
quick dom parser, no 3rdparty shit, just using browser api & devtools console for quick parse any shit i need.
// run in any repo
// will print top 3 contributors in console
const list = document.querySelectorAll('div.Layout-sidebar > div > div:nth-child(2) > div > ul a[href][data-hovercard-url^="/users/"]')
list.forEach(async (row, i) => {
if (i >= 3) return
const username = row.getAttribute('href').split('/').pop()
const doc = await fetchDocument(`https://github.com/${username}`)
const name = doc.querySelector("div.application-main div.Layout-sidebar span.p-name.vcard-fullname")?.textContent
console.log(username, name)
})
async function fetchDocument(url) {
try {
const response = await fetch(url)
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const html = await response.text()
const parser = new DOMParser()
const doc = parser.parseFromString(html, 'text/html')
return doc
} catch (error) {
console.error(`Error fetching ${url}:`, error)
return null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment