ExtantApe

payload plugin playlists

by ExtantApe
Third-party services
v3
^3.92.0
MIT

Overview

Summary generated from the README

Adds creators, videos, usage and rule-log collections to Payload for curating YouTube creators. A sync reads each channel's RSS feed before using the YouTube Data API and stays within a daily unit cap. Curators review videos in an admin screen, and public page components render creator lists, video grids and a click-to-play youtube-nocookie player. Requires Payload 3.92 or later and MongoDB transactions.

Features

  • Per-channel rules for length, Shorts, live streams, playlists and excluded keywords
  • RSS checks first, with an atomic daily API unit cap that defaults to 2,000
  • Admin review screen with queues for waiting, new, hidden and reviewed videos
  • Title patterns saved as rules that show matching new videos
  • Podcast and show detection with optional cover download into media
  • Click-to-play youtube-nocookie player with a Watch on YouTube fallback

Use cases

  • Curate a vetted list of YouTube creators and show only approved videos on a site
  • Run a multi-site video catalogue where curators and editors have separate permissions
  • Keep YouTube API usage within a fixed daily quota while syncing many channels

From the author

Playlists for Payload: a curated list of YouTube creators for your site, with rules per channel, RSS checks before any Data API call, a daily unit cap, a curator's yes where you want one, and click-to-play youtube-nocookie embeds.

Installation

npm i @extantape/payload-plugin-playlists

0

Stars

0

Forks

3

Open Issues

3 days ago

Last Updated

1.8k

Weekly Downloads

v0.10.1

npm Version

512.7 KB

Unpacked Size

0

Dependencies

GitHub stars

00 since Nov 8

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 20260
Dec 4, 20260
Dec 3, 20260
Dec 2, 20260
Dec 1, 20260
Nov 30, 20260
Nov 29, 20260
Nov 28, 20260
Nov 27, 20260
Nov 26, 20260
Nov 25, 20260
Nov 24, 20260
Nov 23, 20260
Nov 22, 20260
Nov 21, 20260
Nov 20, 20260
Nov 19, 20260
Nov 18, 20260
Nov 17, 20260
Nov 16, 20260
Nov 15, 20260
Nov 14, 20260
Nov 13, 20260
Nov 12, 20260
Nov 11, 20260
Nov 10, 20260
Nov 9, 20260
Nov 8, 20260
npm weekly downloads

1.7K+1.7K since Nov 14

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 20261,737
Dec 4, 20261,347
Dec 3, 20261,319
Dec 2, 20261,058
Dec 1, 2026205
Nov 30, 20260
Nov 29, 202618
Nov 28, 202617
Nov 27, 202617
Nov 26, 202616
Nov 25, 202621
Nov 24, 202629
Nov 23, 202629
Nov 22, 2026255
Nov 21, 2026252
Nov 20, 2026250
Nov 19, 2026248
Nov 18, 2026242
Nov 17, 2026230
Nov 16, 2026217
Nov 15, 20260
Nov 14, 20260

Each point is npm's rolling 7-day download count.

Health Score

