Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions GitHub Repo Analyzer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# GitHub Repo Analyzer

A simple Python tool that analyzes any GitHub repository using the GitHub API and displays useful information about the repository.

## 🚀 Features

* Fetch repository details using GitHub API
* Display repository name
* Show primary programming language
* Get repository size
* Check if the repo is a fork
* Display clone URL
* Show number of forks
* Show repository visibility (public/private)
* Display language statistics

## 🛠️ Tech Stack

* Python
* GitHub REST API
* Requests Library

## 📦 Installation

1. Clone the repository

```
git clone https://github.com/your-username/github-repo-analyzer.git
```

2. Install dependencies

```
pip install requests
```

## ▶️ Usage

Run the script:

```
python analyzer.py
```

Example:

```
Enter GitHub Repo URL:
https://github.com/user/repository
```

Output example:

```
Name: Bank-Statement-Analyzer
Language: Python
Fork: False
Size: 10680
Visibility: Public
Clone URL: https://github.com/user/repository.git
Forks: 2
```

## 📚 Future Improvements

* Show top contributors
* Show commit count
* Show open issues and pull requests
* Show repository topics
* Show stars and watchers
* Generate a full repository report
47 changes: 47 additions & 0 deletions GitHub Repo Analyzer/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import requests

url = input("ENTER REPO URL:- ")

# convert normal github url -> api url
parts = url.strip().split("/")
owner = parts[-2]
repo = parts[-1].replace(".git","")

api_url = f"https://api.github.com/repos/{owner}/{repo}"

response = requests.get(api_url)

if response.status_code != 200:
print("Repository not found")
exit()

data = response.json()

print("\nRepository Information\n")

print(f"Name: {data['name']}")
print(f"Owner: {data['owner']['login']}")
print(f"Description: {data['description']}")
print(f"Language: {data['language']}")
print(f"Stars: {data['stargazers_count']}")
print(f"Forks: {data['forks_count']}")
print(f"Open Issues: {data['open_issues_count']}")
print(f"Visibility: {data['visibility']}")
print(f"Size: {data['size']} KB")
print(f"Created At: {data['created_at']}")
print(f"Clone URL: {data['clone_url']}")

# contributors info-------
contributors = requests.get(f"{api_url}/contributors").json()
print(f"\nTotal Contributors: {len(contributors)}")

# Languages used----------
lang_data = requests.get(f"{api_url}/languages").json()

total = sum(lang_data.values())

print("\nLanguages Used:")

for lang in lang_data:
percent = (lang_data[lang] / total) * 100
print(f"{lang} : {percent:.2f}%")