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.2.tar.gz (8.8 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.2-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yt_updater-0.2.2.tar.gz
Algorithm Hash digest
SHA256 883bd4bcdc5ca4d044700107199b8679bc762e65dc82b7ad47a99ae2c3906a89
MD5 4956cb85f0dcd368c8fe5fd254fb68d9
BLAKE2b-256 383ff4fa748cb87ccc15c5429e33f89d55c06698426b6c8557acb1f2e6be74a7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for yt_updater-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 88a5ef5b399a445dd8653489fe618430919f9d1200610176dcd37391597a7dd1
MD5 cceb7e495fa36506345ef42f1d8a5b00
BLAKE2b-256 37fb6d2b80bdad8be4f49bb5cc0249a633eba4b95e331fbbae0e1071e36496d5

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