The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

getvideo - Download YouTube and other videos.

VERSION

Version 0.203

SYNOPSIS

    getvideo -h|-?|--help

    getvideo

    getvideo url [url ...]

    getvideo -f|--file filename

The urls can be entered after calling getvideo - this is useful if urls contain shell metacharacters like &.

The urls can also be passed with a file: getvideo -f|--file filename. The urls in the file have to be space separated.

BACKWARD INCOMPATIBLE CHANGES

This changes were introduced with the version 0.200.

The name of the extractor directories may have changed (probably the first letter has changed from uppercase to lowercase).

The location of the configuration directory may have changed.

The names of the configuration files have changed.

The option "File timestamp" is now enabled by default.

The option Extractor directory is disabled by default.

DESCRIPTION

Download single videos or/and choose videos from playlists or/and channels.

When choosing from a channel or a playlist it is possible to filter the displayed video titles with a regexp. The filter can be inverted by adding !~ and a space in front of the regexp.

See "USAGE-AND-RETURN-VALUES" in Term::Choose how to select more items with the SpaceBar or Ctrl-SpaceBar.

Before the download the script shows some video info and lets you choose the video quality from the available qualities. It is possible to choose more than one video format with the SpaceBar key.

Instead of choosing the quality manually it is possible to set and use preferred qualities.

To set the different options call getvideo -h.

App::YTDL uses youtube-dl to get the data required for the video download. To list the supported extractors call getvideo -h and select the entry Extractors.

Auto merge

Downloaded files from the same video-id are tried to merge if

- the option Merge is enabled. See "Merge".

- ffmpeg and ffprobe are available.

- not more and not less than 2 files from the same video-id and the same extractor have been downloaded.

- one of these two files has only an audio stream.

- one of these two files has a video stream.

Legacy encodings

Non mappable characters in file names are replaced with &#xNNN; where NNN is the Unicode code point in a decimal number.

Options

HELP

Shows this HELP text.

INFO

Shows the path and the version of the running getvideo, the path of the video and configuration directories and the version of youtube-dl. If ffmpeg and ffprobe are available, their version is also shown.

Directory

Video directory

Choose an alternative main video directory.

Extractor directory

  • no

    Don't create/use extractor directories.

  • yes

    Create/use extractor directories.

Channel directory

  • no

    Don't create/use channel directories.

  • if from channel or playlist

    Create/use channel directories if the videos are chosen from a channel or a playlist.

  • always

    Always create/use channel directories.

File

Max filename length

Set the maximum length of the filename. Filenames longer as the maximum length are truncated.

Replace spaces

If enabled, spaces in filenames are replaced with underscores.

Sanitize filename

  • replace /

    Keep all apart from / and \0 .

  • replace / \ : " * ? < > |

    Replace each character matching the character class [\x{00}-\x{1F}"\/\\:*?<>|] with a hyphen.

File timestamp

Change the timestamps of the downloaded videos to the their upload date.

Quality

Auto quality mode

Set the auto quality mode:

  • manually

    Choose the video quality always manually

  • keep_channel_playlist

    Keep the first quality chosen for a video of a playlist/channel for all videos of that playlist/channel if possible.

  • keep_extractor

    Keep the first quality chosen for a video of an extractor for all videos of that extractor if possible.

  • preferred

    Use preferred qualities.

  • default

    Use the default (best) quality.

Preferred qualities

Prints the set preferred qualities.

How to set the preferred qualities:

Set the option auto quality mode to manually, keep_channel_playlist or keep_extractor. Then, when downloading a video, instead of selecting the desired video quality select the entry Menu and then the entry Preferred qualities.

Slots 'preferred qualities'

Set the number of the available preferred qualities slots.

If the preferred quality/qualities set in a slot (beginning at the first slot) is/are not available, the quality/qualities from the next set slot is/are used.

Download

UserAgent

Set the useragent string.

If entered nothing, the default useragent string (Mozilla/5.0) is used.

Overwrite

If enabled, getvideo overwrites existing files else getvideo appends to partially downloaded files.

Download retries

Set the number of download retries.

Timeout

Connection timeout in seconds.

Merge

Enable Merge

  • no

  • ask

  • yes

ffmpeg overwrites

If set to 'yes', ffmpeg overwrites an existing file when merging two files into one file else the user will be asked what to do.

Output formats

Choose the container format for the new file: mkv, mp4, ogg, webm or flv.

ffmpeg verbosity

  • error

    Show all errors.

  • warning

    Show all warnings and errors.

  • info

    Show informative messages during processing. This is in addition to warnings and errors.

Input files

  • keep

    Keep the merged input files.

  • move to "STREAM_FILES"

    Move the merged input files to the directory "STREAM_FILES". The directory "STREAM_FILES" is created (if it not already exits) in the directory where the input files were downloaded.

  • remove

    Remove the merged input files.

History

Logging

Enable info logging to a log file.

Channel history

If no arguments are passed to getvideo, the user can choose from the channels saved in the channel-history and the channel-sticky file.

Channel history sets the limit of the number of channels saved in the channel history file. Setting Channel history to 0 disables the channel history.

A channel can be made sticky. Channels made sticky don't count regarding the Channel history limit. If a channel is made sticky, it gets also a new timestamp.

When added to the channel history channels get the return value of time() as their timestamp. If the Channel history limit is reached, the channel with the oldest timestamp is removed first.

The supported extractors for the Channel history are YouTube and Vimeo.

History sort

Sort the channels from the history file

  • by name

  • by timestamp

Video List

List size

This option has no meaning if the extractor is not Youtube.

  • all

    Show (fetch info for) all videos of the channel/playlist.

  • latest 50

    If the channel/playlist has more than 50 videos, show (fetch info for) only the latest 50 videos of the channel/playlist.

Sort order

Sort the list-menu entries by

  • upload date

    If there is no upload date data for the list, the title is used instead to the sort the list.

  • title

  • view count

    If there is no view count data for the list, the upload date is used instead to the sort the list.

  • duration

Show view count

  • if sorted by view count

    Show the view count in the list-menu entries only when sorted by view count.

  • always

    Show the view count always.

Some extractors don't provide a view count.

Output

Unmappable characters

  • replace with *

    If replace with * is selected, unmappable characters are replaced with * before the output on the screen.

  • use Text::Unidecode

    unidecode() from Text::Unidecode tries to "translate" non ASCII data to ASCII characters. The output of unidecode() always consists entirely of US-ASCII characters.

Max info width

Set the maximum width of the video info output.

Digits for "k/s"

Set the number of digits allocated for the "kilobyte per seconds" template.

Extractors

List the extractors supported by youtube-dl.

REQUIREMENTS

Perl version

Requires Perl version 5.10.0 or greater.

youtube-dl

A recent version of youtube-dl is required.

ffmpeg and ffprobe

The merge feature requires ffmpeg and ffprobe.

Monospaced font

It is required a terminal that uses a monospaced font which supports the printed characters.

CREDITS

App::YTDL uses youtube-dl to get the data required for the video download.

Thanks to the Perl-Community.de and the people form stackoverflow for the help.

AUTHOR

Kuerbis <cuer2s@gmail.com>

LICENSE AND COPYRIGHT

Copyright (C) 2013-2015 Kuerbis.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For details, see the full text of the licenses in the file LICENSE.