Skip to content
0

katanakit-js / useGetChannelVideos

Function: useGetChannelVideos() ​

ts
function useGetChannelVideos(params?): Promise<FetchResult<{
  nextPageToken?: string;
  prevPageToken?: string;
  totalResults?: number;
  videos: {
     channelTitle?: string;
     description: string;
     durationSeconds?: number;
     embedUrl: string;
     id: string;
     publishedAt: string;
     thumbnail: string;
     thumbnails: {
        default: string;
        high: string;
        medium: string;
     };
     title: string;
     url: string;
     viewCount?: number;
  }[];
}>>;

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

Lists channel videos via the quota-cheap path (channels → playlistItems, never search.list which costs 100 units). Call server/build-time and cache the response (1h) to share quota across every repo using the same GCP project.

Parameters ​

ParameterTypeDescription
params{ channelId?: string; maxResults?: number; pageToken?: string; playlistId?: string; }Channel/playlist, page size (1–50) and page token.
params.channelId?stringChannel id (defaults to the one from useInitYoutube).
params.maxResults?numberItems per page (1–50, defaults to 12).
params.pageToken?stringOpaque page token from a previous response.
params.playlistId?stringSkip the channels lookup when the uploads playlist id is known.

Returns ​

Promise<FetchResult<{ nextPageToken?: string; prevPageToken?: string; totalResults?: number; videos: { channelTitle?: string; description: string; durationSeconds?: number; embedUrl: string; id: string; publishedAt: string; thumbnail: string; thumbnails: { default: string; high: string; medium: string; }; title: string; url: string; viewCount?: number; }[]; }>>

Safe Result with normalized videos + pagination.

Released under the MIT License.