fetch-youtube-uploads
Version:
Returns a YouTube channel's latest uploads. Fetching is done with user requests instead of APIs.
44 lines • 1.21 kB
TypeScript
/** @module fetch-youtube-uploads
*/
declare module "fetch-youtube-uploads" {
export class NoResultsError extends Error {
}
/**
* @function
* @param {string} html
* @return {Video[]}
*/
export function fetchUploadsFromHtml(html: string): Video[];
/**
* @typedef {Object} Video
* @prop {string} id
* @prop {string} title
* @prop {boolean} published If `false`, a reminder button was found which usually means that the video entry is a future premiere
*/
export type Video = {
id: string;
title: string;
published: boolean;
};
/**
* @typedef {Object} Options
* @prop {number} [retries = 3]
*/
export type Options = {
retries?: number;
};
/**
* @function
* @param {string} userId
* @param {Options} options
* @return {Promise<Video[]>}
*/
export function fetchUploadsForUser(userId: string, options: Options): Promise<Video[]>;
/**
* @function
* @param {string} channelId
* @param {Options} options
* @return {Promise<Video[]>}
*/
export default function(channelId: string, options: Options): Promise<Video[]>;
}