从电子邮件或名称获取GitHub头像 [英] Get GitHub avatar from email or name
问题描述
我正在尝试从GitHub用户那里获取GitHub用户图片(头像).
I'm trying to get the GitHub user picture (avatar) from users of GitHub.
我找到了以下API:
https://avatars.githubusercontent.com/<username>
https://avatars.githubusercontent.com/u/<userid>
但是我找不到从用户电子邮件或用户显示名称获取头像的方法. 我找不到有关的文档.
But I can't find a way to get the avatar from the user email or the user display name. I can't find documentation about that.
是否有一些类似的URL API可以满足我的需求?
Is there some similar URL API to get what I'm looking for?
推荐答案
您可以将.png
附加到用户个人资料的URL上,以重定向到他们的头像.您可以添加查询参数size
以指定小于默认宽度460px的尺寸(即,不允许大于460px).
You can append .png
to the URL for the User's profile to get redirected to their avatar. You can add the query param size
to specify a size smaller than the default of 460px wide (i.e. it won't allow larger than 460).
示例:
https://github.com/npm.png?size=200
https://github.com/github.png?size=40
这篇关于从电子邮件或名称获取GitHub头像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!