A modern YouTube and video platform downloader library
Project description
ytdl-taquitos
A modern YouTube and video platform downloader library written in Python.
Features
- Download videos and audio from YouTube
- Support for multiple video qualities
- Download subtitles in various languages
- Progress tracking with speed limiting
- Modern async/await API
- Type hints for better IDE support
Installation
pip install ytdl-taquitos
Usage
Basic Usage
import asyncio
from ytdl_taquitos import YouTubeExtractor, Downloader
async def main():
# Initialize extractor and downloader
extractor = YouTubeExtractor()
downloader = Downloader(output_dir="./downloads")
try:
# Get video info
video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
video_info = await extractor.extract_info(video_url)
# Download video
format = next(f for f in video_info.formats if f.quality == "720p")
await downloader.download_file(format.url, f"{video_info.id}.{format.ext}")
# Download subtitles
for lang, url in video_info.subtitles.items():
await downloader.download_subtitle(url, lang, video_info.id)
finally:
await downloader.close()
asyncio.run(main())
Advanced Usage
import asyncio
from ytdl_taquitos import YouTubeExtractor, Downloader
async def main():
extractor = YouTubeExtractor()
downloader = Downloader(
output_dir="./downloads",
speed_limit=1024 * 1024, # 1MB/s
chunk_size=512 * 1024, # 512KB chunks
)
try:
# Get video info
video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
video_info = await extractor.extract_info(video_url)
# Print available formats
for fmt in video_info.formats:
print(f"Format: {fmt.quality} ({fmt.ext})")
if fmt.is_audio_only:
print(" Audio only")
elif fmt.is_video_only:
print(" Video only")
else:
print(" Combined")
# Download highest quality video
best_format = max(
(f for f in video_info.formats if not f.is_audio_only),
key=lambda f: f.height or 0
)
await downloader.download_file(
best_format.url,
f"{video_info.id}.{best_format.ext}"
)
finally:
await downloader.close()
asyncio.run(main())
Development
Setup
- Clone the repository
- Create a virtual environment
- Install development dependencies:
pip install -e ".[dev]"
Running Tests
pytest
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ytdl_taquitos-0.1.1.tar.gz
(8.2 kB
view details)
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 ytdl_taquitos-0.1.1.tar.gz.
File metadata
- Download URL: ytdl_taquitos-0.1.1.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b2bca244105290bcfa7ccd4039b261486ffa5aa2d9b6bd3fd4ca8a8f03c6d0f
|
|
| MD5 |
70119868d42b10435e20cb924a32e100
|
|
| BLAKE2b-256 |
9f7ff614f0adac1eb3f8631a45a04a3f5807045724ab4ef797ee6faee6e1c5a6
|
File details
Details for the file ytdl_taquitos-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ytdl_taquitos-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcf9871a4c8702a70343365972396bab50f9fd3c9996497b25c3c98c2a69ed75
|
|
| MD5 |
1ba4d331a05ea85c51101c97eec91cd2
|
|
| BLAKE2b-256 |
ded3863ab84169272c8b1124f7c1dd13c422a7d1171229619ebeb3787ed338ca
|