Home

Awesome

<h1 align="center">Github Unofficial Trending API</h1> <p align="center">:octocat: A simple API that returns number of Github trending repositories and developers.</p> <div align="center"> <img src="images/hero.svg" alt="hero image" width="400"/> <br> <p> <em>Credits: Illustration by <a href="https://undraw.co/">unDraw</a></em> </p> </div> <br />

Financial Contributors on Open Collective GitHub closed issues Travis semantic-release coverage GitHub license Code of Conduct

npm (scoped) module formats: cjs, es


Table of Contents

<details> <summary><b>Expand Table of Contents</b></summary> <!-- prettier-ignore-start --> <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- prettier-ignore-end --> </details>

Projects using github-trending-api

Backers

Thank you to all our backers! 🙏 [Become a backer]

<a href="https://opencollective.com/github-trending-api#backers" target="_blank"><img src="https://opencollective.com/github-trending-api/backers.svg?width=890"></a>

<a href="https://www.buymeacoffee.com/huchenme" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>

API Status

API status is available at uptimerobot.

REST API

See the full API documentation in Apiary.

Tutorial

How to scrape any website and build an API using cheerio.js

Trending Repositories

Receive an array of trending repositories.

URL Endpoint:

https://ghapi.huchen.dev/repositories?language=javascript&since=weekly

Parameters:

Response:

[
  ...
  {
    "author": "google",
    "name": "gvisor",
    "avatar": "https://github.com/google.png",
    "url": "https://github.com/google/gvisor",
    "description": "Container Runtime Sandbox",
    "language": "Go",
    "languageColor": "#3572A5",
    "stars": 3320,
    "forks": 118,
    "currentPeriodStars": 1624,
    "builtBy": [
      {
        "href": "https://github.com/viatsko",
        "avatar": "https://avatars0.githubusercontent.com/u/376065",
        "username": "viatsko"
      }
    ]
  }
  ...
]

Note that GitHub trending page sometimes is empty, in that case this API returns [] in response, your application should be able to handle it or read from previous cache.

Trending Developers

Receive an array of trending developers.

URL Endpoint:

https://ghapi.huchen.dev/developers?language=javascript&since=weekly

Parameters:

Response:

[
  {
    "username": "google",
    "name": "Google",
    "type": "organization",
    "url": "https://github.com/google",
    "avatar": "https://avatars0.githubusercontent.com/u/1342004",
    "repo": {
      "name": "traceur-compiler",
      "description": "Traceur is a JavaScript.next-to-JavaScript-of-today compiler",
      "url": "https://github.com/google/traceur-compiler"
    }
  }
]

type could be organization or user.

List Languages

URL Endpoint:

https://ghapi.huchen.dev/languages

Response:

[
  {
    "urlParam": "1c-enterprise",
    "name": "1C Enterprise"
  },
  {
    "urlParam": "abap",
    "name": "ABAP"
  },
  {
    "urlParam": "abnf",
    "name": "ABNF"
  },
  {
    "urlParam": "actionscript",
    "name": "ActionScript"
  }
]

List Spoken Languages

URL Endpoint:

https://ghapi.huchen.dev/spoken_languages

Response:

[
  {
    "urlParam": "ab",
    "name": "Abkhazian"
  },
  {
    "urlParam": "aa",
    "name": "Afar"
  },
  {
    "urlParam": "af",
    "name": "Afrikaans"
  },
  {
    "urlParam": "ak",
    "name": "Akan"
  }
]

NPM Package

You could also use the API as a NPM package.

Install

$ npm install --save @huchenme/github-trending

Usage

import {
  languages,
  spokenLanguages,
  fetchRepositories,
  fetchDevelopers,
} from '@huchenme/github-trending';

fetchRepositories({ language: 'ruby', since: 'monthly' }).then(
  (repositories) => {
    console.log(repositories);
  }
);

fetchDevelopers({ language: 'javascript' }).then((developers) => {
  console.log(developers);
});

