A bash script that fetches GitHub user IDs from a list of usernames and outputs the results to a CSV file. This tool is useful for bulk collecting GitHub user IDs for data analysis or integration purposes.
This tool uses the GitHub API which has rate limiting restrictions:
- For unauthenticated requests: 900 requests per minute
Before using this tool, you need to have the following installed:
bash
(comes pre-installed on most Unix-based systems)curl
for making HTTP requestsjq
for JSON parsing
sudo apt-get update
sudo apt-get install curl jq
brew install jq
sudo yum install curl jq
- Clone this repository:
git clone [repository-url]
cd github-id-utils
- Make the script executable:
chmod +x get_github_id.sh
- Create a CSV file containing GitHub usernames (one per line):
echo "torvalds" > github_users.csv
echo "octocat" >> github_users.csv
- Run the script:
./get_github_id.sh github_users.csv
The script will:
- Process each username
- Create a new CSV file with results (named with timestamp)
- Show progress as it runs
- Provide a summary when complete
The output CSV file will contain:
username
: The GitHub usernamegithub_id
: The user's GitHub ID (or NA if not found)status
: Either "success" or an error message
Example output:
username,github_id,status
torvalds,1024025,success
octocat,583231,success
The script handles several common issues:
- Rate limiting (waits if limit is reached)
- Malformed usernames
- Empty lines in input file
- API errors
Feel free to open issues or submit pull requests with improvements.
MIT License - feel free to use this tool for any purpose.