MCPcopy Create free account
hub / github.com/simstudioai/sim / resolvePlaylistId

Function resolvePlaylistId

apps/sim/connectors/youtube/youtube.ts:153–168  ·  view source on GitHub ↗

* Resolves the effective playlist ID to sync from sourceConfig, and whether the source * is a channel's reverse-chronological uploads playlist (which enables early-stop for * the `publishedAfter` filter). A `playlistId` takes precedence over a `channelId`.

(
  apiKey: string,
  sourceConfig: Record<string, unknown>,
  retryOptions?: Parameters<typeof fetchWithRetry>[2]
)

Source from the content-addressed store, hash-verified

151 * the `publishedAfter` filter). A `playlistId` takes precedence over a `channelId`.
152 */
153async function resolvePlaylistId(
154 apiKey: string,
155 sourceConfig: Record<string, unknown>,
156 retryOptions?: Parameters<typeof fetchWithRetry>[2]
157): Promise<{ playlistId: string | null; isUploadsPlaylist: boolean }> {
158 const playlistId = (sourceConfig.playlistId as string | undefined)?.trim()
159 if (playlistId) return { playlistId, isUploadsPlaylist: false }
160
161 const channelId = (sourceConfig.channelId as string | undefined)?.trim()
162 if (channelId) {
163 const resolved = await resolveUploadsPlaylistId(apiKey, channelId, retryOptions)
164 return { playlistId: resolved, isUploadsPlaylist: resolved != null }
165 }
166
167 return { playlistId: null, isUploadsPlaylist: false }
168}
169
170/**
171 * Extracts the video ID from a playlist item, preferring the stable

Callers 1

youtube.tsFile · 0.85

Calls 1

resolveUploadsPlaylistIdFunction · 0.85

Tested by

no test coverage detected