写了个统计 GitHub 账号仓库总 stars 的 API~

2020 年 2 月 22 日
 idealclover

这一切都要从一直蝙蝠说起~ XD

因为自己在 GitHub 上有些项目,但是 stars 都不是很多,一两百两三百的,看上去很没有逼格(划去)

于是想找个办法统计一下自己总共拿了多少 stars,展示出来方便装逼(划去)

但是翻了翻 GitHub 的 API 并没有看到能直接拿到总数的方法,于是自己写了个

已经部署在 Heroku 上了,路由是 user/:username

比方说想看我的就是这样 https://github-star-counter.herokuapp.com/user/idealclover

有了这个 API 之后就可以配合 shields.io 做一点更酷的事情

比如说把总 stars 和 forks 以徽章的方式呈现出来

但是因为担心网络超时和 V2EX 的缓存,提供了静态预览,像这样啦

这样挂在 blog 上还是有点逼格的(不是

欢迎来试试!

GitHub 地址: https://github.com/idealclover/GitHub-Star-Counter

我的博客: https://idealclover.top/

新手发帖有点小紧张~(逃

4581 次点击
所在节点    分享创造
20 条回复
RYAN0UP
2020 年 2 月 22 日
idealclover
2020 年 2 月 23 日
@RYAN0UP 哇!!太强了吧嘤嘤嘤
TristanYang
2020 年 2 月 23 日
想起了之前写的一个统计仓库每日新增 star 的小工具: https://stars.yangerxiao.com/
manami
2020 年 2 月 23 日
不错
llussy
2020 年 2 月 23 日
赞赞赞
idealclover
2020 年 2 月 23 日
@TristanYang 哇这个好棒! www 赞!~
那说不定可以合起来做一个统计总 star 增长的工具?
xcodebuild
2020 年 2 月 23 日
挺有意思的 API
idealclover
2020 年 2 月 23 日
@xcodebuild 🙈🙈🙈
justin2018
2020 年 2 月 24 日
justin2018
2020 年 2 月 24 日
已 star
TristanYang
2020 年 2 月 24 日
@idealclover 哈哈 你那个可以通过 url 传参的方式,链接到我这里,目前已支持: https://stars.yangerxiao.com/?repo=https://github.com/zerosoul/chinese-colors
idealclover
2020 年 2 月 24 日
@justin2018 哇! ww 这个好
我也好想有一天可以上榜哇(哭
idealclover
2020 年 2 月 24 日
@TristanYang 好!我回头试试!
hzlzh
2020 年 2 月 26 日
hzlzh
2020 年 2 月 26 日
@TristanYang https://stars.yangerxiao.com/?repo=https://github.com/hzlzh/Best-App
我这个库每次跑到 2019 年页面就会死掉?
TristanYang
2020 年 2 月 26 日
@hzlzh 死掉是白页吗?我试了下 并没有 可能是 2019 年数据略多吧 需要点时间加载。
idealclover
2020 年 2 月 26 日
好强啊!羡慕~
idealclover
2020 年 2 月 26 日
@hzlzh 好强啊!羡慕~
fengkx
2020 年 3 月 17 日
做了一个跑在 Cloudflare worker 上的版本。[https://github.com/fengkx/github-star-counter-cloudflare-worker]( https://github.com/fengkx/github-star-counter-cloudflare-worker) 完全一样的逻辑。
每天 10w 次免费请求。https://api.github-start-counter.workers.dev/

一切原自一个美丽的误会。原来 Cloudflare worker 注册时选的域名是 account 级的,我以为像 netlify 那样一个网站( worker )一个二级域名。而且还不能改。。。

这个 account 就献祭掉了~
idealclover
2020 年 3 月 17 日
@fengkx 呜呜呜呜呜呜我想着毕业论文写完之后做一个 cloudflare worker 版本的来的嘤嘤嘤

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/646651

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX