Exyt (exyt_dlp v0.1.2)
Documentation for Exyt
.
Wrapper / helper to download media from YT
Summary
Functions
check_setup
Downloads a media file from a valid YouTube URL.
Downloads a media file from the given URL and retrieves its local filepath.
Retrieves the description of a media file from the given URL.
Retrieves the duration of a media file from the given URL.
Retrieves the filename of a media file from the given URL.
Retrieves the format of a media file from the given URL.
Retrieves the ID of a media file from the given URL.
Retrieves the thumbnail URL of a media file from the given URL.
Retrieves the title of a media file from the given URL.
Retrieves the media URL from the given URL.
Checks if a URL string is valid.
Validates a URL string to check if it's a valid YouTube URL.
call ytdlp with custom params
Functions
check_setup()
check_setup
Examples
iex> Exyt.check_setup()
download(url, opts \\ %{})
Downloads a media file from a valid YouTube URL.
Parameters
`url` (string): A valid YouTube URL.
`opts` (map): Download options.
Options
`:quality` (atom): The quality of the downloaded video. (:hd | :fhd | :qhd | :uhd | :best). Default is `:best`.
`:output_path` (string): The directory to save downloaded files. Default is the current working directory.
`:format` (string): The desired format of the downloaded file ("webm", "mp4", "m4a"). Default is "webm".
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> options = %{output_path: "/tmp/test/", format: "mp4", quality: :fhd}
iex> Exyt.download(url, options)
download_getting_filename(url, opts \\ %{})
Downloads a media file from the given URL and retrieves its local filepath.
Parameters
`url` (string): A URL string pointing to a media file.
`opts` (map): Download options.
Options
`:quality` (atom): The quality of the downloaded video. (:hd | :fhd | :qhd | :uhd | :best). Default is `:best`.
`:output` (string): The directory to save downloaded files. Default is the current working directory.
`:format` (string): The desired format of the downloaded file ("webm", "mp4", "m4a"). Default is "webm".
Returns
A tuple with two elements:
- `:status_request` (atom): The status of the request (:ok or :error).
- `:string_local_filepath` (string): The local filepath of the downloaded media file.
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> options = %{output_path: "/tmp/test/", format: "mp4", quality: :fhd}
iex> Exyt.download_getting_filename(url, options)
get_description(url)
Retrieves the description of a media file from the given URL.
Parameters
`url` (string): A URL string pointing to a media file.
Returns
A tuple with two elements:
- `:status_request` (atom): The status of the request (:ok or :error).
- `:string_media_description` (string): The description of the media file.
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> Exyt.get_description(url)
get_duration(url)
Retrieves the duration of a media file from the given URL.
Parameters
`url` (string): A URL string pointing to a media file.
Returns
A tuple with two elements:
- `:status_request` (atom): The status of the request (:ok or :error).
- `:string_duration_in_seconds` (string): The duration of the media file in seconds.
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> Exyt.get_duration(url)
get_filename(url)
Retrieves the filename of a media file from the given URL.
Parameters
`url` (string): A URL string pointing to a media file.
Returns
A tuple with two elements:
- `:status_request` (atom): The status of the request (:ok or :error).
- `:string_media_filename` (string): The filename of the media file.
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> Exyt.get_filename(url)
get_format(url)
Retrieves the format of a media file from the given URL.
Parameters
`url` (string): A URL string pointing to a media file.
Returns
A tuple with two elements:
- `:status_request` (atom): The status of the request (:ok or :error).
- `:string_media_format` (string): The format of the media file.
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> Exyt.get_format(url)
get_id(url)
Retrieves the ID of a media file from the given URL.
Parameters
`url` (string): A URL string pointing to a media file.
Returns
A tuple with two elements:
- `:status_request` (atom): The status of the request (:ok or :error).
- `:string_media_id` (string): The ID of the media file.
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> Exyt.get_id(url)
get_thumbnail(url)
Retrieves the thumbnail URL of a media file from the given URL.
Parameters
`url` (string): A URL string pointing to a media file.
Returns
A tuple with two elements:
- `:status_request` (atom): The status of the request (:ok or :error).
- `:string_thumbnail_url` (string): The URL of the media file's thumbnail.
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> Exyt.get_thumbnail(url)
get_title(url)
Retrieves the title of a media file from the given URL.
Parameters
`url` (string): A URL string pointing to a media file.
Returns
A tuple with two elements:
- `:status_request` (atom): The status of the request (:ok or :error).
- `:string_media_title` (string): The title of the media file.
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> Exyt.get_title(url)
get_url(url)
Retrieves the media URL from the given URL.
Parameters
`url` (string): A URL string pointing to a media file.
Returns
A tuple with two elements:
- `:status_request` (atom): The status of the request (:ok or :error).
- `:string_media_url` (string): The URL of the media file.
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> Exyt.get_url(url)
is_valid_url?(url)
Checks if a URL string is valid.
Parameters
`url` (string): A URL string to be checked for validity.
Returns
A boolean indicating whether the URL is valid (true) or not (false).
Examples
iex> valid_url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> Exyt.is_valid_url?(valid_url)
true
list_formats(url)
validate_url(url)
Validates a URL string to check if it's a valid YouTube URL.
Parameters
-`url` (string): A URL string to be validated.
Returns
A tuple representing the validation result:
{:ok, valid_url}
(tuple): If the URL is a valid YouTube URL.{:error, :invalid_youtube_url}
(tuple): If the URL is not a valid YouTube URL.
Examples
iex> url = "https://www.youtube.com/watch?v=BaW_jenozKc"
iex> Exyt.validate_url(url)
ytdlp(params, url)
call ytdlp with custom params
Examples
iex> Exyt.ytdlp(["--get-filename"], "https://www.youtube.com/watch?v=BaW_jenozKc")