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.
Installation Note
PyTubeMusic uses the PyTube library. This can occasionally break. However, patches are usually quickly released as new versions or as pull requests. Try upgrading to the latest version of PyTube if downloading fails.
Note, to pip install from a pull request do:
pip install git+https://github.com/pytube/pytube.git@refs/pull/<PR_NUM>/headWhere
<PR_NUM>
is the number of the pull request.
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.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7d37ee1b35298cd153b7cf7fd4911d2cad4d529e68c0fb197e41ea6a5cb7763 |
|
MD5 | f0facbe042ad7fb2b3347c154099f291 |
|
BLAKE2b-256 | f8b5b974faa63d2e32dd7b7221dd674d045fe2a7556b2c1b9d6c2a7cd5d6228e |