{"id":15387272,"url":"https://github.com/rhysd/node-github-trend","last_synced_at":"2025-04-15T17:33:35.983Z","repository":{"id":66059585,"uuid":"41913297","full_name":"rhysd/node-github-trend","owner":"rhysd","description":"node.js library for scraping GitHub trending repositories.","archived":false,"fork":false,"pushed_at":"2018-04-04T08:34:01.000Z","size":75,"stargazers_count":21,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T00:25:40.860Z","etag":null,"topics":["github","nodejs","scraping","trend","trending"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhysd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-04T11:56:58.000Z","updated_at":"2025-02-06T14:37:19.000Z","dependencies_parsed_at":"2023-06-03T21:15:38.854Z","dependency_job_id":null,"html_url":"https://github.com/rhysd/node-github-trend","commit_stats":{"total_commits":88,"total_committers":4,"mean_commits":22.0,"dds":0.05681818181818177,"last_synced_commit":"5678ba81cfa1a837aebc6d6f6b52413d9c4a1927"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fnode-github-trend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fnode-github-trend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fnode-github-trend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhysd%2Fnode-github-trend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhysd","download_url":"https://codeload.github.com/rhysd/node-github-trend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248416654,"owners_count":21099911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","nodejs","scraping","trend","trending"],"created_at":"2024-10-01T14:53:08.903Z","updated_at":"2025-04-15T17:33:35.977Z","avatar_url":"https://github.com/rhysd.png","language":"TypeScript","readme":"Scraping GitHub Trending Repositories\n=====================================\n[![npm version](https://badge.fury.io/js/github-trend.svg)](http://badge.fury.io/js/github-trend)\n[![Build Status](https://travis-ci.org/rhysd/node-github-trend.svg?branch=travis)](https://travis-ci.org/rhysd/node-github-trend)\n\n[github-trend](https://www.npmjs.com/package/github-trend) is a library for scraping GitHub trending repositories.\n\n## Only scraping\n\n```javascript\nconst Trending = require('github-trend');\nconst scraper = new Trending.Scraper();\n\n// Empty string means 'all languages'\nscraper.scrapeTrendingReposFullInfo('').then(repos =\u003e {\n    for (const repo of repos) {\n        console.log(repo.owner);\n        console.log(repo.name);\n        console.log(repo.description);\n        console.log(repo.language);\n        console.log(repo.allStars);\n        console.log(repo.todaysStars);\n        console.log(repo.forks);\n    }\n}).catch(err =\u003e {\n    console.error(err.message);\n});\n\n// For other languages\nscraper.scrapeTrendingReposFullInfo('rust');\nscraper.scrapeTrendingReposFullInfo('vim');\nscraper.scrapeTrendingReposFullInfo('go');\n```\n\n`Scraper` only scrapes GitHub trending page. This returns an array of repository information.\nThis method is relatively faster because of sending request only once per language.\n\n## Scraping and getting full repository information\n\n```javascript\nconst Trending = require('github-trend');\nconst client = new Trending.Client();\n\nclient.fetchTrending('').then(repos =\u003e {\n    for (const repo of repos) {\n        // Result of https://api.github.com/repos/:user/:name\n        console.log(repo);\n    }\n}).catch(err =\u003e {\n    console.error(err.message);\n});\n\n// Fetch all API call asynchronously\nclient.fetchTrendings(['', 'vim', 'go']).then(repos =\u003e {\n    for (const lang in repos) {\n        for (const repo of repos[lang]) {\n            // Result of https://api.github.com/repos/:user/:name\n            console.log(repo);\n        }\n    }\n}).catch(err =\u003e {\n    console.error(err.message);\n});\n```\n\n`Client` contains scraper and scrapes GitHub trending page, then gets all repositories' full information using GitHub `/repos/:user/:name` API.\nThis takes more time than only scraping, but all requests are sent asynchronously and in parallel.\n\n## Scraping language information\n\n```javascript\nconst Trending = require('github-trend');\nconst scraper = new Trending.Scraper();\n\nscraper.scrapeLanguageYAML().then(langs =\u003e {\n    for (const name in langs) {\n        console.log(name);\n        console.log(langs[name]);\n    }\n}).catch(err =\u003e {\n    console.error(err.message);\n});\n```\n\nThis returns all languages information detected in GitHub by scraping [here](https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml).\nThe result is cached and reused.\n\n## Scraping language colors\n\n```javascript\nconst Trending = require('github-trend');\nconst scraper = new Trending.Scraper();\n\nscraper.scrapeLanguageColors().then(colors =\u003e {\n    for (const name in colors) {\n        console.log('name: ' + name);\n        console.log('color: ' + colors[name]);\n    }\n}).catch(err =\u003e {\n    console.error(err.message);\n});\n\n// If you want only language names:\nscraper.scrapeLanguageNames().then(names =\u003e {\n    for (const name of names) {\n        console.log(name);\n    }\n}).catch(err =\u003e {\n    console.error(err.message);\n});\n```\n\n## Collect trending repositories by scraping and GitHub API\n\nBy scraping GitHub Trending Repositories page, the information is restricted to the information\nrendered in the page. This library also supports to getting information of trending repositories\nusing GitHub Repositories API.\n\nAlthough an API token (at the first parameter of `new Client`) is not mandatory, it is recommended\nfor avoiding API rate limit.\n\n```javascript\nconst {Client} = require('github-trend');\nconst client = new Client({token: 'API access token here'});\n\nclient.fetchTrending('all').then(repos =\u003e {\n    for (const repo of repos) {\n        console.log('Name:', repo.full_name);\n        console.log('ID:', repo.id);\n        console.log('Topics:', repo.topics.join(' '));\n        console.log('License:', repo.license.name);\n    }\n}).catch(console.error);\n```\n\n## License\n\nDistributed under [the MIT license](LICENSE.txt).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhysd%2Fnode-github-trend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhysd%2Fnode-github-trend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhysd%2Fnode-github-trend/lists"}