YDisk Downloader
Fast and efficient Yandex Disk folder downloader with async support.
A Python command-line tool for downloading folders from Yandex Disk with support for:
- 📁 Public links - No authentication required
- 🔐 Private folders - OAuth token authentication
- ⚡ Concurrent downloads - Multiple files at once for speed
- 📊 Progress tracking - Visual progress bar with tqdm
- 🔄 Resume capability - Skip already downloaded files
- 📂 Folder structure - Preserves directory hierarchy
Installation
From Source
# Clone the repository
git clone https://github.com/MyDum-bsu/YDiskDownloader.git
cd YDiskDownloader
# Install with pip
pip install -e .
# Or install with development dependencies
pip install -e ".[dev]"
Using pip (after publishing)
pip install ydisk-downloader
Quick Start
Download from Public Link
# Basic usage
ydisk-downloader download https://disk.yandex.ru/d/xxxxx /path/to/save
# Example: Download to external HDD
ydisk-downloader download https://disk.yandex.ru/d/abc123xyz /media/external/backup
Download Private Folder
# With token option
ydisk-downloader download /Photos/Vacation /path/to/save --token YOUR_TOKEN
# With environment variable
export YANDEX_DISK_TOKEN=your_token_here
ydisk-downloader download /Photos/Vacation /path/to/save
Getting an OAuth Token
To access private folders, you need an OAuth token:
-
Visit the authorization URL:
https://oauth.yandex.com/authorize?response_type=token&client_id=c0ebe342af7d48fbbbfcf2d2eedb8f9b -
Log in to your Yandex account
-
Grant permission to the application
-
Copy the token from the redirect URL (after
#access_token=)
Or use the built-in help:
ydisk-downloader token-help
Token Storage Options
You can store your token in several ways:
-
Environment variable (recommended for scripts):
export YANDEX_DISK_TOKEN=your_token_here
-
Command-line option:
ydisk-downloader download SOURCE DEST --token YOUR_TOKEN
-
Configuration file:
# Save token to file echo "your_token_here" > ~/.ydisk-token
Usage
Commands
# Download a folder
ydisk-downloader download SOURCE DESTINATION [OPTIONS]
# Show disk information
ydisk-downloader info --token YOUR_TOKEN
# Get help with tokens
ydisk-downloader token-help
# Show version
ydisk-downloader --version
Download Options
| Option | Description |
|---|---|
--token, -t |
OAuth token for private folders |
--concurrent, -c |
Maximum concurrent downloads (default: 5) |
--no-skip |
Download files even if they already exist |
--no-verify |
Skip file size verification after download |
--quiet, -q |
Suppress progress output |
--no-banner |
Don't show the startup banner |
Examples
# Download with 10 concurrent connections
ydisk-downloader download https://disk.yandex.ru/d/xxxxx /path/to/save -c 10
# Re-download all files (don't skip existing)
ydisk-downloader download https://disk.yandex.ru/d/xxxxx /path/to/save --no-skip
# Quiet mode (no progress bar)
ydisk-downloader download https://disk.yandex.ru/d/xxxxx /path/to/save -q
# Download private folder
ydisk-downloader download /Documents/Work /backup/work --token $YANDEX_DISK_TOKEN
Python API
You can also use the library programmatically:
import asyncio
from ydisk_downloader import YDiskDownloader, print_stats
async def main():
# Create downloader
async with YDiskDownloader(
max_concurrent=10,
skip_existing=True,
verify_size=True,
) as downloader:
# Download from public link
stats = await downloader.download_folder(
"https://disk.yandex.ru/d/xxxxx",
"/path/to/save"
)
# Print statistics
print_stats(stats)
print(f"Downloaded: {stats.downloaded_files} files")
print(f"Total size: {stats.downloaded_size} bytes")
print(f"Skipped: {stats.skipped_files} files")
print(f"Failed: {stats.failed_files} files")
asyncio.run(main())
Using with Private Folders
import asyncio
from ydisk_downloader import YDiskDownloader
async def main():
async with YDiskDownloader(token="your_token_here") as downloader:
stats = await downloader.download_folder(
"/Photos/Vacation",
"/backup/vacation"
)
asyncio.run(main())
Advanced Usage
import asyncio
from ydisk_downloader import YDiskDownloader, YandexDiskClient
async def list_files():
"""List all files in a private folder."""
async with YandexDiskClient(token="your_token") as client:
files = await client.collect_all_files("/Photos")
for f in files:
print(f"{f.name} - {f.size} bytes")
asyncio.run(list_files())
Features
Concurrent Downloads
The downloader uses asyncio and aiohttp to download multiple files concurrently, significantly improving download speed for folders with many small files.
Resume Capability
By default, the downloader skips files that already exist in the destination with the correct size. This allows you to resume interrupted downloads without re-downloading everything.
Progress Tracking
A progress bar shows:
- Total bytes downloaded
- Download speed
- Estimated time remaining
Error Handling
The downloader handles various error conditions:
- Network errors with automatic retries
- Rate limiting with exponential backoff
- Authentication errors
- File system errors
Requirements
- Python 3.9 or higher
- Linux, macOS, or Windows
Dependencies
aiohttp- Async HTTP clientaiofiles- Async file operationstqdm- Progress barsclick- CLI framework
Troubleshooting
"OAuth token required" error
Make sure you've provided a valid OAuth token:
export YANDEX_DISK_TOKEN=your_token
# or
ydisk-downloader download SOURCE DEST --token your_token
"Resource not found" error
- For public links: Make sure the link is correct and the resource is still public
- For private folders: Make sure the path is correct and you have access
Slow downloads
Try increasing the number of concurrent downloads:
ydisk-downloader download SOURCE DEST -c 10
"No write permission" error
Make sure you have write access to the destination directory:
# Check permissions
ls -la /path/to/destination
# Create directory if needed
mkdir -p /path/to/destination
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Acknowledgments
Metadata
Release files for ydisk-downloader 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ydisk_downloader-1.0.0.tar.gz | 18.0 kB | Without provenance | Details for ydisk_downloader-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ydisk_downloader-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for ydisk_downloader-1.0.0-py3-none-any.whl |
Total release size: 35.9 kB
Release files / ydisk_downloader-1.0.0.tar.gz
| Download URL | ydisk_downloader-1.0.0.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15d9b554c28f0b030381c734a5b464d11556f6ecd047b0f7da84841ac567c900
|
|
BLAKE2b-256 checksum How to use checksums |
6675fe4929b0f0eddba971894bd1dc414511f84e0023cd3689e4ff751198941c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ydisk_downloader-1.0.0-py3-none-any.whl
| Download URL | ydisk_downloader-1.0.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1f5d3cd0c19f0fedb27d31f9c5b93434363005fc5c2363e07e68c572b80acd9
|
|
BLAKE2b-256 checksum How to use checksums |
055e83feb89a59c4af2ec4280d9bad07ade5e118bbccff173c6196a91a99a462
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for ydisk-downloader 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.