Skip to content
0

katanakit-js / useInitYoutube

Function: useInitYoutube() ​

ts
function useInitYoutube(config): void;

Defined in: src/core/services/youtube.service.ts:41

Registers the YouTube APIs (youtube + keyless youtubeFeed) and stores the default channel. Call once per app, server/build-time — the API key must never ship to the browser.

Parameters ​

ParameterTypeDescription
config{ apiKey: string; channelId: string; }API key + default channel id.
config.apiKeystringYouTube Data API v3 key (server/build-time only, never public).
config.channelIdstringDefault channel id (UC…). Per-call params can override it.

Returns ​

void

Example ​

ts
useInitYoutube({ apiKey: process.env.YOUTUBE_API_KEY!, channelId: "UC…" });
const page = await useGetChannelVideos({ maxResults: 6 });

Released under the MIT License.