Skip to main content

No project description provided

Project description

YouTube 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 (most recommended): Clone this 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. This approach will always give you the latest version of the code, with updates a git pull && poetry install away.

  • venv sandbox: Create a virtualenv and, after activating it, run pip install yt-updater. This will give you the latest "stable" release which may be a bit outdated, but will keep it sandboxed away from the rest of your system.

  • pipx install (least recommended): Using pipx install this as yt-updater and its scripts will appear in your global path. This has the disadvantages of the venv sandbox as well as possibly putting stuff on your global path that you don't want there.

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 1001 units (1 for the bulk update request + 20⨉50 for the individual videos), so you only get 9 tries per day to get things the way you want them.

This is also why I have no plans to make a public web-based version of this script.

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. I'm not happy about it either.

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.3.tar.gz (9.2 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.3-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yt_updater-0.2.3.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.9 Darwin/25.2.0

File hashes

Hashes for yt_updater-0.2.3.tar.gz
Algorithm Hash digest
SHA256 ef39fcfee823422ae3a7462c8ff65908899e94b4472cfdf8280d9bb5cd5b05f5
MD5 ae76d2bc1916b0eefa7fec5612e6997a
BLAKE2b-256 9993e997a241b5fbf34e6866501e50715607f6b3166da9d823822567cafa009e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yt_updater-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.9 Darwin/25.2.0

File hashes

Hashes for yt_updater-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f948550a948274f4f969becd8de60c9310cd934bf5ff8ad886723884ff88629f
MD5 81d86f9d7641cf3c3399737d31ba7738
BLAKE2b-256 ee9ab389e8ec0da7eabe2cc2a46dce1c37e5ddc28c912adecaac3d4270e79cb6

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