Search code examples
githubgithub-api

Get repository metadata using repository url


I can search repositories by name, description, topic, etc.

Details - https://help.github.com/en/articles/searching-for-repositories#in-this-article

What's the easiest way to get repo metadata like stargazers_count, watchers_count, etc. from the repository url?


Solution

  • Every repository will be of the form https://github.com/:owner/:repo. You can then use this API call to fetch the information you want for each repository, replacing :owner and :repo in the URL.

    For example, for https://github.com/torvalds/linux, you'd fetch https://api.github.com/repos/torvalds/linux and parse the information from the JSON.