YouTube Downloader
A Python library for downloading videos from YouTube and YouTube Mix playlists.
Installation
pip install youtube-mix-dl==0.1.4
Dependencies
pip install selenium>=4.0.0 webdriver-manager>=3.8.0 yt-dlp>=2023.0.0
System Requirements
FFmpeg Installation
-
Windows:
winget install FFmpeg -
Linux:
sudo apt update && sudo apt install ffmpeg -
macOS:
brew install ffmpeg -
Google Chrome/Chromium browser
-
ChromeDriver (auto-installed by webdriver-manager)
Usage Examples
Test Script (test.py)
from youtube_mix_dl import YouTubeDownloader
def progress_callback(message):
print(message)
# Initialize downloader
downloader = YouTubeDownloader(
output_path="downloads",
progress_callback=progress_callback
)
# 1. Download single video
video_url = "https://www.youtube.com/watch?v=Mude7cCSs9s"
print("\nDownloading single video...")
success = downloader.download_video(video_url)
print(f"Single video download {'successful' if success else 'failed'}")
# 2. Download audio only
print("\nDownloading audio only...")
audio_options = {
'format': 'bestaudio[ext=m4a]',
'postprocessors': [{'key': 'FFmpegExtractAudio'}]
}
success = downloader.download_video(video_url, audio_options)
print(f"Audio download {'successful' if success else 'failed'}")
# 3. Download from music mix playlist
mix_url = "https://www.youtube.com/watch?v=Mude7cCSs9s&list=RDMude7cCSs9s&start_radio=1"
print("\nDownloading from music mix playlist...")
mix_downloads = downloader.download_mix(mix_url, num_videos=3)
print(f"Downloaded {mix_downloads} videos from mix")
# 4. Download from normal playlist
playlist_url = "https://www.youtube.com/playlist?list=PLPTV0NXA_ZSgsLAr8YCgCwhPIJNNtexWu"
print("\nDownloading from normal playlist...")
playlist_downloads = downloader.download_playlist(playlist_url, num_videos=3)
print(f"Downloaded {playlist_downloads} videos from playlist")
# 5. Get video information
print("\nGetting video information...")
info = downloader.get_video_info(video_url)
if info:
print(f"Video title: {info.get('title')}")
print(f"Duration: {info.get('duration')} seconds")
print(f"View count: {info.get('view_count')}")
Run the test script:
python test.py
Individual Features
1. Single Video Download
from youtube_mix_dl import YouTubeDownloader
downloader = YouTubeDownloader(output_path="downloads")
success = downloader.download_video("https://www.youtube.com/watch?v=Mude7cCSs9s")
2. Audio Only Download
options = {
'format': 'bestaudio[ext=m4a]',
'postprocessors': [{'key': 'FFmpegExtractAudio'}]
}
success = downloader.download_video("https://www.youtube.com/watch?v=Mude7cCSs9s", options)
3. Music Mix Playlist Download
downloader = YouTubeDownloader(
output_path="downloads",
progress_callback=lambda msg: print(msg)
)
successful_downloads = downloader.download_mix(
"https://www.youtube.com/watch?v=Mude7cCSs9s&list=RDMude7cCSs9s&start_radio=1",
num_videos=5
)
4. Normal Playlist Download
successful_downloads = downloader.download_playlist(
"https://www.youtube.com/playlist?list=PLPTV0NXA_ZSgsLAr8YCgCwhPIJNNtexWu",
num_videos=5
)
Features
- Single video and playlist downloads (music mix and normal playlists)
- Audio-only downloads
- Progress tracking with callbacks
- High-quality video/audio
- Automatic stream merging
- Error handling
- Video information retrieval
Troubleshooting
Common Issues
-
No Audio
- Verify FFmpeg:
ffmpeg -version - Check PATH settings
- Verify FFmpeg:
-
ChromeDriver Issues
- Update Chrome
- Let webdriver-manager handle installation
-
Permission Issues
- Check output directory permissions
- Run with appropriate privileges
Development
# Setup
git clone https://github.com/benny-png/YOUR_YOUTUBE_MUSIC_MIX_DOWNLOADER.git
cd YOUR_YOUTUBE_MUSIC_MIX_DOWNLOADER
python -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
# Install dev dependencies
pip install build twine pytest black isort mypy
pip install -e .
License
MIT License
Metadata
Release files for youtube-mix-dl 0.1.4
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 |
|---|---|---|---|---|
| youtube_mix_dl-0.1.4.tar.gz | 9.0 kB | Without provenance | Details for youtube_mix_dl-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| youtube_mix_dl-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for youtube_mix_dl-0.1.4-py3-none-any.whl |
Total release size: 15.2 kB
Release files / youtube_mix_dl-0.1.4.tar.gz
| Download URL | youtube_mix_dl-0.1.4.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7bc01e350acf95466982cf665c45c93daafefd348efae15cf6bddbbff97a0cd9
|
|
BLAKE2b-256 checksum How to use checksums |
e00de08cc54a5e573ea072172bd792fdd2a0a89ae40650725ac0724d05e3be85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Release files / youtube_mix_dl-0.1.4-py3-none-any.whl
| Download URL | youtube_mix_dl-0.1.4-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a66802c4ef158085b038a5653ffbea85c9466aca7a87d79dafa80d556c13e41a
|
|
BLAKE2b-256 checksum How to use checksums |
f8a253ddc876700c38c7c1e7bfacaa296753f80be0669e86d91129fa5bc196c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.3
|
Security for youtube-mix-dl 0.1.4
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.