Download any file or folder from GitHub repositories without cloning
Project description
GitHub Content Downloader
A powerful command-line tool to download files and folders from GitHub repositories. Download any file or entire directory from GitHub repositories without cloning - perfect for selectively downloading specific content.
Features
- Download single files from GitHub repositories
- Download entire folders recursively
- Download complete repositories
- Simple command-line interface (
ghcd) - Support for both file URLs (blob) and folder URLs (tree)
- Customizable download location
- No authentication required for public repositories
Installation
Option 1: Install from PyPI
pip install github-content-downloader
Option 2: Install from source
# Clone the repository
git clone https://github.com/soykot2910/github-content-downloader.git
# Navigate to the project directory
cd github-content-downloader
# Install the package
pip install .
Usage
Command Line Interface
- Download a complete repository:
ghcd https://github.com/username/repository
Example:
ghcd https://github.com/tensorflow/tensorflow
- Download a specific folder:
ghcd https://github.com/username/repository/tree/branch/folder
Example:
ghcd https://github.com/tensorflow/tensorflow/tree/master/tensorflow/python
- Download a single file:
ghcd https://github.com/username/repository/blob/branch/path/to/file
Example:
ghcd https://github.com/tensorflow/tensorflow/blob/master/README.md
- Specify custom output directory:
ghcd -o ./my-downloads <github-url>
- Interactive mode (if no URL provided):
ghcd
Command Line Options
ghcd --help
Available options:
-o, --output: Specify output directory (default: ./downloaded_files)-h, --help: Show help message
Python Package Usage
You can also use it as a Python package in your code:
from github_downloader import download_from_github
# Download complete repository
download_from_github("https://github.com/username/repository")
# Download specific folder
download_from_github(
"https://github.com/username/repository/tree/master/docs",
dest_folder="./my-downloads"
)
# Download single file
download_from_github(
"https://github.com/username/repository/blob/master/README.md"
)
URL Format Examples
1. Complete Repository
https://github.com/username/repository
Downloads the entire repository from the default branch (usually 'master' or 'main').
2. Specific Folder
https://github.com/username/repository/tree/branch/path/to/folder
Downloads only the specified folder and its contents.
3. Single File
https://github.com/username/repository/blob/branch/path/to/file
Downloads only the specified file.
Common Issues and Solutions
-
Permission Error: If you get a permission error while downloading, make sure you have write permissions in the output directory.
-
Invalid URL Format: Make sure your GitHub URL follows one of these patterns:
- Repository:
https://github.com/username/repo - Folder:
https://github.com/username/repo/tree/branch/path - File:
https://github.com/username/repo/blob/branch/path
- Repository:
-
Download Failed: If downloads fail, check:
- Your internet connection
- The repository is public and accessible
- The URL is correct and the resource exists
Requirements
- Python 3.6 or higher
requestslibrary (automatically installed with the package)
Development
Want to contribute? Great! Here's how:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Install development dependencies:
pip install -e .
- Make your changes
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
- Md.Soykot
- Email: md.soykot2910@gmail.com
- GitHub: @soykot2910
Support
If you encounter any issues or have questions, please:
- Check the Common Issues section
- Open an issue on GitHub
- Contact the author via email
Acknowledgments
- Thanks to GitHub for providing their API
- Inspired by the need to download specific parts of repositories without cloning
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file github_content_downloader-0.1.3.tar.gz.
File metadata
- Download URL: github_content_downloader-0.1.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8db3d5684ae69bb356a9c0d2fcb365d4e0101f301c2eeed69ad9f61663d6f8b
|
|
| MD5 |
990af5f793513c88ad58d8b9487e3ee5
|
|
| BLAKE2b-256 |
8ccd8301eadbfd912f715c6ed07538c4cd6609227a1702edf93f70d050c7b5b4
|
File details
Details for the file github_content_downloader-0.1.3-py3-none-any.whl.
File metadata
- Download URL: github_content_downloader-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39dbdf2d10bc0adc7f74c8e7eafd2ed64dc036b9fcac78ff2d9f1789f3a9c7fb
|
|
| MD5 |
1a2c4327d598cb796cad484d8885c461
|
|
| BLAKE2b-256 |
b48f10c1c23a5049981fb9cc3c6167cee5a70e2cf07e7f3bd4996a11cd871be9
|