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
  • item: The original YouTube item data from the playlist file

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.1.1.tar.gz (7.9 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.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yt_updater-0.1.1.tar.gz
  • Upload date:
  • Size: 7.9 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.1.1.tar.gz
Algorithm Hash digest
SHA256 2a4921ad618928ac061d5bbcf70cd5bef03a7426690cecc99c55d08234509057
MD5 14e728a49fefe3627136688e9cf3daec
BLAKE2b-256 8b307de7b1e883045097383485858c00a088452eee0b9cde802e622572c46f78

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yt_updater-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b4bd911dab90aff1761beb5eeec22a57fc603f42ff2e46eb03aba1fe66e320b
MD5 09068b727fd97db5494f690d3d5c345b
BLAKE2b-256 346d96852dbd4f97d40ced5ea283cb2a153d289236cc079c2979e4d25753cee4

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