Skip to main content

No project description provided

Project description

yt_updater

Useful tools for bulk-updating YouTube playlists and scheduling publication en masse

Setup

Installation

I recommend installing this in one of a few ways:

  • poetry sandbox: Clone the repo, install poetry, and then run make install; after this you can run the scripts with e.g. poetry run getPlaylist or poetry run getVideos from within the source directory.

  • venv sandbox: Create a virtualenv and, after activating it, run pip install yt_updater

  • pipx install (less recommended): Using pipx install this as yt_updater and it will appear in your global path

Configuration

You will need to create an application for the YouTube Data API. See the getting started guide for more information.

You'll need to create an OAuth 2.0 client set as a "Desktop app." After creating an OAuth 2.0 client, download its client data and save it as client.json or the like. If you need multiple registered apps for some reason, you can specify your client file with the --client-json option.

When you first use the application, it will prompt you to log in and grant access to your channel. If you want to switch between multiple channels, you can specify different login tokens with the --login-token option (the specified file will be created if it doesn't yet exist).

Also note that if you register the application as a test application, you'll need to add your Google account to the allow list.

Usage

  1. Upload all of your track videos as drafts, and bulk-add them to a playlist (which can remain private) and set their video category.

  2. Run getPlaylist playlist_id > playlist.json to generate your playlist JSON

  3. Run updateVideos -n playlist.json album.json to see what changes the script will make; remove the -n and run again if you approve. updateVideos --help will give you a bunch more useful options for things like generating video descriptions, scheduling the videos' publications (with an optional inter-track time offset to make the playlist management a little easier or even letting you stagger them by minutes/hours/etc.) and so on.

Note that even in -n mode this will still make API requests which will drain your daily request quota.

Scripts

This package provides the following scripts:

  • getPlaylist: Given a playlist ID, download the necessary information into a JSON file
  • updateVideos: Given a playlist JSON file and an album descriptor, update the videos on the playlist with the descriptor.

The album descriptor is a JSON file that contains a property bag with the following properties:

  • tracks: Maps to an array of track, in the order of the album. Each track is a property bag with the following properties:
    • title: The title of the track
    • Other properties as appropriate, e.g. lyrics, description, etc.

These descriptor files can be created and edited using Bandcrash.

The title templates are strings which can embed the following template items (as Python formatters):

* `{tnum}`: The track number on the album
* `{title}`: The plaintext title of the track
* `{filename}`: A filename-compatible version of the track title, as slugified by Bandcrash

The description template is a file in Jinja2 format. When it's run, it's given the following template items:

  • album: The top-level album descriptor
  • tnum: The track number on the album
  • track: The track data from the album descriptor
  • video: The original YouTube item details

There is also a filter, cleanup, which will do some helpful cleanup steps on the generated description.

An example template is in templates/description.txt.

YouTube API quota limits

By default, YouTube API gives you 10,000 units of work per day. For the purposes of these scripts, they cost the following:

  • getPlaylist: 1 unit per 50 videos in the playlist
  • updateVideos: 1 unit per 50 videos in the playlist + 50 units per video when not doing a dry run

The 50-unit per update cost tends to run out very quickly; for example, on a 20-track album, every attempt at updating or scheduling the publication will cost 1000 units, so you only get 9 tries per day to get things the way you want them.

Disclaimer

This software was partially written with the help of Google's AI chatbot, because life's too short to try to wade through Google's incomprehensibly-dense-yet-vague API documentation.

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

yt_updater-0.2.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yt_updater-0.2.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file yt_updater-0.2.1.tar.gz.

File metadata

  • Download URL: yt_updater-0.2.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.7 Darwin/25.0.0

File hashes

Hashes for yt_updater-0.2.1.tar.gz
Algorithm Hash digest
SHA256 559a04ff3d3063e1e7f394719025b48ff7b2ff0ea8021445e53956be36ce04e1
MD5 a1701dd003304766b36208292d5c3ccc
BLAKE2b-256 3cb64d5bf3fa66727fd8efed6bfe38763a73a62d01df63ec26c81266b4cd76ca

See more details on using hashes here.

File details

Details for the file yt_updater-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: yt_updater-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.7 Darwin/25.0.0

File hashes

Hashes for yt_updater-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ca7b4b708aa6c1bfe6ba5a4a41cf51a0370389aef47b9ad5957aaf0ff0094d31
MD5 c1412bdcced0e31c3e064d707751e19f
BLAKE2b-256 e3f82f4d03a52e437366eb4fdcaa7fc77e77e91d276a58d2b26d272ff1fc004c

See more details on using hashes here.

Supported by

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