Skip to main content

Download Youtube audio and import it into your beets library

Project description

beets-ytimport

A Beets plugin to download music from Youtube and import it into your beets library.

Differences compared to the ydl plugin:

  • Supports synchronizing liked songs into your Beets library (using ytmusicapi).
  • Stores m4a files instead of mp3 to avoid re-encoding lossy audio (which would decrease quality).
  • Uses yt-dlp instead of ytdl to download the audio files.
  • Does not split albums into tracks.

Installation

python3 -m pip install beets-ytimport ytmusicapi yt-dlp

Configuration

Add a ytimport section to your Beets config.yaml as follows:

ytimport:
  directory: /path/to/youtube/cache # required
  import: true
  likes: false
  max_likes: 50
  set: 'mykey=myvalue'
  auth_headers: /path/to/your/http/headers

For more information, see CLI.

Usage

Once you enabled the ytimport plugin within your Beets configuration, you can download your liked songs from Youtube and import them into your Beets library as follows:

beet ytimport --likes --max-likes 1500

Please note that the command prompts you for Google authentication, unless you specified the auth_headers option within your Beets configuration file. Import auto-tagger prompts can be disabled by specifying the -q option. You can interrupt and continue or repeat the command to synchronize likes from your Youtube account(s) into your Beets library incrementally.

CLI

Usage: beet ytimport [options]

Options:
  -h, --help            show this help message and exit
  --directory=DIRECTORY
                        directory to download Youtube files to
  --auth-headers=AUTH_HEADERS
                        path to a file containing the HTTP headers of an
                        authenticated POST request to music.youtube.com,
                        copied from your browser's development tool
  --likes               download liked songs
  --nolikes             don't download liked songs
  --max-likes=MAX_LIKES
                        maximum number of likes to obtain
  --import              import downloaded songs into beets
  --noimport            don't import downloaded songs into beets
  --set=SET             set a field on import, using FIELD=VALUE format
  -q, --quiet           don't prompt for input when importing
  --pretend             don't import but print the files when importing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

beets_ytimport-0.1.1-py3-none-any.whl (10.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page