67/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1456389987-root.svg)](https://payloaddirectory.dev/plugins/1456389987-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1456389987-root"><img src="https://payloaddirectory.dev/badge/1456389987-root.svg" alt="Payload Directory"></a>
Updated Dec 2, 2026Created Nov 13, 2026Published Dec 2, 2026

README

payload-plugin-playlists

Playlists for Payload: a curated list of YouTube creators for your site, with rules per channel, RSS checks before any Data API call, a daily unit cap, a curator's yes where you want one, and click-to-play youtube-nocookie embeds.

Status: phase 2, early (0.x). Version 0.3.0 is the first under the name Playlists. Earlier versions were published as @extantape/payload-plugin-watchlist. The latest release is 0.10.1. It hasn’t been tried on a live site. Everything runs on fakes only: 790 tests (2 of them compare against a snapshot that isn't in this repo, and are skipped without it) on Payload 3.92 with an in-memory MongoDB, a made-up YouTube and made-up feeds, and the components in jsdom. Nothing has called YouTube. The admin's review view, its nav link and the Sync now field have never been opened in a real Payload admin, and no page has been seen in a browser or tried with a screen reader. The facts about YouTube's feed (no key needed, about 15 newest uploads, how fast it updates) and YouTube's terms on stored data are not checked yet. Title rules and the rule log have never had a curator or a real admin behind them: the routes and the log ran only in tests.

What it does

  • Two collections, creators and videos, with the slugs and field names the feature had in the site it was moved out of, so a site that had it built in can switch without a database migration. A third, playlists-usage, counts API units a day, and a fourth, playlists-rule-log, keeps a line for each video a title pattern or rule showed.

  • Each creator has one or more YouTube channels, each with its own rules. In order: live streams (unless live is on and the stream has finished, see Live recordings below), Shorts (up to 61 seconds, or up to 3 minutes with #shorts), vertical videos and comment replies are hidden; then videos under the channel's minimum length; then excluded playlists; then videos outside an "include only" playlist; then excluded keywords. What's left goes to your classifier, and only your shownKinds pass.

  • A creator's "Which videos" is rules (videos that pass show on their own) or picked (nothing shows until a curator says "Always show"). New creators start at picked, so a new creator's videos wait for a curator's yes; a curator can switch a trusted creator to rules. A stored creator with no value counts as picked. A curator's choice on a video wins over everything.

  • The channel's public feed is read first. If it shows nothing new and nothing else is due, a check costs no API units. New videos cost 1 unit per 50 for their details. search.list (100 units) is never used.

  • Without an API key it still works from the feed alone: new videos are cataloged for review and never shown by the rules, because the feed has no duration or live flag to check.

  • Every API call reserves its units first in one atomic database update, so no run goes over the daily cap (2,000 by default), even with two at once. A quota error stops every creator until the next day. A rate limit or YouTube error is tried twice more, after 2 and 8 seconds.

  • A weekly re-check marks videos gone from YouTube (never shown while gone) and brings titles up to date; a monthly full read finds old videos made public later. One run per creator at a time.

  • Two curators can't both decide the same video. The first decision, from reviewVideo or a plain edit of the choice or the kind, takes an atomic claim; after that only that curator, the site's editors and admins can change the choice or the kind. Another curator gets a 409. A suggested kind saved while another curator decides gets the same 409.

  • When two people save the same creator or video at the same moment and the database refuses one, that REST write answers 409 ("Another change to this record was being saved at the same moment, so nothing was saved. Try again.") and nothing from it is saved. Show the message and let the person save again. GraphQL and the Local API still get the database's own error (a MongoDB write conflict, code 112); treat it the same way.

  • One review digest a day per site when videos wait (nothing for an empty queue), and one at once past 25 waiting, through your notify. Each goes at most once a day, and the daily one is skipped on a day the "at once" one already went. A send that fails is tried again on the next run.

  • A review screen in the admin (/admin/playlists-review) for curators, with a tab for each queue and how many it holds:

    • Waiting: picked videos, feed-only ones and videos of a suggested kind (set by the sync or saved by a person), none of them public, with "Always show" and "Always hide". Any curator of the site can answer.
    • Topic pages (with topics): videos whose topic state is review, with "Put on topic pages" and "Keep off topic pages". Either answer is a person's edit, so it locks the video against the sync like any other: a hidden video stays hidden after a yes until someone shows it, and the sync no longer updates its kind or reason.
    • New: videos the public can read now, by the same rule the public read uses (the creator listed, the video shown and not in a hidden podcast or show), not yet looked at by a person. On an admin's view of other sites, episodes of any show that might be hidden there are left out. A shown video the public can't read (an unlisted creator, one marked not to feature, or an episode of a hidden show) isn't in any tab; find it in the Videos list.
    • Hidden by kind: hidden because of their kind or for not being about the site's subject. Channel rules, suggested kinds and picked videos are left out.
    • Reviewed: decided by a person, newest change first, with the decision marked.

    Each tab has a hint line, a creator and kind filter and 20 videos to a page. Buttons are named with the video's title, a player plays it in place, and a live region says what was saved or refused. On New, Hidden by kind and Reviewed, show, hide and a kind picker save straight to the video with the curator's own access, so each edit takes the claim and locks the video against the sync. Saving a suggested kind (one in suggestedKinds) hides the video and leaves it as the sync would: no choice, the reason Suggested: <kind>, no claim, and listed under Waiting, where any curator of the site can say yes. A choice a person already made is kept. Saving any other kind the site doesn't show (one outside shownKinds) hides the video too: it's recorded as that curator's "Always hide" and listed under Reviewed. A video a person chose to always show stays shown, and the live region says so. A kind the site shows doesn't show a hidden video; showing it does. Pressing Save kind with nothing changed says so in the live region. The admin nav shows how many wait.

  • A "Sync now" button on each creator, for the site's editors. It reads the creator in full and re-checks its videos, through the same unit ledger, daily cap and run lock, so two clicks run one sync and the second gets "syncing already". A creator rests 10 minutes after any sync before the button works again, and a site can be given its own share of the day's units.

  • Podcasts and shows. The sync reads each channel's playlists once a day and adds the ones YouTube marks as podcasts, and a site's editor can add any playlist by its link. Each show keeps its episodes under the creator with a badge (keep), gets an entry of its own in the creator list (own, the default) or keeps its episodes off the public pages (hide). A video's own choice wins, then the show's setting, then the creator's, then the site's. An entry of its own is listed once a video of it shows, or earlier with a Coming soon mark. With shows.media, the sync downloads each show's cover once into the site's media collection, from YouTube or from the show's own feed, and a logo an editor uploads always wins. Covers are stored only for shows the public can see, of listed creators.

  • A creator can have a short name of up to 40 characters for tight spaces. Cards and bylines show it, and the full name stays as hover text and as what a screen reader says. The site's curators set it.

  • The video grid has tabs. The first can be a Featured tab of the kinds you name. A kind can have a tab to itself and stay off the first tab. A kind can be one the sync only suggests: its videos wait in the review queue and show in their own tab after a curator's yes.

  • The creator list leaves out a creator with no video showing. A curator can mark an empty creator Coming soon to list them early. Once one of their videos shows, the mark is hidden from public answers, and the stored value stays as set until someone clears it. listing.hideEmpty: false lists every listed creator.

  • Title patterns and title rules. A curator types part of a title (Live Q&A, or Ep. * with * for any text) and sees the creator's hidden videos that match, newest first, up to 500. They can show the ones they pick in one step, each as their own Always show, and save the pattern as a rule. The sync then shows a new video whose title matches a rule that's on, when it passed the channel rules and the classifier but waits under a picked creator. A pattern never lifts a channel rule, Always show or Always hide, a person's edit, a gone video, one only the feed has seen, an episode of the site's hidden podcast or show, or a video waiting to find out whether it's one. For a site other than the request's own, whose shows.siteDisplay can't be asked, every show that might be hidden counts as hidden. When the site's shows can't be read, the preview and showing matches answer 503 and do nothing. Patterns are matched with plain string search after Unicode NFKC. A pattern needs at least 3 characters besides * and spaces, and takes at most 100 characters and 5 *. The sync skips a stored rule with a shorter pattern. With titleRules.enabled: false, videos the sync showed by a title rule are hidden from the public until title rules are back on; a curator's Always show from a pattern stays, because it's that person's own choice.

  • Server functions and page components for the public pages: the creator list, a creator's page, the video grid, and a video's page with the player. The site mounts them in its own routes.

  • The Player component shows the thumbnail and a real button named "Play: ". YouTube's player (youtube-nocookie.com) loads only after the click, and focus moves to it. A video YouTube won't let be embedded gets a "Watch on YouTube" link instead.

Access

Only an exact true passes. A provider that answers 1, 'true', {}, a promise of one of those, or throws, is a no.

WhoWhat
Signed-out visitor, or signed in with no roleVideos that are shown, not gone, from a listed creator who hasn't asked not to be featured, and either a curator's "Always show" or a rules creator, on the visitor's site. Listed creators. With scope and no site, nothing.
Curator of a siteEvery creator and video of that site, and its review queue. Changes only shown, choice, kind, locked and the topic fields on a video. On a creator, changes only shortName and comingSoon, and comingSoon on the podcast and show rows already there. Adding, removing or changing a podcast or show row, its display or its pictures, and the creator's showsDisplay, take an editor. Can't add or delete a creator or a video, or change either's createdAt or place in the list (_order), so can't reorder creators. Previews and shows title matches and saves title rules through the three routes below, never by editing the creator.
Editor of a siteCreates, changes and deletes creators and videos of that site, and runs Sync now on its creators. Can't move a record to another site.
AdminEverything.

"Shown" is recomputed on every write, the sync's included, so it can't be set around the rules through the API. A site's overrides can add fields, hooks and narrower access, but can't remove the plugin's fields, hooks or access, or turn duplicating on. The site's own hooks run after the plugin's, including after the one that computes shown, so site code can still set shown itself: keep that out of your hooks unless you mean it. Before a find, count or distinct read, the plugin's query guard runs last, after the site's hooks, so it judges the query they hand on. Hooks a site adds before a read get the request the query came in on, and field rules a site adds to these collections, its own access and its scope functions get a copy of it without the guard's pass, so a query they make is judged on its own. For field rules, that covers the ones in place when the plugin's start-up code runs, so list any plugin that adds or replaces a field rule at start-up before Playlists.

Some fields belong to the sync and the review. A write with a person on the request, an admin's included, never sets them, on a new record or an existing one, unless server code passes the plugin's SYNC_CONTEXT (below):

  • Videos: claim, hiddenReason, ruleKey, passedRules, source, curation, channelId, unavailable, unavailableSince, embeddable, madeForKids, ruleShown, shownByRule and, with topics, the topic names. shownByRule is also set by showMatches, after its checks.
  • Creators: lastSyncedAt, lastRecheckAt, lastFullSyncAt, syncingSince, syncNote and syncState, on each channel uploads, backfillToken, backfillDone and rssSeen, and on each show detected and coverFrom. A show's coverUpload is set by the sync and by the site's editors and admins only; a curator's value is dropped the same way.

The plugin drops a sent value without an error and keeps what's stored, because the admin sends the whole record back on save. On a new video unavailable starts off, so a video a person adds by hand shows only through a person's choice (Always show, or Shown ticked). The sync, the review and server code that writes with no person on the request set these fields. doNotFeature and its note are still for editors and admins to write.

SYNC_CONTEXT marks a write as the sync's own. When server code passes context: { [SYNC_CONTEXT]: true }, the plugin treats the write that way even with a person on the request. The write can set the fields above, and the plugin skips its other checks for a person's write: the site and curator limits, locking an edited video against the sync, keeping the choice and Shown in step, and the review claim. It doesn't call revalidate for that write either. Access control is unchanged by it. Pass it only from trusted server code, and never build a context from request input.

When a person points a show row at a different playlist, the row is no longer the sync's find and its covers are cleared. A show the sync found and a person removed is remembered in syncState, so the sync never adds it again. A show's logoUpload and coverUpload must be images of the creator's own site (400 otherwise).

A hidden show's cover comes off. When a show is hidden (by its own setting, its creator's or the site's), or its creator is unlisted or marked not to be featured, the cover the sync stored for it is taken off the row and its media record deleted: at once on a person's change, and on the next sync for a change of shows.siteDisplay. A cover the sync replaced, and one on a row a person removed, are deleted too. Only media the sync stored is deleted (syncState.coverMedia keeps their IDs), and one another creator's show points at is kept. A logo or cover a person uploaded stays where it is, even on a hidden show.

New videos wait while a hidden show's list is unknown. The sync reads up to 1000 videos of each podcast's or show's playlist. When a hidden show's playlist (or one that would be hidden if the site hid shows) fails to read or is longer than that, a new video it didn't list is stored without showing, with the reason Waiting for a full read of a hidden podcast’s or show’s playlist, and the sync looks at it again on every run until the list reads in full. A curator's Always show still shows it.

Title rules carry who added them and when. On every write but the sync's, a stored row keeps its stored addedAt and addedBy, and a new row or one with an unknown ID gets the time and the person of the request; sent values are dropped. Patterns are stored cleaned, and a pattern already on the creator isn't added twice. A creator has at most 50 rules. A curator who isn't an editor changes titleRules only through saveTitleRule (or its route), which adds one rule or turns one back on; that write builds the rows from the creator as stored inside its own transaction, so a rule an editor turned off a moment earlier stays off. For anyone but an admin, a creator that isn't on a site they work on answers the same 404 as a missing one, and nothing is saved. When two saves on one creator meet, the database refuses one and it is tried again, up to five times, then answered with a 409 to try again. This relies on MongoDB transactions, which Payload uses on a replica set; hosts should keep them on.

When a person points a channel row at a different channel, the row's sync state starts over, so the next sync looks the channel up and reads its uploads from the start. A handle edit that resolves to the same channel keeps its state.

Write data has to be in the shape of the collection's fields. A key that starts with $ or contains a dot (outside json and rich text fields), or a list with two rows sharing an id, is refused with a 400, for every write, server code included. A list field takes a list, null, the number 0 or the text '0'. The admin sends an empty list as 0, and Payload saves 0 and '0' as an empty list. Anything else in a list field is refused the same way. A select field takes text, null, or a list of text when it takes many; anything else, such as an object, is refused the same way. Writes made directly through the database adapter skip Payload's hooks and aren't checked.

A video and its creator must be on the same site; anything else is refused, and the public read checks both.

Duplicating is off for all three collections, for everyone, server code included: payload.duplicate, payload.create with duplicateFromID, REST and GraphQL. The admin has no Duplicate action for them. To make a record like another one, create it and pass the fields you want. The plugin sets this again at startup, in an onInit that runs after your config's own and those of plugins listed before Playlists. A plugin listed after Playlists can still run code after it, so list any plugin that could turn duplicating on before Playlists, and leave disableOnInit off.

What the public can read

Everything not listed here is for an admin and the record's own site's curators and editors only. The public can't read it, filter on it or sort by it: directly, inside and and or, or through creator. on a video. Through a relationship from one of your own collections (a relationship field or a has-many one) to creators or videos, only an admin may filter, sort or ask for distinct values on these fields; the site's curators and editors are refused there too. On the plugin's own collections, a curator's or editor's filter, sort or distinct read on these fields is kept to their own sites, and answers only when every path in it stays on the record: the plugin's fields and any the site adds that store their value on it, through groups, tabs, arrays, blocks and locales. A video's creator. paths answer too, kept to creators of their own sites, as long as what follows stays on the creator's record. Anything else takes an admin: a path through any other relationship or upload (one the site adds included), a join, a virtual field, a nested query in a value, a join with its own filter or sort, and a distinct read with a depth. If another plugin adds a hook before a read, or one at the start of a read, in its own start-up code, list Playlists after it; until then these filters are refused for curators and editors and a warning is logged once. A read with overrideAccess gets every field and every row, hidden shows included, so if a page needs one, drop the rows and names that displayOf or showsOf gives hide in your own code.

  • Videos: id, title, youtubeId, creator, publishedAt, shown, kind, choice, description, duration, thumbnail, playlists, unavailable, embeddable, madeForKids, createdAt, updatedAt, the topic field and its state (with topics), and the site's own fields (its site field, and any it adds by override).
  • Creators: id, name, shortName, slug, listed, comingSoon, website, bio, avatar, videosDefault, showsDisplay, shows (with each row's comingSoon; a hidden show's row is left out for the public, over REST, GraphQL and the Local API with access on; the public reads shows but can't filter, sort or ask for distinct values on it or on any field in its rows, fields added later included, here or through a relationship from another collection), and inside channels only handle, title, channelId and playlists (each rule's playlist stays public to read and filter on; an old rule's own-filter name, showName, is blank when its show is hidden and follows the same query rules as a show row's field); createdAt, updatedAt, and the site's own fields. videosDefault ("Which videos") is public because a site's own visibility rules read it and filter on it.
  • Not public: on videos hiddenReason, ruleKey, locked, source, channelId, curation, passedRules, unavailableSince, claim, ruleShown, shownByRule and the classifier's topic names; on creators titleRules, doNotFeature, doNotFeatureNote, the schedule (syncDays, syncHour), the sync's dates, syncNote, syncState, in each show feed and coverFrom, and in each channel excludeKeywords, minMinutes, the topic settings, uploads, backfillToken, backfillDone, rssSeen and curation. Those channel fields are the curators' own rules and the sync's state; no page reads them (confirmed by the maintainers, 2026-11-11). A withheld list field reads as an empty list.
  • Rule log: not public at all. Each line (video, creator, pattern, rule, by, user, createdAt, updatedAt) is on its creator's site, and only admins and that site's curators and editors can read it or filter, sort, count or ask for distinct values on any of its fields. Their own queries follow the rules above for the plugin's collections: kept to their own sites' lines, with creator. and video. paths answering as creator. does on a video. Through a relationship or join from one of your own collections, the log's fields are for admins only. A line whose creator was deleted is read by admins only, and a creator moved to another site takes its lines with it. Nobody creates, changes or deletes a line through the API, admins included; the plugin writes one after each show by showMatches (by: 'curator', with the person's ID) and each show by the sync's title step (by: 'sync'). A line is saved in the same transaction as the show it records, so neither is kept without the other. showMatches saves each show and its line in a transaction of its own and leaves the caller's alone: when the line can't be written, the show isn't saved either, the video is listed in refused with "It couldn’t be saved. Try again.", and the error is logged on the server. The sync saves a show and its line in the transaction of the request it's handed, when that has one, or else in one of its own. In a transaction of its own, a line that can't be written or is refused stops the run, the show isn't kept, the run says so in its note, and the next run shows the video again with its line. In a caller's transaction, the sync never goes on, or reports normally, without it: when a line can't be written or is refused, or any write fails and Payload rolls the caller's transaction back, syncCreator (and syncDue, which calls it) rolls that transaction back, frees the creator for the next run, writes nothing more (not even the creator's last sync time or note) and throws a SyncTransactionLost error. Nothing written in that transaction is kept, the caller's own writes included, so catch it and try the whole unit of work again. The run takes its lock on the creator outside any transaction, so start the transaction with the sync: a transaction that read or wrote anything before the run (another creator's run with syncDue included) meets that lock at the run's last write, and is lost the same way. When syncDue has several due creators under your transaction, the second one can stay locked until the lock goes stale (15 minutes), and its runs answer busy until then. logRuleUse, for your own server code, writes in the transaction of the request you pass, so call it with the request whose transaction saved the show. It refuses (a 400, with nothing written) a video or creator that doesn't exist, a video of another creator, and a video whose shownByRule doesn't record that pattern and rule. Limit: on a database without transactions, a show and its line are two separate writes, so a line that fails or is refused after its show was saved leaves the show without a line; the error is logged on the server, and the sync's run stops. Leave the rule log out of a multi-tenant plugin's collections: a line has no site field of its own, and is on its creator's site.
  • Unit ledger: editors see the day, whether it's stopped, and their own sites' units; the day's total and the digests are for admins. A creator's website takes http and https links only.

What each site must add

  • A privacy line. Your privacy page must say that the site uses YouTube API Services: "This site uses YouTube API Services; YouTube's Terms of Service and Google's Privacy Policy apply", with links to both. Thumbnails and avatars load from YouTube's image hosts.
  • A cron. Call syncDue(payload) hourly, after your own secret check, and sendReviewDigest(payload, { mode: 'daily' }) once a day. With goneVideos.mode: 'clear', also call sweepGoneVideos(payload) once a day.
  • Routes for the public pages, if you use them (see Pages).
  • The import map. The admin's review view, nav link and Sync now field are registered by the plugin; run payload generate:importmap after adding it. They need @payloadcms/next, which a Payload admin already has.
  • The key. Pass it with youtube.apiKey. The plugin never reads process.env, never logs request URLs, and cuts the key out of every error and note.

Install or build

npm install @extantape/payload-plugin-playlists

To build it from this repo:

npm ci
npm run typecheck
npm test
npm run build

Node 22 or later, Payload 3.92 or later, MongoDB (the run lock, the unit ledger and the review claim use atomic MongoDB updates).

import { playlists } from '@extantape/payload-plugin-playlists'

plugins: [
  playlists({
    scope: { field: 'tenant', ofRequest, sitesFor, isAdmin },
    enabled: (req) => outsideCallsAllowed(),
    youtube: { apiKey: () => yourSecrets.youtubeKey ?? null },
    schedule: { timeZone: 'Europe/Paris' },
    kinds, shownKinds, topicKinds,
    classify: (videos, { req }) => myClassifier(videos),
  }),
]

Upgrading from Watchlist

This package was @extantape/payload-plugin-watchlist. No old names are kept, so a site that used it makes these changes:

  1. Remove the old package and install the new one.
  2. Change watchlist( to playlists(, and update your imports (including those from /server, /pages, /client and /rsc) and type names: WatchlistOptions is PlaylistsOptions, and WatchlistNotice is PlaylistsNotice.
  3. Keep your usage ledger with collections: { usage: 'watchlist-usage' }. If you don't, today's unit count starts again from zero, so the day can spend up to the cap a second time (each site's cap too), and a digest already sent today can be sent again. A new ledger also forgets that a YouTube quota error stopped today (quotaStopped). Don't run the old and new versions side by side with different ledgers.
  4. Change the notice kinds your notify handles, and any stored per-person notice preferences, to playlists.review and playlists.sync-problem. Otherwise opt-outs stop applying or notices are dropped.
  5. The review page is now /playlists-review under the admin route. To keep the old address, set admin: { reviewPath: '/watchlist-review' }.
  6. Run payload generate:importmap and payload generate:types.
  7. Rename any CSS or tests that use data-watchlist-* or the review queue's watchlist-review-* ids, which are now data-playlists-* and playlists-review-*. If you take the new usage slug, rename the GraphQL type WatchlistUsage to PlaylistsUsage too.
  8. Read the options from config.custom.playlists. Where your code passes the sync's context key, import SYNC_CONTEXT instead of writing its value out. It marks a write as the sync's own, so pass it only from trusted server code, and never build a context from request input.
  9. The admin group is now "Playlists". To keep the old one, set labels: { group: 'Watchlist' }.

Options

OptionDefaultWhat it does
scoperequiredfield (the site field, or leave out on a single-site install), ofRequest(req), sitesFor(req, 'curate' | 'edit'), isAdmin(req). An answer is kept for one request and its user: the same request handed to a different user (another ID or collection, or signed out) is asked again, and a check that's still running keeps to the user it started with. Code that changes a user's roles or sites should use a new request for that user afterward; the old request keeps the old answer.
enabledrequiredOutside calls allowed: YouTube, the feed, notices. Only true allows any.
youtube.apiKeynone: feed only(req) => key | null
youtube.dailyUnitCap2000Units a day across every site
youtube.siteDailyUnitCapnone: a site may use the whole capOne site's share of the day's units, for all of its runs (the cron's and Sync now). A site at its share stops until the next day; other sites go on.
syncNow.cooldownMinutes10How long a creator rests after any sync before a person can run Sync now on it again. 0 turns it off.
youtube.quotaTimeZoneAmerica/Los_AngelesWhere YouTube's day is counted (not checked)
youtube.rsstrueRead the feed first. Turn off if YouTube's terms or robots.txt say no.
scheduleUTC, 12The time zone and default hour of each creator's daily check
defaults.videosDefaultpickedA new creator's "Which videos"
listing.hideEmptytrueThe creator list leaves out a creator with no video a visitor can see, unless the creator is marked Coming soon. false lists every listed creator. Anything but true or false stops startup.
curation.levelcreatorchannel adds a per-channel "Which videos"
curation.urgentAt25Waiting videos that send the digest at once
goneVideos.modekeepclear empties YouTube's title, description, thumbnail, duration and playlists of a video gone longer than clearAfterDays (30), keeping its ID, the curator's choice, its kind and its topic links. With keep, sweepGoneVideos does nothing.
kinds, shownKinds, topicKindsa short neutral listWhat the classifier may answer, what shows, what may go on topic pages. Pass kinds without shownKinds and nothing shows by the rules.
featuredKindsnoneThe kinds on the grid's first tab, which the pages then call Featured. Left out or empty, the first tab is every video a visitor may see except the own-tab kinds. Values from kinds, and none from ownTabKinds or suggestedKinds, or startup stops.
ownTabKindsnoneKinds that show only in a tab of their own, never on the first tab. Values from kinds.
suggestedKindsnoneKinds the sync only suggests. A video of one stays hidden and waits in the review queue, whatever its creator's "Which videos", until a curator says Always show. Each gets a tab of its own. Values from kinds, and none from shownKinds, or startup stops. Adding one re-judges stored videos on the next sync.
livenone: every live video stays hidden{ kinds, scope? }. Finished recordings of live streams go to your classifier. See Live recordings below.
topicsnoneTopic pages (relationTo, the site's field names, resolve(name, req))
classifynone: nothing shows by the rules(videos, { req }), each { key, title, description, channel }
classifyDescriptionChars700How much of each description the classifier gets; 0 sends titles only
notifynoneplaylists.review and playlists.sync-problem notices
admin{ reviewPath: '/playlists-review' }Where the review view lives under the admin route. false leaves the view and its nav link out; Sync now and the two routes stay.
revalidatenoneYour cache, after a sync or a person's change
shows.siteDisplaynone: own(req) => 'keep' | 'own' | 'hide' | null, the site's own setting for shows and creators set to follow it. Anything else means own; a check that throws hides them.
shows.medianone: shows link to YouTube's cover{ collection, siteField?, data? }: an upload collection of the site. Adds logoUpload, coverUpload, feed and coverFrom to each show, and the sync stores each cover there once. siteField defaults to scope.field; data({ site, creator, show, req }) gives a new record's other fields (default { alt: '<show> cover' }).
shows.coverHostsYouTube's image hostsEvery host a show's reads may reach, lowercase: cover images, each show's feed host (an editor types it) and the podcast directory's lookup host (itunes.apple.com). A feed on a host that isn't listed is never read. '*' allows any public host.
shows.getthe plugin's readerThe reader for feeds and covers, for tests.
overridesnonecreators, videos, usage, ruleLog: (collection) => collection
collectionscreators, videos, playlists-usage, playlists-rule-logSlugs. ruleLog is the rule log's; a site that already keeps one passes its own slug
titleRules.enabledtruefalse turns off the three title routes and the sync's title step (they answer 404); stored rules stay

Live recordings

Left out, live changes nothing: every live video stays hidden, as before. With live: { kinds: ['stream'], scope: 'shows' } (each kind must also be in suggestedKinds), a finished recording of a live stream goes to your classifier with live: true on its input. If the classifier answers one of live.kinds or one of shownKinds, the recording waits in the review queue as Suggested: <kind>, hidden, for a curator's yes on that one video. Nothing is shown by itself. Any other answer, relevant anything but true, or a classifier error leaves it hidden.

  • scope: 'shows' (the default): a recording passes only when it's an episode of a show whose row has allowLive ticked. Only a site's editors and admins can tick it. A curator's write that changes it is refused with a 403.
  • scope: 'all': any finished recording on the creator's own channels passes.
  • Finished means YouTube says the broadcast is over, both start and end times are there and sensible, and the duration is above 0. Upcoming and running streams stay hidden as Rule: live stream (not finished), and the sync asks about them again on each run (1 unit per 50 videos) so a stream that ends gets judged. A recording still processing stays hidden.
  • Title patterns never lift a live recording, or anything waiting under a live kind or a shown kind. Each one needs a yes on its own video.
  • Recordings waiting under a shown kind count in the Waiting queue, the dashboard count and the digest.
  • Hosts that build their own Waiting list: use await waitingWhereFor(payload, sites). waitingWhere(sites, o) still gives 0.9.0's query, which leaves out recordings waiting under a shown kind, so a list built from it comes up short of the count.
  • Turning live off changes the rule key. Unlocked recordings go back to hidden as the sync reaches them, and the ones waiting leave the queue at the start of the next sync. A curator's choices stay.

Limits: the live fields haven't been checked against a real YouTube stream. A finished premiere counts as a recording, because YouTube's API doesn't tell the two apart reliably. A show with more than SHOW_PAGES * 50 = 1000 episodes can't use allowLive, because its list can't be read in full.

Commands

ExportWhat it does
syncDue(payload, { now?, budgetMs? })The cron: syncs every creator that's due, within 4 minutes by default, then sends the "at once" digest where the queue passed the threshold
syncCreator(payload, id, { full?, recheck?, budget?, req? })One creator, now. No access check: for your own server code. With a req that has a transaction, the run's writes join it, and the run throws SyncTransactionLost if that transaction is lost (see the rule log)
syncNow(payload, { req, id })Sync now for a person: an editor of the creator's site, or an admin. 401 signed out, 403 without an editor's role, 404 for a creator that doesn't exist or isn't theirs, 409 while a run is going, 429 inside the cooldown (with retryAfter in seconds and a Retry-After header on the route)
reviewVideo(payload, { req, id, choice })A curator's yes or no, with the claim
titleMatches(payload, { req, creator, pattern })The creator's hidden videos whose titles match: { pattern, count, matches, truncated, heldByChannelRule }, newest first, up to 500
showMatches(payload, { req, creator, pattern, ids, rule? })Shows the chosen IDs as the person's Always show: { pattern, shown, refused: [{ id, reason }] }. An ID that isn't a video of this creator refuses the whole request (400). An ID that can't be a video ID is a 400 too. Each video is checked again inside its own write's transaction, and one that changed since the preview, that another curator holds, or that's an episode of a hidden podcast or show (or waiting to find out) is refused and left alone. 503 when the site's shows can't be read. A video that fails to save for any other reason is listed in refused as well, and the videos already shown stay shown
saveTitleRule(payload, { req, creator, pattern })Saves the pattern as a rule, on, or turns the same pattern back on: { rule, added }. A curator who isn't an editor may use it. 404 when the creator isn't on a site you work on (not for an admin). 409 when other saves on the creator keep meeting it
reviewQueueCount(payload, { req, site? })How many videos wait for this person's yes, for a dashboard: their sites for a curator or editor, every site for an admin, 0 for anyone else
sendReviewDigest(payload, { mode: 'daily' | 'urgent' })The digest
sweepGoneVideos(payload, { now?, limit? })With goneVideos.mode: 'clear': asks YouTube once more about videos gone longer than clearAfterDays (50 a unit, inside the daily cap), clears the details of those still gone and marks the others back. Clears nothing without YouTube's answer

syncDue, syncCreator, sendReviewDigest and sweepGoneVideos are for the site's own cron and server code: they check no person, so call them only after your own check (a cron secret, for example) and never straight from a request.

Five routes, all for signed-in staff only (401 signed out), answering { errors: [{ message }] } on a refusal. The three title routes are for curators and editors of the creator's site and admins: 403 with no such role, and another site's creator gets the same 404 as a missing one.

RouteWhat it does
POST /api/creators/:id/syncsyncNow
POST /api/videos/:id/review with { "choice": "show" | "hide" }reviewVideo
POST /api/creators/:id/title-matches with { "pattern" }titleMatches
POST /api/creators/:id/show-matches with { "pattern", "ids", "rule"? }showMatches
POST /api/creators/:id/title-rules with { "pattern" }saveTitleRule

Pages

A Payload plugin can't add Next.js routes, so the site mounts the pages in thin route files. Server functions come from /server, page components (server components, no hooks) from /pages, and the player from /client.

// app/(frontend)/watch/page.tsx
import { listVideos } from '@extantape/payload-plugin-playlists/server'
import { VideosPage } from '@extantape/payload-plugin-playlists/pages'

const paths = { videos: '/watch', creator: (slug: string) => `/watch/c/${slug}`, video: (id: string) => `/watch/v/${id}` }

export default async function Page({ searchParams }) {
  const { page, kind, topic } = await searchParams
  const req = await yourPayloadRequest()
  return <VideosPage result={await listVideos(req, { page, kind, topic })} slots={{ paths, Shell: YourShell, Empty: YourEmpty, TopicFilter: YourTopicFilter, pageHref: (n) => `/watch?page=${n}` }} />
}
Server functionAnswersPage
listCreators(req){ creators }CreatorListPage
getCreator(req, { slug, show?, page? }){ creator, show, videos, page, pages, total }; with show (an entry's slug), that podcast's or show's pageCreatorPage
listVideos(req, { page?, perPage?, kind?, topic? }){ videos, page, pages, total, kinds, tabs, featured, kind, topic }VideosPage (and VideoGrid on its own)
getVideo(req, { youtubeId }){ video }VideoPage, with the click-to-play Player
reviewQueue(req, { page?, site?, queue?, creator?, kind? }){ queue, rows, total, page, pages, counts, creators }, staff only. queue is waiting (the default), topics, new, hidden or reviewed; a creator ID or kind it doesn't know is ignoredReviewQueue from /client (the admin view uses it)
  • Each creator in listCreators and getCreator carries shows: its podcasts and shows with an entry of their own that have a video showing or are marked coming soon, each with slug, name, kind, logo and comingSoon. A slug comes from the name; shows of one creator with the same name get -2, -3 and so on, in list order, so reordering same-named shows changes their slugs. Each video carries show, the podcast or show it's an episode of (slug, name, logo, and own when it has its own entry), or null. The creator's page leaves out the episodes of shows with their own entry. Videos are counted as a signed-out visitor, so a hidden or waiting video never counts. Add paths.show(creatorSlug, showSlug) to link the entries; without it they're listed with no link.
  • Reading feeds and covers: only from shows.coverHosts, https only on the default port, no user name or password in the link, no local names (a name with no dot, localhost and names under it, .local, .internal, home.arpa and names under it, localhost.localdomain), no redirects, 5 seconds a read, at most 512 KB for a feed or robots.txt and 2 MB for an image, counted as the body arrives. Every address a name resolves to must be public. IPv6 addresses that carry an IPv4 one (compatible, mapped, translated, 6to4, 64:ff9b:1::/48 and Teredo) and site-local ones are refused whatever they carry; the check runs inside the connection's own lookup, so the connection goes to a checked address. An image's type is read from its bytes: JPEG, PNG or WebP, never SVG. Each host's robots.txt is read once per sync run before any feed, directory or cover read from it: a 404 or 410 allows, a Disallow refuses, and a 5xx, another 4xx, a redirect, a timeout or a network error refuses that host for the run. Nothing is read unless enabled is exactly true. A podcast directory page is read through Apple's public lookup.
  • Each answers plain JSON, or { error: { code, message } } with a message a page can show as it is. isError(result) tells them apart. Codes: notFound, badInput, signIn, notStaff, generic.
  • The four public functions read as a signed-out visitor of the request's site, whoever is signed in, through the collections' own read access. A curator sees on the public pages what everyone sees. A hidden video, an unlisted creator and one that doesn't exist all answer notFound.
  • listVideos answers tabs: the first tab (kind: null), then your shown kinds, then the own-tab kinds, each as { kind, label, count }. count is how many videos a visitor would see on that tab, read through the videos' own access, under the topic asked for. That's one count per tab that isn't open, on each call. featured says whether the first tab is your featuredKinds. With no kind, the grid is the first tab. With a topic and no kind, the list keeps every kind. kinds is unchanged. tabWhere(options, kind) and tabsOf(options) come from the package root and /server for a site that builds its own queries.
  • VideosPage draws the tabs as links through kindHref. The first is "Featured" when featured is true and "All types" otherwise (text.featured, text.allTypes). An own-tab kind's link shows once it has a video, or while it's the open tab. The open tab's link has aria-current="page", like the current page in the page links. The counts aren't drawn.
  • listCreators lists a creator only when a visitor can see at least one of their videos, counted through the videos' own read access for the request's site. A hidden video, one waiting for a curator's yes and a video on another site never count. A creator marked Coming soon is listed while empty, with comingSoon: true in the answer, and the pages show the words "Coming soon" beside the name (text.comingSoon changes them). Once a video shows, the answer says false and the stored mark is left alone. getCreator still answers for an empty listed creator, so a direct link works. The list now depends on videos, so a cache of it should clear on the videos tag as well as creators.
  • A podcast or show row has its own comingSoon. An entry of its own marked that way is listed while empty, with comingSoon: true in its card until a video of it shows. The site's curators can set it on rows already there.
  • The only filters are kind (one of your kinds), topic (a topic's id; only videos on topic pages automatically or by a curator's yes) and the page. Anything else in the input is ignored or refused.
  • A creator in an answer carries name and shortName (or null). creatorDisplayName(creator) from /server gives the short name when there is one and the full name otherwise, and creatorFullName(creator) gives the full name only when a different short one is shown. CreatorName from /pages draws both: the short name to see, the full name as its title and for screen readers. The plugin's cards and bylines use it. A creator's own page keeps the full name as its heading.
  • Slots, all props: Shell (your page layout: it gets title and draws the <main> and <h1>), Empty (your empty state), TopicFilter (your topic picker above the grid; the plugin doesn't know your topics), text (your wording), locale, and paths, pageHref, kindHref for links. Each has a plain default except paths.
  • The pages are one column that widens into a grid, with real headings, lists, <time> and named navs, links and buttons at least 44 pixels, and kinds said in words. They store nothing in the browser: no cookies, no web storage.

On its own, and with others

Playlists imports no other plugin and needs none. It works with only Payload and MongoDB.

Things it can work with, all optional and wired by the site:

  • Notifications: your site writes the notify function Playlists asks for and has it call that plugin's, choosing who hears about waiting reviews and stopped syncs. The two functions take different arguments, so you can't pass one in as the other.
  • AI Budget: wrap your classify with its budget check. Over budget, videos wait unclassified, so they don't show.
  • A multi-tenant plugin: it adds the site field; Playlists reads it through scope. Leave the rule log out of its collections: a line takes its site from its creator.

Needs: Payload ^3.92.0 as a peer dependency, with @payloadcms/next ^3.92.0 and React ^19.0.0 optional. No other EXTANT APE plugin is required.

Color Theory: no direct link. Its pages bring no colors of their own and take your site's CSS, so a site styled with Color Theory's --palette-* tokens styles them too. The player is a black video frame.

License

MIT. Copyright (c) 2026 EXTANT APE.

Similar plugins