NAME

App::YoutubeDlIf - Download videos using youtube-dl with extra selection/filtering

VERSION

This document describes version 0.004 of App::YoutubeDlIf (from Perl distribution App-YoutubeDlIf), released on 2020-08-26.

DESCRIPTION

FUNCTIONS

youtube_dl_if

Usage:

youtube_dl_if(%args) -> [status, msg, payload, meta]

Download videos using youtube-dl with extra selection/filtering.

This is a wrapper for youtube-dl.

This function is not exported.

Arguments ('*' denotes required arguments):

  • if_duration_not_longer_than => str

  • if_duration_not_shorter_than => str

  • if_not_yet => bool

    If set, only download videos that are not yet downloaded.

    When set to true, youtube-dl-if will first extract downloaded video ID's from filenames or URL's or video ID's listed in a text file (specified via --log-file), e.g.:

    35682594        Table Tennis Shots- If Were Not Filmed, Nobody Would Believe [HD]-dUjxqFbWzQo.mp4       date:[2019-12-29 ]

    or:

    https://www.youtube.com/embed/U9v2S49sHeQ?rel=0

    or:

    U9v2S49sHeQ

    When a video ID in the argument is found then it is assumed to be already downloaded in the past and will not be downloaded again.

    Limitations: youtube ID is currently only looked up in arguments, so if you download a playlist, the items in the playlist are not checked against the ID's in the log file. Another limitation is that you currently have to maintain the log file yourself, e.g. by using 'ls -l >> ~/download-logs.org' everytime you finish downloading files.

  • log_file => str (default: "/home/u1/notes/download-logs.org")

    File that contains list of download filenames.

  • restart_if_no_output_after => duration

  • urls_or_ids* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

youtube_dl_if_not_yet

Usage:

youtube_dl_if_not_yet(%args) -> [status, msg, payload, meta]

Download videos using youtube-dl if not already downloaded.

This is a shortcut for:

% youtube-dl-if --if-not-yet ...

This function is not exported.

Arguments ('*' denotes required arguments):

  • if_duration_not_longer_than => str

  • if_duration_not_shorter_than => str

  • log_file => str (default: "/home/u1/notes/download-logs.org")

    File that contains list of download filenames.

  • restart_if_no_output_after => duration

  • urls_or_ids* => array[str]

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-YoutubeDlIf.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-YoutubeDlIf.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-YoutubeDlIf

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

App::YouTubeUtils for other YouTube-related CLIs.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.