使用Gtihub api 获取用户star项目
# 前言
最近发现从github找自己start项目需要花费一些时间,之前通过 github api
实现了一个picgo
上传图片原理, 于是想到使用 github api
动态获取项目。
# 测试
https://api.github.com/users/wuxin0011/starred?page=1
1
结果示例
[
{
"id": 73681508,
"node_id": "MDEwOlJlcG9zaXRvcnk3MzY4MTUwOA==",
"name": "wepy",
"full_name": "Tencent/wepy",
"private": false,
"owner": {
"login": "Tencent",
"id": 18461506,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NDYxNTA2",
"avatar_url": "https://avatars.githubusercontent.com/u/18461506?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Tencent",
"html_url": "https://github.com/Tencent",
"followers_url": "https://api.github.com/users/Tencent/followers",
"following_url": "https://api.github.com/users/Tencent/following{/other_user}",
"gists_url": "https://api.github.com/users/Tencent/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Tencent/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Tencent/subscriptions",
"organizations_url": "https://api.github.com/users/Tencent/orgs",
"repos_url": "https://api.github.com/users/Tencent/repos",
"events_url": "https://api.github.com/users/Tencent/events{/privacy}",
"received_events_url": "https://api.github.com/users/Tencent/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/Tencent/wepy",
"description": "小程序组件化开发框架",
"fork": false,
"url": "https://api.github.com/repos/Tencent/wepy",
"forks_url": "https://api.github.com/repos/Tencent/wepy/forks",
"keys_url": "https://api.github.com/repos/Tencent/wepy/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/Tencent/wepy/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/Tencent/wepy/teams",
"hooks_url": "https://api.github.com/repos/Tencent/wepy/hooks",
"issue_events_url": "https://api.github.com/repos/Tencent/wepy/issues/events{/number}",
"events_url": "https://api.github.com/repos/Tencent/wepy/events",
"assignees_url": "https://api.github.com/repos/Tencent/wepy/assignees{/user}",
"branches_url": "https://api.github.com/repos/Tencent/wepy/branches{/branch}",
"tags_url": "https://api.github.com/repos/Tencent/wepy/tags",
"blobs_url": "https://api.github.com/repos/Tencent/wepy/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/Tencent/wepy/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/Tencent/wepy/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/Tencent/wepy/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/Tencent/wepy/statuses/{sha}",
"languages_url": "https://api.github.com/repos/Tencent/wepy/languages",
"stargazers_url": "https://api.github.com/repos/Tencent/wepy/stargazers",
"contributors_url": "https://api.github.com/repos/Tencent/wepy/contributors",
"subscribers_url": "https://api.github.com/repos/Tencent/wepy/subscribers",
"subscription_url": "https://api.github.com/repos/Tencent/wepy/subscription",
"commits_url": "https://api.github.com/repos/Tencent/wepy/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/Tencent/wepy/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/Tencent/wepy/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/Tencent/wepy/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/Tencent/wepy/contents/{+path}",
"compare_url": "https://api.github.com/repos/Tencent/wepy/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/Tencent/wepy/merges",
"archive_url": "https://api.github.com/repos/Tencent/wepy/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/Tencent/wepy/downloads",
"issues_url": "https://api.github.com/repos/Tencent/wepy/issues{/number}",
"pulls_url": "https://api.github.com/repos/Tencent/wepy/pulls{/number}",
"milestones_url": "https://api.github.com/repos/Tencent/wepy/milestones{/number}",
"notifications_url": "https://api.github.com/repos/Tencent/wepy/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/Tencent/wepy/labels{/name}",
"releases_url": "https://api.github.com/repos/Tencent/wepy/releases{/id}",
"deployments_url": "https://api.github.com/repos/Tencent/wepy/deployments",
"created_at": "2016-11-14T08:06:56Z",
"updated_at": "2023-05-15T03:22:57Z",
"pushed_at": "2023-04-07T11:08:40Z",
"git_url": "git://github.com/Tencent/wepy.git",
"ssh_url": "git@github.com:Tencent/wepy.git",
"clone_url": "https://github.com/Tencent/wepy.git",
"svn_url": "https://github.com/Tencent/wepy",
"homepage": "https://wepyjs.gitee.io/wepy-docs/",
"size": 9541,
"stargazers_count": 22114,
"watchers_count": 22114,
"language": "JavaScript",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"has_discussions": false,
"forks_count": 3067,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 383,
"license": {
"key": "other",
"name": "Other",
"spdx_id": "NOASSERTION",
"url": null,
"node_id": "MDc6TGljZW5zZTA="
},
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [
"weapp",
"wepy"
],
"visibility": "public",
"forks": 3067,
"open_issues": 383,
"watchers": 22114,
"default_branch": "master"
},
]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
关键字段信息
- id 主键id
- name 仓库名称
- html_url 仓库地址
- description 仓库描述
- stargazers_count star 数量
- owner.avatar_url 头像
有了这几个关键信息就够了
# 测试
- 第一个输入框为过滤字段信息
- 第二个为选择github star 项目是排序是降序还是升序,默认不排序
- 第三个输入github 用户名,默认为我的github名
wuxin0011
说明:用户名不修改情况下是不出现搜索框的,搜索结果是缓存到本地中,减少请求接口次数
# 地址
编辑 (opens new window)
上次更新: 2024-05-21, 09:50:09