PyThumb
Simple command line utility and API for downloading YouTube thumbnails.
Supports JPEG and WebP formats in all sizes. Previews (animated thumbnails) are not supported due to the lack of direct URL or API access.
Requires Python 3.6+
Table of contents
Installation
Install via pip:
$ pip install pythumb
Or get binaries from the latest release.
From source
Use python instead of python3 on Windows
Download source code from the latest release, extract and cd into it.
(Optional) Create a virtual environment to manage packages easier.
Update pip and setuptools:
$ python3 -m pip install -U pip setuptools
Install this package:
$ python3 -m pip install .
Optionally you can build a standalone executable.
Prerequisites:
- Git Bash (Windows)
On Linux install python3-dev:
$ sudo apt install python3-dev
Install PyInstaller:
$ python3 -m pip install pyinstaller
Run the build script for your OS:
$ chmod +x ./scripts/build.sh
$ ./scripts/build.sh <win / linux>
You can find the executable in ./pyi-dist/.
Usage
CLI
$ pythumb [options] <input>
To save a thumbnail to the current directory, simply pass the video URL or 11-character ID (recommended quoted):
$ pythumb "https://youtu.be/aqz-KE-bpKQ"
# or
$ pythumb "aqz-KE-bpKQ"
Use --help for more details.
API
Example
from pythumb import Thumbnail
t = Thumbnail('https://youtu.be/aqz-KE-bpKQ')
t.fetch()
t.save('.')
# ./aqz-KE-bpKQ.jpg
Thumbnail sizes
| Name | Size |
|---|---|
maxresdefault |
1280x720 |
sddefault |
640x480 |
hqdefault |
480x360 |
mqdefault |
320x180 |
default |
120x90 |
Auto-generated previews (start, middle and end of the video)
| Name | Size |
|---|---|
maxres1 |
1280x720 |
maxres2 |
1280x720 |
maxres3 |
1280x720 |
sd1 |
640x480 |
sd2 |
640x480 |
sd3 |
640x480 |
hq1 |
480x360 |
hq2 |
480x360 |
hq3 |
480x360 |
mq1 |
320x180 |
mq2 |
320x180 |
mq3 |
320x180 |
1 |
120x90 |
2 |
120x90 |
3 |
120x90 |
License
MIT license. See LICENSE for more information.
Metadata
Release files for pythumb 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pythumb-1.1.0.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pythumb-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.4 kB
Release files / pythumb-1.1.0.tar.gz
| Download URL | pythumb-1.1.0.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
495b79493ca2b82d94f2db3bdcd782411e2906d020399a8b16b9a87001067cb4
|
|
BLAKE2b-256 checksum How to use checksums |
e609aa71a1ce89b70da34632c734a67c3e436909ccd76bce925905af6b430131
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Release files / pythumb-1.1.0-py3-none-any.whl
| Download URL | pythumb-1.1.0-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1266e1b0c2742595f01dff6907ed59975ba57097487d959fdb82219838721e4e
|
|
BLAKE2b-256 checksum How to use checksums |
68fb53a98fdfa439dfd421b64f83fa976d09456af04be8ef8f93bce20af8787b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|