-
Notifications
You must be signed in to change notification settings - Fork 0
API
Spyter provides a modern and consistent API. It allows you to easily search on YouTube and retrieve information about videos and playlists.
Checks whether a URL matches the format of a video URL on YouTube.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
url |
unknown |
❌ | Video URL. |
Returns:
boolean
Gets the metadata of a video.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
url |
string |
❌ | Video URL. | |
options |
VideoOptions |
✔️ | See VideoOptions . |
Video retrieval options. |
Returns:
Promise<VideoMeta>
Gets the audio formats of a video.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
url |
string |
❌ | Video URL. | |
options |
VideoOptions |
✔️ | See VideoOptions . |
Video retrieval options. |
Returns:
Promise<Format[]>
Gets the metadata and audio formats of a video.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
url |
string |
❌ | Video URL. | |
options |
VideoOptions |
✔️ | See VideoOptions . |
Video retrieval options. |
Returns:
Promise<Video>
Checks whether a URL matches the format of a playlist URL on YouTube.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
url |
unknown |
❌ | Playlist URL. |
Returns:
boolean
Retrieves information about a playlist on YouTube.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
url |
string |
❌ | Playlist URL. | |
options |
PlaylistOptions |
✔️ | See PlaylistOptions . |
Playlist retrieval options. |
Returns:
Promise<Playlist>
Performs a search on YouTube.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
query |
string |
❌ | Query. | |
options |
SearchOptions |
✔️ | See SearchOptions . |
Search options. |
Returns:
Promise<VideoMeta[]>
Video retrieval options.
Property | Type | Default | Description |
---|---|---|---|
language? |
string |
en |
ISO 639-1 language code (e.g., en , de ). |
region? |
string |
US |
ISO 3166-2 region code (e.g., US , DE ). |
Playlist retrieval options.
Property | Type | Default | Description |
---|---|---|---|
maxPages? |
number |
1 |
Maximum number of pages to retrieve. |
maxVideos? |
number |
100 |
Maximum number of videos to retrieve. |
language? |
string |
en |
ISO 639-1 language code (e.g., en , de ). |
region? |
string |
US |
ISO 3166-2 region code (e.g., US , DE ). |
Search options.
Property | Type | Default | Description |
---|---|---|---|
maxVideos? |
number |
1 |
Maximum number of videos to retrieve. |
language? |
string |
en |
ISO 639-1 language code (e.g., en , de ). |
region? |
string |
US |
ISO 3166-2 region code (e.g., US , DE ). |
Video.
Property | Type | Description |
---|---|---|
id |
string |
Video ID. |
url |
string |
Video URL. |
title |
string |
Video title. |
channelUrl |
string |
Channel URL. |
channelName |
string |
Channel name. |
thumbnails |
Thumbnail[] |
List of available thumbnails. |
duration |
number |
Duration in seconds. If the video is live, duration will be Infinity . |
isLive |
boolean |
Whether a video is a livestream or not. |
formats |
Format[] |
List of available audio formats. |
See Video
, except without formats
.
Playlist.
Property | Type | Description |
---|---|---|
id |
string |
Playlist ID. |
url |
string |
Playlist URL. |
title |
string |
Playlist title. |
channelUrl |
string |
Channel URL of the playlist owner. |
channelName |
string |
Channel name of the playlist owner. |
thumbnails |
Thumbnail[] |
List of available thumbnails. |
videos |
VideoMeta[] |
List of videos from the playlist. |
Audio format.
Property | Type | Description |
---|---|---|
url |
string |
Audio format URL. |
itag |
number |
Format code. See this gist for more information. |
mimeType |
string |
MIME type. |
codec |
string |
Audio codec. |
bitrate |
number |
Audio bitrate. |
isLive? |
boolean |
Whether the format is a live format or not. |
⚠️ Note: Livestreams can only be played via formats that have theisLive
property, otherwise you will only get a small portion of the audio.
Video thumbnail.
Property | Type | Description |
---|---|---|
url |
string |
Thumbnail URL. |
width |
number |
Width in px . |
height |
number |
Height in px . |