Python查看大佬Github上全部项目的Star数量和统计
2023-09-27 14:23:05 时间
import json, requests
# 【重要】大佬Github的ID
user = 'wangrongsheng'
repo_list = []
page_id = 1
while True:
url = 'https://api.github.com/users/{}/repos?page={}'.format(user, page_id)
print(url)
r = requests.get(url)
repo_array = json.loads(r.content.decode('utf-8'))
if len(repo_array) == 0:
break
for repo in repo_array:
if not repo['fork']:
repo_list.append([repo['name'], repo['stargazers_count'], repo['forks_count']])
page_id += 1
# 排序
repo_list = sorted(repo_list, key=lambda x: x[1], reverse=True)
print('=' * 55)
print('\n'.join(['{: <40}★{: <10}\tfork {} '.format(*repo) for repo in repo_list]))
print('=' * 55)
print('{: <40}★{: <10}\tfork {} '.format('total', sum([i[1] for i in repo_list]), sum([i[2] for i in repo_list])))
相关文章
- python中__get__,__getattr__,__getattribute__的区别
- Python爬虫爬取美剧网站
- Python创建删除文件
- Python如何做自动化测试?
- Python编程:DBUtils管理数据库连接池
- Hands-On Reinforcement Learning With Python——Temporal Difference Learning
- python实现两台不同主机之间进行通信(客户端和服务端)——Socket
- 2016年GitHub排名前20的Python机器学习开源项目(转)
- Github标星57k+,如何用Python实现所有算法!
- 我们怎么卷?推荐6款GitHub上的Python热门项目,一起学起来
- 用PYTHON + PYWIN32 + WMI获取WINDOWS系统基本信息
- Python 决定迁移到 GitHub