I'm trying to get the GitHub user picture (avatar) from users of GitHub.
I've found these 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.
Is there some similar URL API to get what I'm looking for?
Use a Professional Profile PictureIf you're planning on showing your GitHub Profile to recruiters, admissions officers, or hiring managers, you need to make sure that your account looks trustworthy. Pick a photo of yourself that showcases your ability to be a qualified coder.
If you're a registered member of the GitHub Developer Program, building an app with the GitHub API, you'll get a Developer Program Member badge on your profile. For more information on the GitHub Developer Program, see GitHub Developer. If you use GitHub Pro you'll get a PRO badge on your profile.
According to GitHub API Search users, you can specify only searching by public email using keyword in . Then, you'll only get users with "franky" in there emails. Save this answer.
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).
Examples:
https://github.com/twbs.png
https://github.com/npm.png?size=200
https://github.com/github.png?size=40
https://developer.github.com/v3/users/#get-a-single-user
Use the /users/:user endpoint. Should be under avatar_url
in the returned json.
For example, my avatar_url can be found by hitting this url.
There is another way I can think of that is kind of roundabout. Since GitHub uses Gravatar, if you know the email associated with the account, do an md5 hash of the lowercase, stripped email address and construct a url like http://www.gravatar.com/avatar/[md5_here].
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With