Video library — the caller's own saved, liked and playlisted videos
Reads and writes the caller's OWN YouTube account: their Watch Later list, their liked videos, and the playlists they keep — including making a new one…
Reads and writes the caller's OWN YouTube account: their Watch Later list, their liked videos, and the playlists they keep — including making a new one and adding videos to it. Needs the caller's YouTube sign-in: the first run answers needs_user with a link to sign in, and later runs reuse it with no browser.
Also known as: my youtube home page, my youtube feed, what youtube is recommending me, my front page, my watch later, watch later, my liked videos, videos I liked, my youtube playlists, make a playlist, create a playlist, add to my playlist, save videos to a playlist, my saved videos
Call it
bowmark.video_library.homeFeed(options?: { limit?: number }): Promise<LibraryPage>
bowmark.video_library.watchLater(options?: { continuation?: string }): Promise<LibraryPage>
bowmark.video_library.liked(options?: { continuation?: string }): Promise<LibraryPage>
bowmark.video_library.createPlaylist(options: CreatePlaylistOptions): Promise<CreatedPlaylist>
bowmark.video_library.addToPlaylist(options: AddToPlaylistOptions): Promise<PlaylistEdit>Functions
| Function | What it does |
|---|---|
homeFeed | The videos on the caller's OWN YouTube home page — the personalized recommendation grid, in YouTube's own order, which is what they see when they open youtube.com right now. |
watchLater | The caller's own Watch Later queue, newest first. |
liked | The videos the caller has liked, newest first. |
createPlaylist | Creates an empty playlist on the caller's own account and returns its id and URL. |
addToPlaylist | Adds one or many videos to one of the caller's own playlists, as a single edit. |
Types
interface LibraryVideo {
videoId: string
url: string
title: string
channel: string | null
views: string | null // the site's own text, e.g. "1.2M views" — never a parsed number
length: string | null // e.g. "22:28"; null for a live stream
}
interface LibraryPage {
videos: LibraryVideo[]
continuation: string | null // pass back for the next page; null on the last
warnings: string[]
}
interface CreatePlaylistOptions {
title: string
description?: string
privacy?: "private" | "unlisted" | "public" // default "private"
}
interface CreatedPlaylist {
playlistId: string
title: string
privacy: "private" | "unlisted" | "public"
url: string // show this to your user — it opens the playlist
warnings: string[]
}
interface AddToPlaylistOptions {
playlist: string // a playlist id, or any URL carrying a "list" param
video?: string // one video id or watch URL
videos?: string[] // or several — sent as ONE edit
}
interface PlaylistEdit {
playlistId: string
added: string[] // what was sent and accepted, in order — not a per-video receipt
url: string
warnings: string[]
}
type CallOptions = {
timeoutMs?: number // per-provider budget in ms, default 30000, clamped to 1000-55000.
// A provider slower than this is DROPPED from the results and
// NAMED in warnings — never silently absent
}Examples
// Research a topic, read the transcripts, keep the ones that actually cover it.
const found = await bowmark.providers.youtube.search({
query: "postgres query planner", uploadedWithin: "year",
});
const withText = await Promise.all(found.slice(0, 10).map(async (v) => ({
v, text: (await bowmark.providers.youtube.getTranscript({ video: v.videoId })).fullText,
})));
const keep = withText.filter((x) => /query plan|EXPLAIN ANALYZE/i.test(x.text));
const list = await bowmark.video_library.createPlaylist({ title: "Query planner deep dives" });
await bowmark.video_library.addToPlaylist({
playlist: list.playlistId, videos: keep.map((x) => x.v.videoId),
});
return { open: list.url, kept: keep.length, of: withText.length };// The first five videos on my own YouTube home page, and what they are about.
const page = await bowmark.video_library.homeFeed({ limit: 5 });
const withText = await Promise.all(page.videos.map(async (v) => ({
title: v.title, channel: v.channel, url: v.url,
transcript: (await bowmark.providers.youtube.getTranscript({ video: v.videoId })).fullText,
})));
return withText; // hand the transcripts to the model — Bowmark does not summarizeProviders behind it
| Provider | |
|---|---|
youtube | YouTube |