console.log(languages);
console.log(spokenLanguages);

API

languages

List all languages

[
  {
    urlParam: '1c-enterprise',
    name: '1C Enterprise',
  },
  {
    urlParam: 'abap',
    name: 'ABAP',
  },
  {
    urlParam: 'abnf',
    name: 'ABNF',
  },
  {
    urlParam: 'actionscript',
    name: 'ActionScript',
  },
];

spokenLanguages

List all spoken languages

[
  {
    urlParam: 'ab',
    name: 'Abkhazian',
  },
  {
    urlParam: 'aa',
    name: 'Afar',
  },
  {
    urlParam: 'af',
    name: 'Afrikaans',
  },
  {
    urlParam: 'ak',
    name: 'Akan',
  },
];

fetchRepositories(params)

Receive an array of trending repositories.

params:

[
  ...
  {
    author: 'google',
    name: 'gvisor',
    avatar: 'https://github.com/google.png',
    url: 'https://github.com/google/gvisor',
    description: 'Container Runtime Sandbox',
    language: 'Go',
    languageColor: '#3572A5',
    stars: 3320,
    forks: 118,
    currentPeriodStars: 1624,
    "builtBy": [
      {
        "href": "https://github.com/viatsko",
        "avatar": "https://avatars0.githubusercontent.com/u/376065",
        "username": "viatsko"
      }
    ]
  }
  ...
]

fetchDevelopers(params)

Receive an array of trending developers.

params:

[
  ...
  {
    username: 'google',
    name: 'Google',
    type: 'organization',
    url: 'https://github.com/google',
    avatar: 'https://avatars0.githubusercontent.com/u/1342004',
    repo: {
      name: 'traceur-compiler',
      description:
        'Traceur is a JavaScript.next-to-JavaScript-of-today compiler',
      url: 'https://github.com/google/traceur-compiler'
    }
  }
  ...
]

docker

You can develop by using docker.

$ docker build -t github-trending-api .
$ docker run -d --rm -p 8000:8888 github-trending-api:latest

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute]. <a href="https://github.com/huchenme/github-trending-api/graphs/contributors"><img src="https://opencollective.com/github-trending-api/contributors.svg?width=890&button=false" /></a>

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

<a href="https://opencollective.com/github-trending-api"><img src="https://opencollective.com/github-trending-api/individuals.svg?width=890"></a>

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

<a href="https://opencollective.com/github-trending-api/organization/0/website"><img src="https://opencollective.com/github-trending-api/organization/0/avatar.svg"></a> <a href="https://opencollective.com/github-trending-api/organization/1/website"><img src="https://opencollective.com/github-trending-api/organization/1/avatar.svg"></a> <a href="https://opencollective.com/github-trending-api/organization/2/website"><img src="https://opencollective.com/github-trending-api/organization/2/avatar.svg"></a> <a href="https://opencollective.com/github-trending-api/organization/3/website"><img src="https://opencollective.com/github-trending-api/organization/3/avatar.svg"></a> <a href="https://opencollective.com/github-trending-api/organization/4/website"><img src="https://opencollective.com/github-trending-api/organization/4/avatar.svg"></a> <a href="https://opencollective.com/github-trending-api/organization/5/website"><img src="https://opencollective.com/github-trending-api/organization/5/avatar.svg"></a> <a href="https://opencollective.com/github-trending-api/organization/6/website"><img src="https://opencollective.com/github-trending-api/organization/6/avatar.svg"></a> <a href="https://opencollective.com/github-trending-api/organization/7/website"><img src="https://opencollective.com/github-trending-api/organization/7/avatar.svg"></a> <a href="https://opencollective.com/github-trending-api/organization/8/website"><img src="https://opencollective.com/github-trending-api/organization/8/avatar.svg"></a> <a href="https://opencollective.com/github-trending-api/organization/9/website"><img src="https://opencollective.com/github-trending-api/organization/9/avatar.svg"></a>

License

MIT