查看大佬Github上全部项目的Star数量

  |   0 评论   |   0 浏览   |   夜雨飘零

需要手动修改user参数,该参数为用户的Github ID

import json, requests

# 【重要】大佬Github的ID
user = 'yeyupiaoling'

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])))

输出如下:

https://api.github.com/users/yeyupiaoling/repos?page=1
https://api.github.com/users/yeyupiaoling/repos?page=2
https://api.github.com/users/yeyupiaoling/repos?page=3
=======================================================
LearnPaddle                             ★308       	fork 121 
LearnPaddle2                            ★129       	fork 73 
VoiceprintRecognition-Tensorflow        ★59        	fork 20 
FaceDataset                             ★42        	fork 15 
PaddlePaddle-DeepSpeech                 ★42        	fork 13 
MASR                                    ★38        	fork 6 
ClassificationForAndroid                ★36        	fork 23 
AudioClassification-Tensorflow          ★34        	fork 13 
Kersa-Speaker-Recognition               ★30        	fork 8 
PP-YOLO                                 ★26        	fork 13 
PaddlePaddle-SSD                        ★18        	fork 6 
BookSource                              ★17        	fork 4 
Tensorflow-FaceRecognition              ★17        	fork 8 
PaddlePaddle-CrowdNet                   ★11        	fork 0 
ReinforcementLearning                   ★11        	fork 1 
PaddlePaddleCourse                      ★10        	fork 7 
VoiceprintRecognition-PaddlePaddle      ★9         	fork 4 
AudioClassification-PaddlePaddle        ★8         	fork 4 
FaceKeyPointsMask                       ★8         	fork 6 
ChangeHumanBackground                   ★5         	fork 2 
PaddlePaddle-MTCNN                      ★5         	fork 3 
TestAndroidCV                           ★5         	fork 3 
PaddlePaddle-OCR                        ★3         	fork 1 
Age-Gender-MXNET                        ★2         	fork 0 
DetectionForAndroid                     ★2         	fork 0 
PaddlePaddle-Classification             ★2         	fork 2 
PPASR                                   ★2         	fork 1 
Pytorch-PPO                             ★2         	fork 0 
CameraXApp                              ★1         	fork 0 
yeyupiaoling.github.io                  ★1         	fork 0 
NettySendPhoto                          ★0         	fork 0 
=======================================================
total                                   ★883       	fork 357 

标题:查看大佬Github上全部项目的Star数量
作者:夜雨飘零
地址:https://blog.doiduoyi.com/articles/1616159954825.html

评论

发表评论