Skip to content

Python script using the GitHub REST API to fetch the complete list of users followed by a specified GitHub account, supporting pagination and saving the output to a text file.

Notifications You must be signed in to change notification settings

mao1910/github-following-fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

github-following-fetcher

Python script using the GitHub REST API to fetch the complete list of users followed by a specified GitHub account, supporting pagination and saving the output to a text file.

Features

  • Retrieves the full list of users a GitHub account is following.
  • Automatically handles pagination to fetch all users, even if the list is large.
  • Saves the result in a simple text file (following_users.txt) with one username per line.
  • Easy to customize and extend.

Prerequisites

  • Python 3.6 or newer.
  • requests library (install via pip install requests).

Usage

  1. Clone or download this repository.

  2. Open the script (github_following_fetcher.py) and modify the username variable to the GitHub username you want to fetch following users for:

    username = "target-github-username"
    
  3. Run the script:

    python github_following_fetcher.py
    
  4. The list of usernames the specified user is following will be saved to following_users.txt in the same directory.

How It Works

The script queries GitHub’s REST API endpoint to get the list of followed users, handling up to 100 users per API request. It reads the pagination information from API response headers to fetch all pages until complete. If the API returns an error or rate limit is hit, the script stops.

Notes

  • The script currently makes unauthenticated API requests. This limits you to 60 API calls per hour.
  • For larger user followings or frequent runs, you may want to modify the script to use a GitHub personal access token to increase rate limits.

License

This project is licensed under the MIT License.

Author

mao1910

Contributing

Feel free to submit pull requests, bug reports, or feature requests.

About

Python script using the GitHub REST API to fetch the complete list of users followed by a specified GitHub account, supporting pagination and saving the output to a text file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages