youtube-thumbnail-at-time
v1.0.3
Published
Given a YouTube video ID and a time in seconds, youtube-thumbnail-at-time fetches the video's storyboard and exracts the thumbnail image at the given time
Downloads
7
Readme
youtube-thumbnail-at-time
youtube-thumbnail-at-time is a library that takes a YouTube video ID and a time in seconds, and returns a Promise that resolves to a StoryboardFrame
object representing the thumbnail image at that time.
Installation
To use youtube-thumbnail-at-time
in your project, you can install it using npm: npm install youtube-thumbnail-at-time
Usage
Here's an example of how to use timeToThumbnail in your TypeScript code:
import timeToThumbnail from 'thumbnail-at-time';
async function main() {
const videoId = '-yPEewaalik'; // my favorite guitar piece
const frame = await timeToThumbnail(videoId, time);
console.log(frame); // { src, x, y, frameWidth, frameHeight }
}
main();
API
timeToThumbnail(videoId: string, time: number): Promise<StoryboardFrame>
Given a video ID and a time in seconds, returns a Promise that resolves to a StoryboardFrame object representing the thumbnail image at that time.
videoId
: The ID of the YouTube video.time
: The time in seconds.
License
youtube-thumbnail-at-time is licensed under the MIT License. See the LICENSE file for more information.
Credits
youtube-thumbnail-at-time was created by Amani Kiruga