Members
(package, constant) STYLE_FMTS
A list contains all supported style formats for styling text.
It extends the builtin color formats from `util.inspect.colors``property.
- Since:
- 2.0.0
- Source:
Type Definitions
AllThumbnailsObject
An object containing arrays of author and video thumbnail objects.
Typically returned by the
function.getThumbnails
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
author |
Array.<ThumbnailObject> | An array of author thumbnail objects or an empty array if not available. |
video |
Array.<ThumbnailObject> | An array of video thumbnail objects or an empty array if not available. |
- Since:
- 2.0.0
- Source:
AudioConverterOptions
Options for configuring the audio conversion.
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
inputOptions |
Array.<string> |
<optional> |
[] | The input options for the conversion. |
outputOptions |
Array.<string> |
<optional> |
[] | The output options for the conversion. |
format |
string |
<optional> |
'mp3' | The desired output format (e.g., |
bitrate |
string | number |
<optional> |
128 | The audio bitrate (e.g., |
frequency |
number |
<optional> |
44100 | The audio sampling frequency in Hz. |
codec |
string |
<optional> |
'libmp3lame' | The audio codec to use (e.g., |
channels |
number |
<optional> |
2 | The number of audio channels ( |
deleteOld |
boolean |
<optional> |
false | Whether to delete the original file after conversion. |
quiet |
boolean |
<optional> |
false | Whether to suppress the conversion progress and error message or not. |
- Since:
- 1.0.0
- Source:
- See:
AuthorInfo
Represents the extracted and normalized author information.
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The normalized author name. |
|
id |
string | The author's unique ID. |
|
userUrl |
string | The author's user profile URL. |
|
channelUrl |
string | The author's channel URL. |
|
externalChannelUrl |
string |
<optional> |
The external URL linking to the author's channel. |
username |
string |
<optional> |
The author's YouTube username. |
thumbnails |
Array.<ThumbnailObject> |
<optional> |
An array of thumbnail objects representing the author's profile images. |
verified |
boolean | Whether the author is a verified YouTube user. |
|
subscriberCount |
number |
<optional> |
The number of subscribers the author has. |
- Since:
- 2.0.0
- Source:
BatchDownloadOptions
An object to configure the batch download process, including the getting of video information, and audio conversion.
This interface extends to DownloadOptions
and
.ytdl.downloadOptions
The batch download is known to have different processor which makes it have a custom default download handler, see
.defaultBatchHandler
Type:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
encoding |
string |
<optional> |
'utf-8' | The encoding to use for reading the batch file contents. |
includeID |
boolean |
<optional> |
Whether to include and parse any string representing a YouTube video ID when processing batch file. |
BatchDownloadResult
The download result object returned by the
function.batchDownload
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
results |
Record.<string, DownloadResult> | A mapping of video IDs to their download results. |
results[videoId].errors |
Array.<Error> | All errors that occurred during the download process for each video ID,
or |
- Since:
- 2.0.0
- Source:
- See:
DLHandlerData
This interface represents a handler data object that shared to download handler function during download process.
Type:
- Object
Properties:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
videoInfo |
ytdl.videoInfo | The information about the video. |
||||||||||
videoFormat |
ytdl.videoFormat | The format information of the video. |
||||||||||
outStream |
fs.WriteStream | The output stream for the video. |
||||||||||
range |
object |
<optional> |
The range information of the video. Properties
|
|||||||||
title |
string | null | The title of the video. |
||||||||||
authorName |
string | The name of the author. |
||||||||||
videoUrl |
string | The URL of the video. |
||||||||||
videoId |
string | The ID of the video. |
||||||||||
channelId |
string | The ID of the channel. |
||||||||||
duration |
string | The duration of the video. |
||||||||||
viewers |
number | null | The view count of the video. |
||||||||||
subscribers |
number | null | The subscriber count of the author's channel. |
DownloadOptions
An object to configure the download process, including the getting of video information, and audio conversion.
It extends the
interface from the
ytdl.downloadOptions
@distube/ytdl-core
module, this way you can pass any option of the ytdl.downloadOptions
object.
Type:
- ytdl.downloadOptions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
cwd |
string |
<optional> |
'.' | The current working directory. If not specified, defaults to the current directory.
Used to resolve relative paths for |
outDir |
string |
<optional> |
'.' | The output directory where downloaded files will be saved. If not specified, defaults to the current directory. |
outFile |
string |
<optional> |
The output file name for the downloaded audio. If not specified, defaults to the sanitized title of the video. |
|
convertAudio |
boolean |
<optional> |
false | Whether to enable audio conversion behavior. Defaults to |
converterOptions |
AudioConverterOptions |
<optional> |
The options for audio conversion (requires |
|
quiet |
boolean | 'all' |
<optional> |
true | Whether to suppress all log messages. If set to |
handler |
function |
<optional> |
An asynchronous function to handle and customize the download process.
If not specified, defaults to |
|
format |
ytdl.videoFormat |
<optional> |
The audio format to download. If not specified, defaults to the best audio format. |
|
useCache |
boolean |
<optional> |
true | Whether to enable caching video information during the download process. Defaults to |
DownloadResult
The download result object returned by the
function.download
Type:
- Object
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
path |
string | The full path to the downloaded audio file. |
||||||||||||||||||||||||||||||||||||
outputFile |
string | Alias for |
||||||||||||||||||||||||||||||||||||
url |
string | The URL of the video. |
||||||||||||||||||||||||||||||||||||
cache |
object |
Properties
|
||||||||||||||||||||||||||||||||||||
metadata |
object | The metadata information of the video. Properties
|
||||||||||||||||||||||||||||||||||||
thumbnails |
object | The thumbnails information of the video. Properties
|
||||||||||||||||||||||||||||||||||||
conversionResult |
ConversionResult | null | The audio conversion result object. |
ExtractedVideoInfoCacheObject
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
id |
string | The ID of the video. |
title |
string | The title of the video or |
authorName |
string | The name of the author of the video or |
videoUrl |
string | The URL of the video. |
authorUrl |
string | The URL of the author of the video (refers to author profile). |
videoInfo |
ytdl.videoInfo | The extracted and unsealed video information object. |
ParsedYTFormatObject
Type:
Properties:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
mimeType |
MIMEType | MIMEType instance representing the media type. |
||||||||||
initRange |
Object |
<nullable> |
Byte range for the initialization segment. Properties
|
|||||||||
indexRange |
Object |
<nullable> |
Byte range for the index segment. Properties
|
|||||||||
lastModified |
module:utils/info-utils~DateFormatter |
<nullable> |
A |
|||||||||
contentLength |
number |
<nullable> |
Parsed integer value of the content length. |
|||||||||
approxDurationMs |
number |
<nullable> |
Parsed integer value of the approximate duration in milliseconds. |
|||||||||
audioSampleRate |
number |
<nullable> |
Parsed integer value of the audio sample rate. |
- Since:
- 2.0.0
- Source:
ThumbnailObject
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
url |
string | The URL of the thumbnail image. |
width |
number | The width of the thumbnail image in pixels. |
height |
number | The height of the thumbnail image in pixels. |
- Since:
- 2.0.0
- Source:
VideoInfoCacheObject
Type:
- Object
Properties:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
id |
string | The ID of the video. |
|||||||||
title |
string | The title of the video or |
|||||||||
authorName |
string | The name of the author of the video or |
|||||||||
videoUrl |
string | The URL of the video. |
|||||||||
authorUrl |
string | The URL of the author of the video (refers to author profile). |
|||||||||
videoInfo |
Object | The sealed video information object. Properties
|
YTFormatObject
Type:
- Object
Properties:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
mimeType |
string | The MIME type of the format, e.g., |
||||||||||
qualityLabel |
string |
<nullable> |
The video quality label (e.g., |
|||||||||
bitrate |
number |
<nullable> |
The average bitrate in bits per second (bps). |
|||||||||
audioBitrate |
number |
<nullable> |
The audio bitrate in kilo bits per second (kbps), or |
|||||||||
itag |
number | The format's unique identifier. |
||||||||||
url |
string | The direct URL for downloading the format. |
||||||||||
initRange |
Object |
<nullable> |
Byte range for the initialization segment. Properties
|
|||||||||
indexRange |
Object |
<nullable> |
Byte range for the index segment. Properties
|
|||||||||
lastModified |
string |
<nullable> |
The timestamp of the last modification in microseconds since the UNIX epoch. |
|||||||||
contentLength |
string |
<nullable> |
The total length of the content in bytes, or |
|||||||||
quality |
string |
<nullable> |
The quality string, e.g., |
|||||||||
projectionType |
string |
<nullable> |
The type of video projection, e.g., |
|||||||||
averageBitrate |
number |
<nullable> |
The average bitrate in bits per second (bps), or |
|||||||||
highReplication |
boolean |
<nullable> |
Indicates if the format uses high replication for streaming. |
|||||||||
audioQuality |
string |
<nullable> |
The audio quality label, e.g., |
|||||||||
approxDurationMs |
string | The approximate duration of the format in milliseconds as a string. |
||||||||||
audioSampleRate |
string |
<nullable> |
The audio sample rate in Hertz as a string (e.g., |
|||||||||
audioChannels |
number |
<nullable> |
The number of audio channels, or |
|||||||||
loudnessDb |
number |
<nullable> |
The loudness level in decibels, or |
|||||||||
hasVideo |
boolean | Indicates whether the format includes a video track. |
||||||||||
hasAudio |
boolean | Indicates whether the format includes an audio track. |
||||||||||
container |
string | The container format, e.g., |
||||||||||
codecs |
string | The combined codecs for audio and video or only one of them, e.g., |
||||||||||
videoCodec |
string |
<nullable> |
The video codec, or |
|||||||||
audioCodec |
string |
<nullable> |
The audio codec, or |
|||||||||
isLive |
boolean | Indicates if the format is part of a live stream. |
||||||||||
isHLS |
boolean | Indicates if the format is in HLS (HTTP Live Streaming) format. |
||||||||||
isDashMPD |
boolean | Indicates if the format is in DASH (Dynamic Adaptive Streaming over HTTP) format. |
- Since:
- 2.0.0
- Source:
YTMP3Config
A typedef representating the configuration object containing options to configure the both download and audio conversion process.
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
downloadOptions |
DownloadOptions | Options related to the download process. |
|
audioConverterOptions |
ConvertAudioOptions |
<optional> |
Options related to the audio conversion process, if not defined in
|