Skip to content

Commit

Permalink
feat: Add developer type in trending developers (#30)
Browse files Browse the repository at this point in the history
Closes #29
  • Loading branch information
huchenme committed Apr 18, 2019
1 parent 8ec5521 commit 6e3ec76
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
15 changes: 8 additions & 7 deletions README.md
Expand Up @@ -44,9 +44,9 @@
- **[Hacker Tab](https://github.com/huchenme/hacker-tab-extension)** ([Chrome Store](https://chrome.google.com/webstore/detail/hacker-tab/ibomigipadcieapbemkegkmadbbanbgm)): Chrome extension to view GitHub trending projects on new tab.
- **[github-trending-plus](https://github.com/zircleUI/github-trending-plus)** ([Live](https://github-trending-plus.surge.sh/)): ✨ Experimental Github trending UI.
- **[HitUp](https://github.com/wonderbeyond/HitUP)** ([Chrome Store](https://chrome.google.com/webstore/detail/hitup/eiokaohkigpbonodjcbjpecbnccijkjb)) ([Website](https://hitup.wondertools.top/)): Help you find top things, including GitHub Trending Repositories.
- **[Gitter](https://github.com/huangjianke/Gitter)**: Gitter for GitHub - 可能是目前颜值最高的GitHub小程序客户端.
- **[flutter_wanandroid](https://github.com/Sky24n/flutter_wanandroid)**:
Flutter完整项目,WanAndroid客户端,BLoC、RxDart 、国际化、主题色、启动页、引导页,拥有较好的项目结构&比较规范的代码!
- **[Gitter](https://github.com/huangjianke/Gitter)**: Gitter for GitHub - 可能是目前颜值最高的 GitHub 小程序客户端.
- **[flutter_wanandroid](https://github.com/Sky24n/flutter_wanandroid)**:
Flutter 完整项目,WanAndroid 客户端,BLoC、RxDart 、国际化、主题色、启动页、引导页,拥有较好的项目结构&比较规范的代码!
- **[vsc-github-trending](https://github.com/4gray/vsc-github-trending)**: ([VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=4gray.vsc-github-trending#overview)): Explore Github Trending repositories directly from Visual Studio Code
- **[TinyGitHub](https://github.com/k-lpmg/TinyGitHub)**: iOS app for GitHub with explore trending.
- **[SwiftHub](https://github.com/khoren93/SwiftHub)**: GitHub iOS client written in RxSwift and MVVM clean architecture.
Expand Down Expand Up @@ -112,23 +112,23 @@ https://github-trending-api.now.sh/developers?language=javascript&since=weekly

```json
[
...
{
"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",
"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

Receive popular languages and all languages.
Expand Down Expand Up @@ -268,6 +268,7 @@ Receive an array of trending developers.
{
username: 'google',
name: 'Google',
type: 'organization',
url: 'https://github.com/google',
avatar: 'https://avatars0.githubusercontent.com/u/1342004',
repo: {
Expand Down
4 changes: 4 additions & 0 deletions apiary.apib
Expand Up @@ -102,6 +102,7 @@ GitHub Trending API is a simple API to fetch trending repositories and developer
{
"username": "google",
"name": "Google",
"type": "organization",
"url": "https://github.com/google",
"avatar": "https://avatars0.githubusercontent.com/u/1342004",
"repo": {
Expand All @@ -113,6 +114,7 @@ GitHub Trending API is a simple API to fetch trending repositories and developer
{
"username": "davideuler",
"name": "david l euler",
"type": "user",
"url": "https://github.com/davideuler",
"avatar": "https://avatars3.githubusercontent.com/u/377983",
"repo": {
Expand All @@ -124,6 +126,7 @@ GitHub Trending API is a simple API to fetch trending repositories and developer
},
{
"username": "xingshaocheng",
"type": "user",
"url": "https://github.com/xingshaocheng",
"avatar": "https://avatars1.githubusercontent.com/u/4962837",
"repo": {
Expand All @@ -135,6 +138,7 @@ GitHub Trending API is a simple API to fetch trending repositories and developer
{
"username": "cyanharlow",
"name": "Diana Smith",
"type": "user",
"url": "https://github.com/cyanharlow",
"avatar": "https://avatars2.githubusercontent.com/u/8030961",
"repo": {
Expand Down
13 changes: 13 additions & 0 deletions src/__tests__/__snapshots__/fetch.js.snap
Expand Up @@ -2030,6 +2030,7 @@ Array [
"name": "illustrated-tls",
"url": "https://github.com/syncsynchalt/illustrated-tls",
},
"type": "user",
"url": "https://github.com/syncsynchalt",
"username": "syncsynchalt",
},
Expand All @@ -2041,6 +2042,7 @@ Array [
"name": "awesome-piracy",
"url": "https://github.com/Igglybuff/awesome-piracy",
},
"type": "user",
"url": "https://github.com/Igglybuff",
"username": "Igglybuff",
},
Expand All @@ -2052,6 +2054,7 @@ Array [
"name": "percollate",
"url": "https://github.com/danburzo/percollate",
},
"type": "user",
"url": "https://github.com/danburzo",
"username": "danburzo",
},
Expand All @@ -2074,6 +2077,7 @@ Array [
"name": "warp",
"url": "https://github.com/dgiagio/warp",
},
"type": "user",
"url": "https://github.com/dgiagio",
"username": "dgiagio",
},
Expand Down Expand Up @@ -2129,6 +2133,7 @@ Array [
"name": "requests-html",
"url": "https://github.com/kennethreitz/requests-html",
},
"type": "user",
"url": "https://github.com/kennethreitz",
"username": "kennethreitz",
},
Expand All @@ -2150,6 +2155,7 @@ Array [
"name": "JavaScript30",
"url": "https://github.com/wesbos/JavaScript30",
},
"type": "user",
"url": "https://github.com/wesbos",
"username": "wesbos",
},
Expand All @@ -2161,6 +2167,7 @@ Array [
"name": "os-tutorial",
"url": "https://github.com/cfenollosa/os-tutorial",
},
"type": "user",
"url": "https://github.com/cfenollosa",
"username": "cfenollosa",
},
Expand All @@ -2183,6 +2190,7 @@ Array [
"name": "linux",
"url": "https://github.com/torvalds/linux",
},
"type": "user",
"url": "https://github.com/torvalds",
"username": "torvalds",
},
Expand All @@ -2205,6 +2213,7 @@ Array [
"name": "awesome",
"url": "https://github.com/sindresorhus/awesome",
},
"type": "user",
"url": "https://github.com/sindresorhus",
"username": "sindresorhus",
},
Expand All @@ -2216,6 +2225,7 @@ Array [
"name": "amiga2000-gfxcard",
"url": "https://github.com/mntmn/amiga2000-gfxcard",
},
"type": "user",
"url": "https://github.com/mntmn",
"username": "mntmn",
},
Expand All @@ -2227,6 +2237,7 @@ Array [
"name": "developer-roadmap",
"url": "https://github.com/kamranahmedse/developer-roadmap",
},
"type": "user",
"url": "https://github.com/kamranahmedse",
"username": "kamranahmedse",
},
Expand All @@ -2238,6 +2249,7 @@ Array [
"name": "interviews",
"url": "https://github.com/kdn251/interviews",
},
"type": "user",
"url": "https://github.com/kdn251",
"username": "kdn251",
},
Expand Down Expand Up @@ -2271,6 +2283,7 @@ Array [
"name": "Algorithm_Interview_Notes-Chinese",
"url": "https://github.com/imhuay/Algorithm_Interview_Notes-Chinese",
},
"type": "user",
"url": "https://github.com/imhuay",
"username": "imhuay",
},
Expand Down
7 changes: 7 additions & 0 deletions src/fetch.js
Expand Up @@ -170,16 +170,23 @@ export async function fetchDevelopers({ language = '', since = 'daily' } = {}) {
/^\((.+)\)$/i
);
$dev.find('.f3 a span').remove();

const username = $dev
.find('.f3 a')
.text()
.trim();

const type = $dev
.find('img')
.parent()
.attr('data-hovercard-type');

const $repo = $dev.find('.repo-snipit');

return omitNil({
username,
name,
type,
url: `${GITHUB_URL}${relativeUrl}`,
avatar: removeDefaultAvatarSize($dev.find('img').attr('src')),
repo: {
Expand Down

1 comment on commit 6e3ec76

@vercel
Copy link

@vercel vercel bot commented on 6e3ec76 Apr 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully aliased the URL https://github-trending-api-klfxntojuz.now.sh to the following alias.

Please sign in to comment.