Create wiki page 'Home'
+68
@@ -0,0 +1,68 @@
|
||||
# yt-shorts-downloader
|
||||
|
||||
Typed Python library and CLI for downloading YouTube Shorts as MP4 using a Netscape cookie session file.
|
||||
|
||||
## What this project does
|
||||
|
||||
- validates a Netscape cookie file before download
|
||||
- validates that the URL belongs to YouTube
|
||||
- downloads the resulting video as MP4 through yt-dlp
|
||||
- exposes a typed Python API for returning MP4 bytes in memory
|
||||
- provides a CLI for saving the MP4 to disk
|
||||
- publishes package builds to Gitea Packages after successful CI on `main`
|
||||
|
||||
## Public contract
|
||||
|
||||
- input: YouTube URL and path to a Netscape cookie file
|
||||
- API output: `DownloadedVideo` with MP4 bytes in memory
|
||||
- CLI output: filesystem path to the downloaded MP4
|
||||
|
||||
## Quick start
|
||||
|
||||
### Python API
|
||||
|
||||
```python
|
||||
from yt_shorts_downloader import download
|
||||
|
||||
video = download(
|
||||
'https://www.youtube.com/shorts/VIDEO_ID',
|
||||
'cookies.txt',
|
||||
)
|
||||
|
||||
assert video.media_type == 'video/mp4'
|
||||
content = video.content
|
||||
```
|
||||
|
||||
### Save directly to disk
|
||||
|
||||
```python
|
||||
from yt_shorts_downloader import download_to_path
|
||||
|
||||
path = download_to_path(
|
||||
'https://www.youtube.com/shorts/VIDEO_ID',
|
||||
'cookies.txt',
|
||||
output_dir='downloads',
|
||||
)
|
||||
```
|
||||
|
||||
### CLI
|
||||
|
||||
```bash
|
||||
uv run yt-shorts-downloader \
|
||||
'https://www.youtube.com/shorts/VIDEO_ID' \
|
||||
cookies.txt \
|
||||
--output-dir downloads
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.12+
|
||||
- valid Netscape cookie file
|
||||
- Deno or Node.js 22+
|
||||
- optional but recommended: ffmpeg
|
||||
|
||||
## Documentation
|
||||
|
||||
- [API](API)
|
||||
- [Session File](Session-File)
|
||||
- [Development and CI](Development-and-CI)
|
||||
Reference in New Issue
Block a user