DEV Community

crazyathlete220-stack
crazyathlete220-stack

Posted on

ytmeta: bulk-edit YouTube metadata from the CLI, without the fear

If you run a YouTube channel with more than a handful of videos, some chores are
quietly miserable. Appending the same footer to every description. Renaming
titles to a new convention. Dropping a pinned-style comment on your top videos.
YouTube Studio makes you do all of this one video at a time.

So you write a script. And now you have a worse problem: a bulk videos.update
loop will happily overwrite dozens of descriptions if you get one line wrong, and
there's no undo. I wanted the bulk part without that sinking feeling.

That's the whole idea behind ytmeta:
every write is a dry-run until you explicitly say otherwise.

npm install -g ytmeta
Enter fullscreen mode Exit fullscreen mode
# preview exactly what would change (reads the API, changes nothing)
ytmeta titles titles.json

# apply it once you're happy
ytmeta titles titles.json --execute
Enter fullscreen mode Exit fullscreen mode

A few decisions follow from that:

  • every write command previews first; nothing changes without --execute
  • uploads default to private, so nothing goes public by accident
  • deletes need a typed confirmation phrase, even with --execute
  • your client_secret.json and token.json stay local and are never committed

A real example I use a lot — add a footer to a bunch of videos:

[
  { "id": "VIDEO_ID_1", "append": "\n\nSubscribe: https://youtube.com/@you" },
  { "id": "VIDEO_ID_2", "append": "\n\nSubscribe: https://youtube.com/@you" }
]
Enter fullscreen mode Exit fullscreen mode
ytmeta descriptions data.json --execute
Enter fullscreen mode Exit fullscreen mode

Each entry can append, prepend, or fully replace the description.

The rest of the commands: login (OAuth loopback), titles, comments,
watermark, upload, and delete.

It's a thin wrapper over the YouTube Data API — Node 18+, tested with the
built-in node:test, CI on Node 18/20/22, MIT. If it's useful to you I'd love to
hear what to add next.

https://github.com/crazyathlete220-stack/ytmeta

Top comments (0)