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.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efb30519d9d59ffa60d3fb97a90f93e833467475054f91893aa90e72db49dcbd |
|
MD5 | 9567bf8c1ee677ab44e3b06d44bc281c |
|
BLAKE2b-256 | 8869e7e57eab330f2bb02f1b51c7a7d0c1ca68be3402cef9b973b6a0ab4f9341 |