riptube 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- riptube-0.1.0/LICENSE +21 -0
- riptube-0.1.0/PKG-INFO +136 -0
- riptube-0.1.0/README.md +117 -0
- riptube-0.1.0/pyproject.toml +49 -0
- riptube-0.1.0/riptube/__init__.py +3 -0
- riptube-0.1.0/riptube/cli.py +38 -0
- riptube-0.1.0/riptube/downloader.py +103 -0
- riptube-0.1.0/riptube.egg-info/PKG-INFO +136 -0
- riptube-0.1.0/riptube.egg-info/SOURCES.txt +13 -0
- riptube-0.1.0/riptube.egg-info/dependency_links.txt +1 -0
- riptube-0.1.0/riptube.egg-info/entry_points.txt +2 -0
- riptube-0.1.0/riptube.egg-info/requires.txt +1 -0
- riptube-0.1.0/riptube.egg-info/top_level.txt +1 -0
- riptube-0.1.0/setup.cfg +4 -0
- riptube-0.1.0/setup.py +5 -0
riptube-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tiago Silva
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
riptube-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: riptube
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: YouTube video downloader with best quality
|
|
5
|
+
Author: tsilva
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/tsilva/riptube
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/tsilva/riptube/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: yt-dlp>=2023.0.0
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
<div align="center">
|
|
21
|
+
<img src="logo.png" alt="riptube" width="512"/>
|
|
22
|
+
|
|
23
|
+
# riptube
|
|
24
|
+
|
|
25
|
+
[](https://www.python.org/)
|
|
26
|
+
[](LICENSE)
|
|
27
|
+
[](https://github.com/yt-dlp/yt-dlp)
|
|
28
|
+
|
|
29
|
+
**📺 Download YouTube videos and extract audio with one command 🎵**
|
|
30
|
+
|
|
31
|
+
[Installation](#installation) · [Usage](#usage) · [Options](#options)
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
## Overview
|
|
35
|
+
|
|
36
|
+
[](https://github.com/tsilva/riptube/actions/workflows/release.yml)
|
|
37
|
+
|
|
38
|
+
A CLI tool for downloading YouTube videos and extracting audio tracks. Built on top of yt-dlp, it handles the complexities of video downloading with automatic format selection, audio extraction, and cookie support for restricted content.
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
- **Best quality by default** - Automatically selects the highest available video and audio quality
|
|
43
|
+
- **Audio extraction** - Extract audio tracks as MP3 files with a single flag
|
|
44
|
+
- **Cookie support** - Access age-restricted or private videos using browser cookies
|
|
45
|
+
- **Clean filenames** - Automatic sanitization of video titles for safe file names
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pipx install riptube
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Development install with uv
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
uv tool install . --editable
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The package is published on PyPI as `riptube`, and the installed command is `riptube`.
|
|
60
|
+
|
|
61
|
+
### Dependencies
|
|
62
|
+
|
|
63
|
+
| Dependency | Required | Purpose |
|
|
64
|
+
|------------|----------|---------|
|
|
65
|
+
| FFmpeg | Yes | Video/audio processing and merging |
|
|
66
|
+
| aria2 | No | Faster downloads (optional) |
|
|
67
|
+
|
|
68
|
+
**macOS:**
|
|
69
|
+
```bash
|
|
70
|
+
brew install ffmpeg aria2
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Linux:**
|
|
74
|
+
```bash
|
|
75
|
+
sudo apt install ffmpeg aria2
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Windows:**
|
|
79
|
+
Download FFmpeg from [ffmpeg.org](https://ffmpeg.org/download.html)
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
### Download a video
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Specify output file
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ -o video.mp4
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Extract audio only
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ -a
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Use cookies for restricted videos
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ -c cookies.txt
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Options
|
|
108
|
+
|
|
109
|
+
| Option | Description |
|
|
110
|
+
|--------|-------------|
|
|
111
|
+
| `-o, --output` | Output file path (default: auto-generated from video title) |
|
|
112
|
+
| `-a, --audio` | Extract audio track as MP3 |
|
|
113
|
+
| `-c, --cookies` | Path to Netscape format cookies.txt file |
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Clone and install in development mode
|
|
119
|
+
git clone https://github.com/tsilva/riptube.git
|
|
120
|
+
cd riptube
|
|
121
|
+
uv tool install . --editable
|
|
122
|
+
|
|
123
|
+
# Or install with pipx
|
|
124
|
+
pipx install . --force
|
|
125
|
+
|
|
126
|
+
# Run directly without installing
|
|
127
|
+
python -m riptube.cli <url>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Releases
|
|
131
|
+
|
|
132
|
+
Bumping the version in `pyproject.toml` on `main` triggers the release workflow, which builds the package, publishes it to PyPI, and then creates the matching GitHub release. The workflow can also be re-run manually from GitHub via `workflow_dispatch`.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
[MIT](LICENSE)
|
riptube-0.1.0/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="logo.png" alt="riptube" width="512"/>
|
|
3
|
+
|
|
4
|
+
# riptube
|
|
5
|
+
|
|
6
|
+
[](https://www.python.org/)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://github.com/yt-dlp/yt-dlp)
|
|
9
|
+
|
|
10
|
+
**📺 Download YouTube videos and extract audio with one command 🎵**
|
|
11
|
+
|
|
12
|
+
[Installation](#installation) · [Usage](#usage) · [Options](#options)
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
[](https://github.com/tsilva/riptube/actions/workflows/release.yml)
|
|
18
|
+
|
|
19
|
+
A CLI tool for downloading YouTube videos and extracting audio tracks. Built on top of yt-dlp, it handles the complexities of video downloading with automatic format selection, audio extraction, and cookie support for restricted content.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- **Best quality by default** - Automatically selects the highest available video and audio quality
|
|
24
|
+
- **Audio extraction** - Extract audio tracks as MP3 files with a single flag
|
|
25
|
+
- **Cookie support** - Access age-restricted or private videos using browser cookies
|
|
26
|
+
- **Clean filenames** - Automatic sanitization of video titles for safe file names
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pipx install riptube
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Development install with uv
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv tool install . --editable
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The package is published on PyPI as `riptube`, and the installed command is `riptube`.
|
|
41
|
+
|
|
42
|
+
### Dependencies
|
|
43
|
+
|
|
44
|
+
| Dependency | Required | Purpose |
|
|
45
|
+
|------------|----------|---------|
|
|
46
|
+
| FFmpeg | Yes | Video/audio processing and merging |
|
|
47
|
+
| aria2 | No | Faster downloads (optional) |
|
|
48
|
+
|
|
49
|
+
**macOS:**
|
|
50
|
+
```bash
|
|
51
|
+
brew install ffmpeg aria2
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Linux:**
|
|
55
|
+
```bash
|
|
56
|
+
sudo apt install ffmpeg aria2
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Windows:**
|
|
60
|
+
Download FFmpeg from [ffmpeg.org](https://ffmpeg.org/download.html)
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
### Download a video
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Specify output file
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ -o video.mp4
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Extract audio only
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ -a
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Use cookies for restricted videos
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ -c cookies.txt
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Options
|
|
89
|
+
|
|
90
|
+
| Option | Description |
|
|
91
|
+
|--------|-------------|
|
|
92
|
+
| `-o, --output` | Output file path (default: auto-generated from video title) |
|
|
93
|
+
| `-a, --audio` | Extract audio track as MP3 |
|
|
94
|
+
| `-c, --cookies` | Path to Netscape format cookies.txt file |
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Clone and install in development mode
|
|
100
|
+
git clone https://github.com/tsilva/riptube.git
|
|
101
|
+
cd riptube
|
|
102
|
+
uv tool install . --editable
|
|
103
|
+
|
|
104
|
+
# Or install with pipx
|
|
105
|
+
pipx install . --force
|
|
106
|
+
|
|
107
|
+
# Run directly without installing
|
|
108
|
+
python -m riptube.cli <url>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Releases
|
|
112
|
+
|
|
113
|
+
Bumping the version in `pyproject.toml` on `main` triggers the release workflow, which builds the package, publishes it to PyPI, and then creates the matching GitHub release. The workflow can also be re-run manually from GitHub via `workflow_dispatch`.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=42", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "riptube"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "YouTube video downloader with best quality"
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "tsilva"}
|
|
11
|
+
]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.8"
|
|
14
|
+
license = "MIT"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.9",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"yt-dlp>=2023.0.0",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
"Homepage" = "https://github.com/tsilva/riptube"
|
|
28
|
+
"Bug Tracker" = "https://github.com/tsilva/riptube/issues"
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
riptube = "riptube.cli:main"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools]
|
|
34
|
+
packages = ["riptube"]
|
|
35
|
+
|
|
36
|
+
[tool.pipx]
|
|
37
|
+
install-deps = true
|
|
38
|
+
python-version = ">=3.9"
|
|
39
|
+
external-dependencies = {ffmpeg = "ffmpeg -version"}
|
|
40
|
+
venv-provision-command = """
|
|
41
|
+
pip install --upgrade pip
|
|
42
|
+
python -c "import platform; import sys; exit('Not on Linux' != 'Linux' and 0 or 1)" || pip install aria2
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
[tool.ruff]
|
|
46
|
+
line-length = 100
|
|
47
|
+
|
|
48
|
+
[tool.ruff.lint]
|
|
49
|
+
select = ["E", "F", "I"]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import argparse
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from .downloader import download_video
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
parser = argparse.ArgumentParser(description="Download YouTube videos with best quality")
|
|
10
|
+
parser.add_argument("url", help="YouTube video URL to download")
|
|
11
|
+
parser.add_argument(
|
|
12
|
+
"-c",
|
|
13
|
+
"--cookies",
|
|
14
|
+
dest="cookies_file",
|
|
15
|
+
help="Path to a Netscape format cookies.txt file",
|
|
16
|
+
default=None,
|
|
17
|
+
)
|
|
18
|
+
parser.add_argument(
|
|
19
|
+
"-o",
|
|
20
|
+
"--output",
|
|
21
|
+
help="Output file path (default: auto-generated from video title)",
|
|
22
|
+
default=None,
|
|
23
|
+
)
|
|
24
|
+
parser.add_argument(
|
|
25
|
+
"-a",
|
|
26
|
+
"--audio",
|
|
27
|
+
dest="audio_only",
|
|
28
|
+
help="Extract audio track as MP3 file",
|
|
29
|
+
action="store_true",
|
|
30
|
+
)
|
|
31
|
+
args = parser.parse_args()
|
|
32
|
+
|
|
33
|
+
success = download_video(args.url, args.cookies_file, args.output, args.audio_only)
|
|
34
|
+
sys.exit(0 if success else 1)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if __name__ == "__main__":
|
|
38
|
+
main()
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
import glob
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
import shutil
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
import yt_dlp
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def sanitize_filename(filename):
|
|
13
|
+
"""Sanitize filename to remove special characters that might cause issues."""
|
|
14
|
+
sanitized = re.sub(r'[\\/*?:"<>|]', '_', filename)
|
|
15
|
+
sanitized = re.sub(r'_+', '_', sanitized)
|
|
16
|
+
return sanitized.strip('_')
|
|
17
|
+
|
|
18
|
+
def check_python_version():
|
|
19
|
+
if sys.version_info < (3, 9):
|
|
20
|
+
print("Warning: Python 3.8 is deprecated. Please use Python 3.9 or higher.")
|
|
21
|
+
|
|
22
|
+
def check_dependencies():
|
|
23
|
+
if not shutil.which('ffmpeg'):
|
|
24
|
+
print("Warning: FFmpeg not found. Install with:")
|
|
25
|
+
print(" sudo apt install ffmpeg")
|
|
26
|
+
# aria2c is optional, not needed for yt-dlp to work basically
|
|
27
|
+
|
|
28
|
+
def cleanup_part_files(directory="."):
|
|
29
|
+
part_files = glob.glob(os.path.join(directory, "*.part"))
|
|
30
|
+
for part_file in part_files:
|
|
31
|
+
try:
|
|
32
|
+
os.remove(part_file)
|
|
33
|
+
print(f"Removed leftover part file: {os.path.basename(part_file)}")
|
|
34
|
+
except Exception as e:
|
|
35
|
+
print(f"Could not remove {part_file}: {e}")
|
|
36
|
+
|
|
37
|
+
def download_video(url, cookies_file=None, output=None, audio_only=False):
|
|
38
|
+
"""
|
|
39
|
+
Download a video from YouTube with given parameters.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
url (str): YouTube video URL
|
|
43
|
+
cookies_file (str, optional): Path to a Netscape format cookies.txt file
|
|
44
|
+
output (str, optional): Output file path template
|
|
45
|
+
audio_only (bool, optional): Extract audio as MP3
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
bool: True if download was successful, False otherwise
|
|
49
|
+
"""
|
|
50
|
+
check_python_version()
|
|
51
|
+
check_dependencies()
|
|
52
|
+
|
|
53
|
+
cleanup_part_files()
|
|
54
|
+
|
|
55
|
+
# Set yt-dlp options
|
|
56
|
+
ydl_opts = {
|
|
57
|
+
'format': 'bestaudio/best' if audio_only else 'bestvideo+bestaudio/best',
|
|
58
|
+
'merge_output_format': 'mkv', # yt-dlp merges to mkv by default
|
|
59
|
+
'quiet': False,
|
|
60
|
+
'no_warnings': False,
|
|
61
|
+
'verbose': True,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Add output template if specified
|
|
65
|
+
if output:
|
|
66
|
+
ydl_opts['outtmpl'] = output
|
|
67
|
+
else:
|
|
68
|
+
ydl_opts['outtmpl'] = '%(title)s [%(id)s].%(ext)s'
|
|
69
|
+
|
|
70
|
+
# Add cookies file if specified
|
|
71
|
+
if cookies_file:
|
|
72
|
+
if os.path.isfile(cookies_file):
|
|
73
|
+
ydl_opts['cookiefile'] = cookies_file
|
|
74
|
+
else:
|
|
75
|
+
print(f"Warning: Cookies file not found: {cookies_file}")
|
|
76
|
+
|
|
77
|
+
# Configure audio extraction if requested
|
|
78
|
+
if audio_only:
|
|
79
|
+
ydl_opts['postprocessors'] = [{
|
|
80
|
+
'key': 'FFmpegExtractAudio',
|
|
81
|
+
'preferredcodec': 'mp3',
|
|
82
|
+
'preferredquality': '192',
|
|
83
|
+
}]
|
|
84
|
+
|
|
85
|
+
try:
|
|
86
|
+
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
|
87
|
+
print(f"Downloading: {url}")
|
|
88
|
+
ydl.download([url])
|
|
89
|
+
return True
|
|
90
|
+
except Exception as e:
|
|
91
|
+
print(f"Download failed: {e}")
|
|
92
|
+
return False
|
|
93
|
+
finally:
|
|
94
|
+
cleanup_part_files()
|
|
95
|
+
|
|
96
|
+
if __name__ == '__main__':
|
|
97
|
+
if len(sys.argv) < 2:
|
|
98
|
+
print("Usage: python3 youtube_downloader.py <YouTube URL>")
|
|
99
|
+
sys.exit(1)
|
|
100
|
+
|
|
101
|
+
url = sys.argv[1]
|
|
102
|
+
success = download_video(url)
|
|
103
|
+
sys.exit(0 if success else 1)
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: riptube
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: YouTube video downloader with best quality
|
|
5
|
+
Author: tsilva
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/tsilva/riptube
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/tsilva/riptube/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: yt-dlp>=2023.0.0
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
<div align="center">
|
|
21
|
+
<img src="logo.png" alt="riptube" width="512"/>
|
|
22
|
+
|
|
23
|
+
# riptube
|
|
24
|
+
|
|
25
|
+
[](https://www.python.org/)
|
|
26
|
+
[](LICENSE)
|
|
27
|
+
[](https://github.com/yt-dlp/yt-dlp)
|
|
28
|
+
|
|
29
|
+
**📺 Download YouTube videos and extract audio with one command 🎵**
|
|
30
|
+
|
|
31
|
+
[Installation](#installation) · [Usage](#usage) · [Options](#options)
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
## Overview
|
|
35
|
+
|
|
36
|
+
[](https://github.com/tsilva/riptube/actions/workflows/release.yml)
|
|
37
|
+
|
|
38
|
+
A CLI tool for downloading YouTube videos and extracting audio tracks. Built on top of yt-dlp, it handles the complexities of video downloading with automatic format selection, audio extraction, and cookie support for restricted content.
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
- **Best quality by default** - Automatically selects the highest available video and audio quality
|
|
43
|
+
- **Audio extraction** - Extract audio tracks as MP3 files with a single flag
|
|
44
|
+
- **Cookie support** - Access age-restricted or private videos using browser cookies
|
|
45
|
+
- **Clean filenames** - Automatic sanitization of video titles for safe file names
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pipx install riptube
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Development install with uv
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
uv tool install . --editable
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The package is published on PyPI as `riptube`, and the installed command is `riptube`.
|
|
60
|
+
|
|
61
|
+
### Dependencies
|
|
62
|
+
|
|
63
|
+
| Dependency | Required | Purpose |
|
|
64
|
+
|------------|----------|---------|
|
|
65
|
+
| FFmpeg | Yes | Video/audio processing and merging |
|
|
66
|
+
| aria2 | No | Faster downloads (optional) |
|
|
67
|
+
|
|
68
|
+
**macOS:**
|
|
69
|
+
```bash
|
|
70
|
+
brew install ffmpeg aria2
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Linux:**
|
|
74
|
+
```bash
|
|
75
|
+
sudo apt install ffmpeg aria2
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Windows:**
|
|
79
|
+
Download FFmpeg from [ffmpeg.org](https://ffmpeg.org/download.html)
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
### Download a video
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Specify output file
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ -o video.mp4
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Extract audio only
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ -a
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Use cookies for restricted videos
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
riptube https://www.youtube.com/watch?v=dQw4w9WgXcQ -c cookies.txt
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Options
|
|
108
|
+
|
|
109
|
+
| Option | Description |
|
|
110
|
+
|--------|-------------|
|
|
111
|
+
| `-o, --output` | Output file path (default: auto-generated from video title) |
|
|
112
|
+
| `-a, --audio` | Extract audio track as MP3 |
|
|
113
|
+
| `-c, --cookies` | Path to Netscape format cookies.txt file |
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Clone and install in development mode
|
|
119
|
+
git clone https://github.com/tsilva/riptube.git
|
|
120
|
+
cd riptube
|
|
121
|
+
uv tool install . --editable
|
|
122
|
+
|
|
123
|
+
# Or install with pipx
|
|
124
|
+
pipx install . --force
|
|
125
|
+
|
|
126
|
+
# Run directly without installing
|
|
127
|
+
python -m riptube.cli <url>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Releases
|
|
131
|
+
|
|
132
|
+
Bumping the version in `pyproject.toml` on `main` triggers the release workflow, which builds the package, publishes it to PyPI, and then creates the matching GitHub release. The workflow can also be re-run manually from GitHub via `workflow_dispatch`.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
riptube/__init__.py
|
|
6
|
+
riptube/cli.py
|
|
7
|
+
riptube/downloader.py
|
|
8
|
+
riptube.egg-info/PKG-INFO
|
|
9
|
+
riptube.egg-info/SOURCES.txt
|
|
10
|
+
riptube.egg-info/dependency_links.txt
|
|
11
|
+
riptube.egg-info/entry_points.txt
|
|
12
|
+
riptube.egg-info/requires.txt
|
|
13
|
+
riptube.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
yt-dlp>=2023.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
riptube
|
riptube-0.1.0/setup.cfg
ADDED