ytsearch.js
Types

Search Types

Types used by the YouTube search API.

SearchType

ts
type SearchType = (typeof ExpectedTypes)[number];

// "any" | "video" | "channel" | "playlist" | "movie" | "live"

SortType

ts
type SortType = (typeof ExpectedSorts)[number];

// "relevance" | "upload_date" | "view_count" | "rating"

SearchOptions

ts
interface SearchOptions {
  type?: SearchType;
  sort?: SortType;
  limit?: number;
}

SearchResultMeta

ts
interface SearchResultMeta {
  estimatedPages: number;
  estimatedResults: number;
  hasNextPage: boolean;
  ytPage: number;
  ytPageSize: number;
  userPage: number;
  userPageSize: number;
  searchType: SearchType;
  sortType: SortType;
  query: string;
  resultRange: [number, number];
}

SearchResult

ts
interface SearchResult extends SearchResultBuffer {
  metadata: SearchResultMeta;
  nextPage: () => Promise<SearchResult | null>;
}