This is the simplest module for download videos from Rutube
Project description
Rutube Downloader
Get it
pip install rutube-downloader
Try it
from rutube import Rutube
rt = Rutube('https://rutube.ru/video/5c5f0ae2d9744d11a05b76bd327cbb51/')
# Get a list of videos
# Each object is the same video but with different resolution
print(rt.playlist) # [Nature 4k (272x480), Nature 4k (408x720), Nature 4k (608x1080)]
# Get a list of available resolutions
print(rt.playlist.available_resolutions) # [480, 720, 1080]
# Download a video with specific resolution and save it to the current directory
rt.playlist.get_by_resolution(720).download()
# Download a video with the best quality and save it to specific directory
# Path may be absolute or relative
rt.playlist.get_best().download('downloads/saved-videos')
Features
Get video with specific resolution
from rutube import Rutube
rt = Rutube('https://rutube.ru/video/5c5f0ae2d9744d11a05b76bd327cbb51/')
# Returns a video with the best quality
rt.playlist.get_best()
# Returns a video with the worst quality
rt.playlist.get_worst()
# Returns None if not found
rt.playlist.get_by_resolution(1080)
# Returns a list of integers - [480, 720, 1080]
rt.playlist.available_resolutions
Writing to bytes
from rutube import Rutube
from io import BytesIO, FileIO
rt = Rutube('https://rutube.ru/video/5c5f0ae2d9744d11a05b76bd327cbb51/')
with open('video.mp4', 'wb') as f:
rt.playlist.get_best().download(stream=f)
with BytesIO() as stream:
rt.playlist.get_best().download(stream=stream)
with FileIO() as file:
rt.playlist.get_best().download(stream=file)
Faster downloading
Downloading using threads. Call download() with number of workers as argument.
[!WARNING] It's expensive way to download. Be careful to use it!
from rutube import Rutube
rt = Rutube('https://rutube.ru/video/5c5f0ae2d9744d11a05b76bd327cbb51/')
rt.playlist.get_best().download(workers=8)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rutube_downloader-0.0.6.tar.gz
.
File metadata
- Download URL: rutube_downloader-0.0.6.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d49dec355f5e995f68f3ffbfb2083655b13bbf90b9929d699cdaf8d0d336a527 |
|
MD5 | ddcf48b27ec08f564305b2c88ffa0961 |
|
BLAKE2b-256 | 9b963bc79c0e79fab79d0f55b4549f34a934119e712587354d1e42cf28296cfe |
File details
Details for the file rutube_downloader-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: rutube_downloader-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a45689368c7c5f76f5b3992d88dbfef248bef8fa74aade56fa4bfa4dfe47d465 |
|
MD5 | 768194a612186c9367c2eff7344675a0 |
|
BLAKE2b-256 | 07bab3af8e64e668544d3ba793b15e8188b4608dd94593e5e49e020265d2bee6 |