SgithiDownloader 1.0.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.
- sgithidownloader-1.0.0/LICENSE +21 -0
- sgithidownloader-1.0.0/PKG-INFO +150 -0
- sgithidownloader-1.0.0/README.md +117 -0
- sgithidownloader-1.0.0/SgithiDownloader.egg-info/PKG-INFO +150 -0
- sgithidownloader-1.0.0/SgithiDownloader.egg-info/SOURCES.txt +13 -0
- sgithidownloader-1.0.0/SgithiDownloader.egg-info/dependency_links.txt +1 -0
- sgithidownloader-1.0.0/SgithiDownloader.egg-info/entry_points.txt +2 -0
- sgithidownloader-1.0.0/SgithiDownloader.egg-info/requires.txt +9 -0
- sgithidownloader-1.0.0/SgithiDownloader.egg-info/top_level.txt +1 -0
- sgithidownloader-1.0.0/pyproject.toml +42 -0
- sgithidownloader-1.0.0/setup.cfg +4 -0
- sgithidownloader-1.0.0/sgithidownloader/__init__.py +74 -0
- sgithidownloader-1.0.0/sgithidownloader/audio.py +115 -0
- sgithidownloader-1.0.0/sgithidownloader/shared.py +24 -0
- sgithidownloader-1.0.0/sgithidownloader/video.py +23 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AceCJM
|
|
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.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SgithiDownloader
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A tool to download YouTube videos and audio with embedded thumbnails.
|
|
5
|
+
Author-email: AceCJM <sgithi.sgigigtat@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/AceCJM/SgithiDownloader
|
|
8
|
+
Keywords: youtube,downloader,video,audio,yt-dlp,pytube
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Topic :: Multimedia :: Video
|
|
19
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: certifi==2026.1.4
|
|
24
|
+
Requires-Dist: charset-normalizer==3.4.4
|
|
25
|
+
Requires-Dist: idna==3.11
|
|
26
|
+
Requires-Dist: mutagen==1.47.0
|
|
27
|
+
Requires-Dist: pillow==12.1.1
|
|
28
|
+
Requires-Dist: pytube==15.0.0
|
|
29
|
+
Requires-Dist: requests==2.32.5
|
|
30
|
+
Requires-Dist: urllib3==2.6.3
|
|
31
|
+
Requires-Dist: yt-dlp==2026.2.21
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# sgithidownloader
|
|
35
|
+
|
|
36
|
+
A Python tool to download YouTube videos and audio in various high-quality formats with embedded thumbnails and metadata.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Download individual YouTube videos or entire playlists
|
|
41
|
+
- Support for multiple video formats (MP4, WebM, etc.)
|
|
42
|
+
- Convert and download audio in various formats (Opus, MP3, FLAC, AAC, etc.)
|
|
43
|
+
- Automatically embed video thumbnails as album art
|
|
44
|
+
- Include metadata (title, artist, album, date, description) in supported formats
|
|
45
|
+
- Crop thumbnails to square format for better display
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
### Prerequisites
|
|
50
|
+
|
|
51
|
+
- Python 3.8 or higher
|
|
52
|
+
- FFmpeg (for audio processing)
|
|
53
|
+
|
|
54
|
+
### Install FFmpeg
|
|
55
|
+
|
|
56
|
+
**On Ubuntu/Debian:**
|
|
57
|
+
```bash
|
|
58
|
+
sudo apt update
|
|
59
|
+
sudo apt install ffmpeg
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**On macOS:**
|
|
63
|
+
```bash
|
|
64
|
+
brew install ffmpeg
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**On Windows:**
|
|
68
|
+
Download from [ffmpeg.org](https://ffmpeg.org/download.html) and add to PATH.
|
|
69
|
+
|
|
70
|
+
### Install the Package
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone <your-repo-url>
|
|
74
|
+
cd OpusDownloader
|
|
75
|
+
pip install .
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
For development:
|
|
79
|
+
```bash
|
|
80
|
+
pip install -e .
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
### Download a Single Video
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=VIDEO_ID" -o /path/to/output/
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Download a Playlist
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
sgithidownloader -p "https://www.youtube.com/playlist?list=PLAYLIST_ID" -o /path/to/output/
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Download Audio
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=VIDEO_ID" -f audio -af opus -o /path/to/output/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Options
|
|
104
|
+
|
|
105
|
+
- `-s, --single URL`: Download a single video
|
|
106
|
+
- `-p, --playlist URL`: Download all videos in a playlist
|
|
107
|
+
- `-o, --output DIR`: Output directory (default: current directory)
|
|
108
|
+
- `-f, --format FORMAT`: File format for video (mp4, webm, audio, etc.) (default: mp4)
|
|
109
|
+
- `-af, --audio_format FORMAT`: Audio format (best, aac, alac, flac, m4a, mp3, opus, vorbis, wav) (default: best)
|
|
110
|
+
- `-l, --listFormats`: List available audio formats and exit
|
|
111
|
+
- `--help`: Show help message
|
|
112
|
+
|
|
113
|
+
## Examples
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Download a single video to the current directory
|
|
117
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
|
118
|
+
|
|
119
|
+
# Download a playlist to a specific folder
|
|
120
|
+
sgithidownloader -p "https://www.youtube.com/playlist?list=PLrAXtmRdnEQy4qtr5G1G8jQGzq9j9j9j" -o ~/Videos/
|
|
121
|
+
|
|
122
|
+
# Download audio in MP3 format
|
|
123
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=dQw4w9WgXcQ" -f audio -af mp3 -o ~/Music/
|
|
124
|
+
|
|
125
|
+
# List available audio formats
|
|
126
|
+
sgithidownloader -l
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Dependencies
|
|
130
|
+
|
|
131
|
+
- yt-dlp: For downloading and extracting audio
|
|
132
|
+
- mutagen: For embedding metadata in audio files
|
|
133
|
+
- pytube: For playlist handling
|
|
134
|
+
- pillow: For image processing
|
|
135
|
+
- requests: For downloading thumbnails
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
MIT License - see LICENSE file for details.
|
|
140
|
+
|
|
141
|
+
## Contributing
|
|
142
|
+
|
|
143
|
+
1. Fork the repository
|
|
144
|
+
2. Create a feature branch
|
|
145
|
+
3. Make your changes
|
|
146
|
+
4. Submit a pull request
|
|
147
|
+
|
|
148
|
+
## Disclaimer
|
|
149
|
+
|
|
150
|
+
This tool is for personal use only. Respect YouTube's terms of service and copyright laws. The author is not responsible for misuse.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# sgithidownloader
|
|
2
|
+
|
|
3
|
+
A Python tool to download YouTube videos and audio in various high-quality formats with embedded thumbnails and metadata.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Download individual YouTube videos or entire playlists
|
|
8
|
+
- Support for multiple video formats (MP4, WebM, etc.)
|
|
9
|
+
- Convert and download audio in various formats (Opus, MP3, FLAC, AAC, etc.)
|
|
10
|
+
- Automatically embed video thumbnails as album art
|
|
11
|
+
- Include metadata (title, artist, album, date, description) in supported formats
|
|
12
|
+
- Crop thumbnails to square format for better display
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### Prerequisites
|
|
17
|
+
|
|
18
|
+
- Python 3.8 or higher
|
|
19
|
+
- FFmpeg (for audio processing)
|
|
20
|
+
|
|
21
|
+
### Install FFmpeg
|
|
22
|
+
|
|
23
|
+
**On Ubuntu/Debian:**
|
|
24
|
+
```bash
|
|
25
|
+
sudo apt update
|
|
26
|
+
sudo apt install ffmpeg
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**On macOS:**
|
|
30
|
+
```bash
|
|
31
|
+
brew install ffmpeg
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**On Windows:**
|
|
35
|
+
Download from [ffmpeg.org](https://ffmpeg.org/download.html) and add to PATH.
|
|
36
|
+
|
|
37
|
+
### Install the Package
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone <your-repo-url>
|
|
41
|
+
cd OpusDownloader
|
|
42
|
+
pip install .
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For development:
|
|
46
|
+
```bash
|
|
47
|
+
pip install -e .
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
### Download a Single Video
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=VIDEO_ID" -o /path/to/output/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Download a Playlist
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
sgithidownloader -p "https://www.youtube.com/playlist?list=PLAYLIST_ID" -o /path/to/output/
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Download Audio
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=VIDEO_ID" -f audio -af opus -o /path/to/output/
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Options
|
|
71
|
+
|
|
72
|
+
- `-s, --single URL`: Download a single video
|
|
73
|
+
- `-p, --playlist URL`: Download all videos in a playlist
|
|
74
|
+
- `-o, --output DIR`: Output directory (default: current directory)
|
|
75
|
+
- `-f, --format FORMAT`: File format for video (mp4, webm, audio, etc.) (default: mp4)
|
|
76
|
+
- `-af, --audio_format FORMAT`: Audio format (best, aac, alac, flac, m4a, mp3, opus, vorbis, wav) (default: best)
|
|
77
|
+
- `-l, --listFormats`: List available audio formats and exit
|
|
78
|
+
- `--help`: Show help message
|
|
79
|
+
|
|
80
|
+
## Examples
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Download a single video to the current directory
|
|
84
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
|
85
|
+
|
|
86
|
+
# Download a playlist to a specific folder
|
|
87
|
+
sgithidownloader -p "https://www.youtube.com/playlist?list=PLrAXtmRdnEQy4qtr5G1G8jQGzq9j9j9j" -o ~/Videos/
|
|
88
|
+
|
|
89
|
+
# Download audio in MP3 format
|
|
90
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=dQw4w9WgXcQ" -f audio -af mp3 -o ~/Music/
|
|
91
|
+
|
|
92
|
+
# List available audio formats
|
|
93
|
+
sgithidownloader -l
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Dependencies
|
|
97
|
+
|
|
98
|
+
- yt-dlp: For downloading and extracting audio
|
|
99
|
+
- mutagen: For embedding metadata in audio files
|
|
100
|
+
- pytube: For playlist handling
|
|
101
|
+
- pillow: For image processing
|
|
102
|
+
- requests: For downloading thumbnails
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
MIT License - see LICENSE file for details.
|
|
107
|
+
|
|
108
|
+
## Contributing
|
|
109
|
+
|
|
110
|
+
1. Fork the repository
|
|
111
|
+
2. Create a feature branch
|
|
112
|
+
3. Make your changes
|
|
113
|
+
4. Submit a pull request
|
|
114
|
+
|
|
115
|
+
## Disclaimer
|
|
116
|
+
|
|
117
|
+
This tool is for personal use only. Respect YouTube's terms of service and copyright laws. The author is not responsible for misuse.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SgithiDownloader
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A tool to download YouTube videos and audio with embedded thumbnails.
|
|
5
|
+
Author-email: AceCJM <sgithi.sgigigtat@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/AceCJM/SgithiDownloader
|
|
8
|
+
Keywords: youtube,downloader,video,audio,yt-dlp,pytube
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Topic :: Multimedia :: Video
|
|
19
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: certifi==2026.1.4
|
|
24
|
+
Requires-Dist: charset-normalizer==3.4.4
|
|
25
|
+
Requires-Dist: idna==3.11
|
|
26
|
+
Requires-Dist: mutagen==1.47.0
|
|
27
|
+
Requires-Dist: pillow==12.1.1
|
|
28
|
+
Requires-Dist: pytube==15.0.0
|
|
29
|
+
Requires-Dist: requests==2.32.5
|
|
30
|
+
Requires-Dist: urllib3==2.6.3
|
|
31
|
+
Requires-Dist: yt-dlp==2026.2.21
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# sgithidownloader
|
|
35
|
+
|
|
36
|
+
A Python tool to download YouTube videos and audio in various high-quality formats with embedded thumbnails and metadata.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Download individual YouTube videos or entire playlists
|
|
41
|
+
- Support for multiple video formats (MP4, WebM, etc.)
|
|
42
|
+
- Convert and download audio in various formats (Opus, MP3, FLAC, AAC, etc.)
|
|
43
|
+
- Automatically embed video thumbnails as album art
|
|
44
|
+
- Include metadata (title, artist, album, date, description) in supported formats
|
|
45
|
+
- Crop thumbnails to square format for better display
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
### Prerequisites
|
|
50
|
+
|
|
51
|
+
- Python 3.8 or higher
|
|
52
|
+
- FFmpeg (for audio processing)
|
|
53
|
+
|
|
54
|
+
### Install FFmpeg
|
|
55
|
+
|
|
56
|
+
**On Ubuntu/Debian:**
|
|
57
|
+
```bash
|
|
58
|
+
sudo apt update
|
|
59
|
+
sudo apt install ffmpeg
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**On macOS:**
|
|
63
|
+
```bash
|
|
64
|
+
brew install ffmpeg
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**On Windows:**
|
|
68
|
+
Download from [ffmpeg.org](https://ffmpeg.org/download.html) and add to PATH.
|
|
69
|
+
|
|
70
|
+
### Install the Package
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone <your-repo-url>
|
|
74
|
+
cd OpusDownloader
|
|
75
|
+
pip install .
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
For development:
|
|
79
|
+
```bash
|
|
80
|
+
pip install -e .
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
### Download a Single Video
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=VIDEO_ID" -o /path/to/output/
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Download a Playlist
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
sgithidownloader -p "https://www.youtube.com/playlist?list=PLAYLIST_ID" -o /path/to/output/
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Download Audio
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=VIDEO_ID" -f audio -af opus -o /path/to/output/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Options
|
|
104
|
+
|
|
105
|
+
- `-s, --single URL`: Download a single video
|
|
106
|
+
- `-p, --playlist URL`: Download all videos in a playlist
|
|
107
|
+
- `-o, --output DIR`: Output directory (default: current directory)
|
|
108
|
+
- `-f, --format FORMAT`: File format for video (mp4, webm, audio, etc.) (default: mp4)
|
|
109
|
+
- `-af, --audio_format FORMAT`: Audio format (best, aac, alac, flac, m4a, mp3, opus, vorbis, wav) (default: best)
|
|
110
|
+
- `-l, --listFormats`: List available audio formats and exit
|
|
111
|
+
- `--help`: Show help message
|
|
112
|
+
|
|
113
|
+
## Examples
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Download a single video to the current directory
|
|
117
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
|
|
118
|
+
|
|
119
|
+
# Download a playlist to a specific folder
|
|
120
|
+
sgithidownloader -p "https://www.youtube.com/playlist?list=PLrAXtmRdnEQy4qtr5G1G8jQGzq9j9j9j" -o ~/Videos/
|
|
121
|
+
|
|
122
|
+
# Download audio in MP3 format
|
|
123
|
+
sgithidownloader -s "https://www.youtube.com/watch?v=dQw4w9WgXcQ" -f audio -af mp3 -o ~/Music/
|
|
124
|
+
|
|
125
|
+
# List available audio formats
|
|
126
|
+
sgithidownloader -l
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Dependencies
|
|
130
|
+
|
|
131
|
+
- yt-dlp: For downloading and extracting audio
|
|
132
|
+
- mutagen: For embedding metadata in audio files
|
|
133
|
+
- pytube: For playlist handling
|
|
134
|
+
- pillow: For image processing
|
|
135
|
+
- requests: For downloading thumbnails
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
MIT License - see LICENSE file for details.
|
|
140
|
+
|
|
141
|
+
## Contributing
|
|
142
|
+
|
|
143
|
+
1. Fork the repository
|
|
144
|
+
2. Create a feature branch
|
|
145
|
+
3. Make your changes
|
|
146
|
+
4. Submit a pull request
|
|
147
|
+
|
|
148
|
+
## Disclaimer
|
|
149
|
+
|
|
150
|
+
This tool is for personal use only. Respect YouTube's terms of service and copyright laws. The author is not responsible for misuse.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
SgithiDownloader.egg-info/PKG-INFO
|
|
5
|
+
SgithiDownloader.egg-info/SOURCES.txt
|
|
6
|
+
SgithiDownloader.egg-info/dependency_links.txt
|
|
7
|
+
SgithiDownloader.egg-info/entry_points.txt
|
|
8
|
+
SgithiDownloader.egg-info/requires.txt
|
|
9
|
+
SgithiDownloader.egg-info/top_level.txt
|
|
10
|
+
sgithidownloader/__init__.py
|
|
11
|
+
sgithidownloader/audio.py
|
|
12
|
+
sgithidownloader/shared.py
|
|
13
|
+
sgithidownloader/video.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sgithidownloader
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "SgithiDownloader"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "A tool to download YouTube videos and audio with embedded thumbnails."
|
|
9
|
+
authors = [{name = "AceCJM", email = "sgithi.sgigigtat@gmail.com"}]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
requires-python = ">=3.8"
|
|
13
|
+
keywords = ["youtube", "downloader", "video", "audio", "yt-dlp", "pytube"]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"certifi==2026.1.4",
|
|
16
|
+
"charset-normalizer==3.4.4",
|
|
17
|
+
"idna==3.11",
|
|
18
|
+
"mutagen==1.47.0",
|
|
19
|
+
"pillow==12.1.1",
|
|
20
|
+
"pytube==15.0.0",
|
|
21
|
+
"requests==2.32.5",
|
|
22
|
+
"urllib3==2.6.3",
|
|
23
|
+
"yt-dlp==2026.2.21",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 4 - Beta",
|
|
27
|
+
"Intended Audience :: End Users/Desktop",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3.8",
|
|
30
|
+
"Programming Language :: Python :: 3.9",
|
|
31
|
+
"Programming Language :: Python :: 3.10",
|
|
32
|
+
"Programming Language :: Python :: 3.11",
|
|
33
|
+
"Programming Language :: Python :: 3.12",
|
|
34
|
+
|
|
35
|
+
"Operating System :: OS Independent",
|
|
36
|
+
"Topic :: Multimedia :: Video",
|
|
37
|
+
"Topic :: Multimedia :: Sound/Audio",
|
|
38
|
+
]
|
|
39
|
+
urls = {Homepage = "https://github.com/AceCJM/SgithiDownloader"}
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
sgithidownloader = "sgithidownloader:cli"
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import sys, requests, base64, os
|
|
2
|
+
import yt_dlp, re
|
|
3
|
+
from pytube import Playlist
|
|
4
|
+
import argparse
|
|
5
|
+
|
|
6
|
+
from sgithidownloader.audio import audio_main
|
|
7
|
+
from sgithidownloader.video import video_main
|
|
8
|
+
|
|
9
|
+
def cli():
|
|
10
|
+
parser = argparse.ArgumentParser(
|
|
11
|
+
description="SgithiDownloader - Version 1.0 - Download YouTube videos"
|
|
12
|
+
)
|
|
13
|
+
parser.add_argument(
|
|
14
|
+
"-s", "--single", type=str, help="Download a single video from URL"
|
|
15
|
+
)
|
|
16
|
+
parser.add_argument(
|
|
17
|
+
"-p", "--playlist", type=str, help="Download all videos from playlist URL"
|
|
18
|
+
)
|
|
19
|
+
parser.add_argument(
|
|
20
|
+
"-o", "--output", type=str, default="./", help="Output directory (default: ./)"
|
|
21
|
+
)
|
|
22
|
+
parser.add_argument(
|
|
23
|
+
"-f",
|
|
24
|
+
"--format",
|
|
25
|
+
type=str,
|
|
26
|
+
default="mp4",
|
|
27
|
+
help="File format (mp4, webm, audio, etc.) (default: mp4)",
|
|
28
|
+
)
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"-af",
|
|
31
|
+
"--audio_format",
|
|
32
|
+
type=str,
|
|
33
|
+
default="best",
|
|
34
|
+
help="Audio format (opus, flac, etc.) (default: best)",
|
|
35
|
+
)
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
"-l",
|
|
38
|
+
"--listFormats",
|
|
39
|
+
action="store_true",
|
|
40
|
+
help="List available audio formats and exit",
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
args = parser.parse_args()
|
|
44
|
+
|
|
45
|
+
if args.listFormats:
|
|
46
|
+
print("Available audio formats:")
|
|
47
|
+
print(
|
|
48
|
+
"- best (default, auto-selects the best format)\n- aac\n- alac\n- flac\n- m4a\n- mp3\n- opus\n- vorbis\n- wav",
|
|
49
|
+
"Metadata is only embedded in opus and mp3 formats due to mutagen limitations.",
|
|
50
|
+
)
|
|
51
|
+
return
|
|
52
|
+
|
|
53
|
+
if args.single:
|
|
54
|
+
if args.format == "audio":
|
|
55
|
+
format = args.audio_format
|
|
56
|
+
audio_main(args.single, args.output, format)
|
|
57
|
+
else:
|
|
58
|
+
video_main(args.single, args.output, args.format)
|
|
59
|
+
elif args.playlist:
|
|
60
|
+
yt_play = Playlist(args.playlist)
|
|
61
|
+
print(f"Downloading {len(yt_play.video_urls)} videos")
|
|
62
|
+
if args.format == "audio":
|
|
63
|
+
format = args.audio_format
|
|
64
|
+
for video in yt_play.videos:
|
|
65
|
+
audio_main(video.watch_url, args.output, format)
|
|
66
|
+
else:
|
|
67
|
+
for video in yt_play.videos:
|
|
68
|
+
video_main(video.watch_url, args.output, args.format)
|
|
69
|
+
else:
|
|
70
|
+
parser.print_help()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if __name__ == "__main__":
|
|
74
|
+
cli()
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import requests, base64, os
|
|
2
|
+
import yt_dlp, re
|
|
3
|
+
from mutagen.oggopus import OggOpus
|
|
4
|
+
from mutagen.easyid3 import EasyID3
|
|
5
|
+
from mutagen.id3 import ID3, APIC
|
|
6
|
+
from mutagen.flac import Picture
|
|
7
|
+
from PIL import Image
|
|
8
|
+
|
|
9
|
+
from sgithidownloader.shared import *
|
|
10
|
+
|
|
11
|
+
EasyID3.RegisterTextKey("description", "COMM")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def crop_thumbnail_for_audio_file(image_file_path):
|
|
15
|
+
image_file = Image.open(image_file_path)
|
|
16
|
+
width, height = image_file.size
|
|
17
|
+
# Assuming width > height, crop to square
|
|
18
|
+
if width > height:
|
|
19
|
+
left = (width - height) // 2
|
|
20
|
+
top = 0
|
|
21
|
+
right = left + height
|
|
22
|
+
bottom = height
|
|
23
|
+
else:
|
|
24
|
+
# If height > width, but in this case it's not
|
|
25
|
+
top = (height - width) // 2
|
|
26
|
+
left = 0
|
|
27
|
+
bottom = top + width
|
|
28
|
+
right = width
|
|
29
|
+
cropped_img = image_file.crop((left, top, right, bottom))
|
|
30
|
+
cropped_img.save(image_file_path)
|
|
31
|
+
print(f"Cropped thumbnail to square: {image_file_path}")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def download_audio_file(url: str, output, format="best"):
|
|
35
|
+
ydl_opts = {
|
|
36
|
+
"format": "bestaudio/best",
|
|
37
|
+
"embed-metadata": True,
|
|
38
|
+
"add-metadata": True,
|
|
39
|
+
"continuedl": False,
|
|
40
|
+
"outtmpl": os.path.join(output, "%(title)s [%(id)s]"),
|
|
41
|
+
"postprocessors": [
|
|
42
|
+
{
|
|
43
|
+
"key": "FFmpegExtractAudio",
|
|
44
|
+
"preferredcodec": format,
|
|
45
|
+
"preferredquality": "0", # 0 is best
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
}
|
|
49
|
+
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
|
50
|
+
info = ydl.extract_info(url, download=True)
|
|
51
|
+
filename = ydl.prepare_filename(info)
|
|
52
|
+
print(f"Downloaded: {filename}")
|
|
53
|
+
return f"{filename}.{format if format != 'best' else 'opus'}", info
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def embed_image_in_audio_file(audio_file_path, image_file_path, info):
|
|
57
|
+
try:
|
|
58
|
+
with open(image_file_path, "rb") as f:
|
|
59
|
+
image_data = f.read()
|
|
60
|
+
|
|
61
|
+
cover_art = Picture()
|
|
62
|
+
cover_art.data = image_data
|
|
63
|
+
cover_art.type = 3
|
|
64
|
+
|
|
65
|
+
encoded_picture = base64.b64encode(cover_art.write()).decode("ascii")
|
|
66
|
+
if audio_file_path.endswith(".mp3"):
|
|
67
|
+
# Use EasyID3 for text metadata
|
|
68
|
+
audio_file = EasyID3(audio_file_path)
|
|
69
|
+
audio_file["title"] = info.get("title", "")
|
|
70
|
+
audio_file["artist"] = info.get("uploader", "")
|
|
71
|
+
audio_file["album"] = info.get("album", "")
|
|
72
|
+
audio_file["date"] = str(info.get("upload_date", ""))
|
|
73
|
+
audio_file["description"] = info.get("description", "")
|
|
74
|
+
audio_file.save()
|
|
75
|
+
|
|
76
|
+
# Use ID3 for picture
|
|
77
|
+
id3 = ID3(audio_file_path)
|
|
78
|
+
id3.add(
|
|
79
|
+
APIC(
|
|
80
|
+
encoding=3, mime="image/jpeg", type=3, desc="Cover", data=image_data
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
id3.save()
|
|
84
|
+
elif audio_file_path.endswith(".opus"):
|
|
85
|
+
audio_file = OggOpus(audio_file_path)
|
|
86
|
+
audio_file["metadata_block_picture"] = encoded_picture
|
|
87
|
+
audio_file["title"] = info.get("title", "")
|
|
88
|
+
audio_file["artist"] = info.get("uploader", "")
|
|
89
|
+
audio_file["album"] = info.get("album", "")
|
|
90
|
+
audio_file["date"] = str(info.get("upload_date", ""))
|
|
91
|
+
audio_file["description"] = info.get("description", "")
|
|
92
|
+
audio_file.save()
|
|
93
|
+
else:
|
|
94
|
+
print(
|
|
95
|
+
f"Unsupported format for embedding metadata: {audio_file_path}. Skipping metadata embedding."
|
|
96
|
+
)
|
|
97
|
+
return
|
|
98
|
+
|
|
99
|
+
print(f"Successfully embedded metadata and image into {audio_file_path}")
|
|
100
|
+
|
|
101
|
+
except FileNotFoundError:
|
|
102
|
+
print(
|
|
103
|
+
f"Error: Make sure files '{audio_file_path}' and '{image_file_path}' exist."
|
|
104
|
+
)
|
|
105
|
+
except Exception as e:
|
|
106
|
+
print(f"An error occurred: {e}")
|
|
107
|
+
|
|
108
|
+
def audio_main(url, output="./", format="best"):
|
|
109
|
+
audio_file_path, info = download_audio_file(url, output, format)
|
|
110
|
+
image_file_path = grab_thumb(url, output)
|
|
111
|
+
crop_thumbnail_for_audio_file(image_file_path)
|
|
112
|
+
embed_image_in_audio_file(audio_file_path, image_file_path, info)
|
|
113
|
+
if os.path.exists(image_file_path):
|
|
114
|
+
os.remove(image_file_path)
|
|
115
|
+
print(f"Deleted thumbnail file {image_file_path}")
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import requests, re
|
|
3
|
+
|
|
4
|
+
def get_video_id(url):
|
|
5
|
+
youtube_regex = r"v=([^&]+)"
|
|
6
|
+
match = re.search(youtube_regex, url)
|
|
7
|
+
if match:
|
|
8
|
+
return match.group(1)
|
|
9
|
+
else:
|
|
10
|
+
return None
|
|
11
|
+
|
|
12
|
+
def grab_thumb(url: str, output) -> str:
|
|
13
|
+
videoId = get_video_id(url)
|
|
14
|
+
url = f"http://img.youtube.com/vi/{videoId}/maxresdefault.jpg"
|
|
15
|
+
response = requests.get(url)
|
|
16
|
+
if response.status_code == 200:
|
|
17
|
+
image_file_path = f"{output}{videoId}_thumb.jpg"
|
|
18
|
+
with open(image_file_path, "wb") as f:
|
|
19
|
+
f.write(response.content)
|
|
20
|
+
print("Thumbnail downloaded")
|
|
21
|
+
return image_file_path
|
|
22
|
+
else:
|
|
23
|
+
print("Failed to download thumbnail")
|
|
24
|
+
return -1
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import yt_dlp
|
|
3
|
+
|
|
4
|
+
def download_video_file(url: str, output, format="mp4"):
|
|
5
|
+
ydl_opts = {
|
|
6
|
+
"format": f"bestvideo[ext={format}]+bestaudio/best[ext={format}]/best",
|
|
7
|
+
"embed-metadata": True,
|
|
8
|
+
"add-metadata": True,
|
|
9
|
+
"continuedl": False,
|
|
10
|
+
"outtmpl": os.path.join(output, "%(title)s [%(id)s]"),
|
|
11
|
+
}
|
|
12
|
+
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
|
13
|
+
info = ydl.extract_info(url, download=True)
|
|
14
|
+
filename = ydl.prepare_filename(info)
|
|
15
|
+
print(f"Downloaded: {filename}")
|
|
16
|
+
return f"{filename}.{format}", info
|
|
17
|
+
|
|
18
|
+
def video_main(url, output="./", format="mp4"):
|
|
19
|
+
try:
|
|
20
|
+
video_file_path, info = download_video_file(url, output, format)
|
|
21
|
+
print(f"Video downloaded successfully: {video_file_path}")
|
|
22
|
+
except Exception as e:
|
|
23
|
+
print(f"An error occurred while downloading the video: {e}")
|