This project is a FastAPI application that scrapes GitHub repositories for a given username and returns the repository details including the project link.
- Scrapes GitHub repositories for a given username
- Returns repository details including name, description, language, and link
- Exports repository data to a CSV file
- Python 3.7+
pip
(Python package installer)
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name
-
Create a virtual environment:
mkdir env python3 -m venv env
-
Activate the virtual environment:
- On macOS and Linux:
source env/bin/activate
- On Windows:
.\env\Scripts\activate
- On macOS and Linux:
-
Install the dependencies:
pip install -r requirements.txt
-
Run the FastAPI application:
uvicorn main:app --reload
-
Access the API: Open your browser and go to
http://127.0.0.1:8000
. -
Scrape GitHub repositories:
- Send a POST request to
/scrape
with a JSON payload containing the GitHub username. - Example using
curl
:curl -X POST "http://127.0.0.1:8000/scrape" -H "Content-Type: application/json" -d '{"username": "octocat"}'
- Send a POST request to
-
View the scraped data: The API will return a JSON response with the repository details.
Here is an example of how to use the API:
-
Start the server:
uvicorn main:app --reload
-
Send a POST request:
curl -X POST "http://127.0.0.1:8000/scrape" -H "Content-Type: application/json" -d '{"username": "octocat"}'
-
Response:
{ "repositories": [ { "name": "Hello-World", "description": "My first repository on GitHub!", "language": "Python", "link": "https://github.com/octocat/Hello-World" }, ... ] }
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.