A cli that may or may not download albums from a certain website
Project description
PyTubeMusic
A cli that may or may not download albums from a certain website.
Install
pip install pytubemusic
Requires ffmpeg to be installed on your machine.
Usage
PyTubeMusic can download tracks in three formats:
- Tracks (Single files)
- Albums (A single video that is split up into individual tracks on an album)
- Playlists (Videos in a playlist that are downloaded as tracks on an album)
Each type of track needs a different configuration file that includes metadata. These are described below.
Note: the term "timestamp" refers to a string of the form: "H?:M:S.f?" – for example: "23:55.75", "1:12:00", "5:03", "17:00.5"
Tracks
A single video downloaded as a track
Track toml files have the following format:
url = "..." # URL to video
cover_url = "..." # Track cover jpg URL (optional – uses thumbnail by default)
start = "..." # start timestamp (optional)
end = "..." # end timestamp (optional)
[metadata]
title = "..." # Track Name (required)
# Any other FFMPEG MP3 metadata tags
Albums
A single video that is split into separate tracks on an album
Albums require a track_data
list that defines track-specific data.
track_data
is a list of tables that includes:
start
a start time stamp defining when the track starts in the videoend
an optional end time stamp – if not provided the start of the next track will be used of the end of the video in the case of the last trackmetadata
a table of track-specific metadata – thetitle
tag is required. Track specific metadata overwrites album metadata. Track numbers are automatically filled but can be manually added.
# album_data.toml
url = "..." # URL here
cover_url = "..." # Track cover jpg URL (optional – uses thumbnail by default)
track_data = [
{ start = "...", metadata = { title = "..." } },
{ start = "...", end = "...", metadata = { title = "..." } },
]
[metadata]
album = "..." # Album name (required)
# Any other FFMPEG MP3 metadata tags
Playlists
A playlist of album tracks
For playlists, track_data
is optional. If provided it must be provided for all
tracks in the playlist. It has the same format as album track_data
. If not
provided, the title of each video will be used for each track title.
url = "..." # URL to playlist
cover_url = "..." # Track cover jpg URL (optional – uses thumbnails by default)
# Optional track data
track_data = []
[metadata]
album = "..." # Album name (required)
# Any other FFMPEG MP3 metadata tags
CLI
A pytubemusic
command will be exposed.
This has three commands: album
, track
, playlist
.
Each command corresponds to one of the file types mentioned above.
The commands all take the path to a config TOML file and an optional -o
or --out
option pointing to a directory to write the resulting tracks too.
(Note: albums and playlists are put into their own subdirectory with the album
name under the out directory).
For example:
pytubemusic album myConfig.toml -o exports
Project details
Release history Release notifications | RSS feed
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
Hashes for pytubemusic-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebfa3a7a45fbb7b4d2af637ae20cb11ea3c3458b4a598192b8be7ac48aadb14c |
|
MD5 | 63c4a2d061f60801d783f6727348a8c5 |
|
BLAKE2b-256 | b7a506e52c9ceeffc54bcbb2aeef5803fbbf8b75c2030709856eba657636f69e |