---
title: "Comment by Udaya on \"Best Developer Learning Resources on Github\" | Hashnode"
description: "Snippet to scrap data from Github profile const repos = document .querySelectorAll( &#x27;#user-list-repositories &gt; div&#x27; ) // this selects all HTML node"
url: "https://hashnode.com/posts/best-developer-learning-resources-on-github/62ff4a218bec3d0c4588b2ea/comment/62ff4f0e8bec3d0c4588b455"
---

[Discussion](https://hashnode.com/posts/best-developer-learning-resources-on-github/62ff4a218bec3d0c4588b2ea)

Comment [Best Developer Learning Resources on Github](https://hashnode.com/posts/best-developer-learning-resources-on-github/62ff4a218bec3d0c4588b2ea)

[Udaya](https://hashnode.com/@udayax)

[Aug 19, 2022](https://hashnode.com/posts/best-developer-learning-resources-on-github/62ff4a218bec3d0c4588b2ea/comment/62ff4f0e8bec3d0c4588b455)

Snippet to scrap data from Github profile

```
const repos = document.querySelectorAll('#user-list-repositories > div')
// this selects all HTML nodes of the repo
const requiredData = []

// Process required data from the HTML node
repos.forEach((repo) => {
  const children = repo.children
  const name = children[0].innerText
  const description = children[2] && children[2].innerText
  if (!children[3]) return
  const details = children[3].querySelectorAll('a')
  const starts = details[0].innerText
  const forks = details[1].innerText
  requiredData.push({ name, description, starts, forks })
})

console.log(requiredData)
```

Process those data into the required Markdown format

```
const fs = require('fs')

let data = [{},{},{},{},...]
/* Array of data in this format 
{"name":"markodenic / web-development-resources",
"description":"Awesome Web Development Resources.",
"stars":" 4,310 ",
"forks":" 773 "}
*/

data.forEach((repo) => {
    repo.name = `${repo.name.replace(' / ', '/')}`
    repo.link = `github.com${repo.name.replace(' / ', '/')}`
    repo.stars = (parseInt(repo.stars.replace(",", "")))
    repo.forks = (parseInt(repo.forks.replace(",", "")))
})


// Sort repos based on Github starts
data = data.sort((a, b) => b.stars - a.stars)

// Util to convert 1223 -> 1.2k
const util = (val) => Math.round(val / 100) / 10

let result = ''
// combine all data with formatting 

data.forEach((repo, i) => {
    let text = (`${repo.name.split('/')[1]}`)
    let final = `### ${i + 1} [${text}](${repo.link})`
    const detail = `⭐ ${util(repo.stars)}k - stars, 🍴 ${util(repo.forks)}k - forks`
    const des = repo.description
    result += '\n' + final + '\n' + detail + '\n\n' + '*' + des + '*' + '\n'

})

// write the final result to the file
fs.writeFile('Output.txt', result, (err) => {
    if (err) throw err;
})

// Now just copy past the contents from Output.txt file
```

[Sathyasri Jegan](https://hashnode.com/@SathyasriJegan)

[Aug 19, 2022](https://hashnode.com/posts/best-developer-learning-resources-on-github/62ff4a218bec3d0c4588b2ea/comment/62ff4f0e8bec3d0c4588b455#reply-62ff66b58bec3d0c4588b987)

Keep growing 🎉
