GithubHelp home page GithubHelp logo

kiwiroy / p5-www-youtube-download Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xaicron/p5-www-youtube-download

0.0 1.0 0.0 315 KB

YouTube video download interface.

Home Page: http://blog.livedoor.jp/xaicron/

License: Other

Perl 38.64% HTML 61.20% Raku 0.16%

p5-www-youtube-download's Introduction

NAME

WWW::YouTube::Download - WWW::YouTube::Download - Very simple YouTube video download interface

Build Status

VERSION

version 0.63

SYNOPSIS

use WWW::YouTube::Download;

my $client = WWW::YouTube::Download->new;
$client->download($video_id);

my $video_url = $client->get_video_url($video_id);
my $title     = $client->get_title($video_id);     # maybe encoded utf8 string.
my $fmt       = $client->get_fmt($video_id);       # maybe highest quality.
my $suffix    = $client->get_suffix($video_id);    # maybe highest quality file suffix

DESCRIPTION

WWW::YouTube::Download is a library to download videos from YouTube. It relies entirely on scraping a video's webpage and does not use YT's /get_video_info URL space.

METHODS

  • new()

      $client = WWW::YouTube::Download->new;
    

    Creates a WWW::YouTube::Download instance.

  • download($video_id [, \%args])

      $client->download($video_id);
      $client->download($video_id, {
          fmt      => 37,
          filename => 'sample.mp4', # save file name
      });
      $client->download($video_id, {
          filename => '{title}.{suffix}', # maybe `video_title.mp4`
      });
      $client->download($video_id, {
          cb => \&callback,
      });
    

    Download the video file. The first parameter is passed to YouTube video url.

    Allowed arguments:

    • cb

      Set a callback subroutine, SEE LWP::UserAgent ':content_cb' for details.

    • filename

      Set the filename, possibly using placeholders to be filled with information gathered about the video.

      filename supported format placeholders:

        {video_id}
        {title}
        {user}
        {fmt}
        {suffix}
        {resolution}
      

      Output filename is set to {video_id}.{suffix} by default.

    • file_name

      DEPRECATED alternative for filename.

    • fmt

      set the format to download. Defaults to the best video quality (inferred by the available resolutions).

  • playback_url($video_id, [, \%args])

      $client->playback_url($video_id);
      $client->playback_url($video_id, { fmt => 37 });
    

    Return playback URL of the video. This is direct link to the movie file. Function supports only "fmt" option.

  • prepare_download($video_id)

    Gather data about the video. A hash reference is returned, with the following keys:

    • fmt

      the default, suggested format. It is inferred by selecting the alternative with the highest resolution.

    • fmt_list

      the list of available formats, as an array reference.

    • suffix

      the filename extension associated to the default format (see fmt above).

    • title

      the title of the video

    • user

      the YouTube user owning the video

    • video_id

      the video identifier

    • video_url

      the URL of the video associated to the default format (see fmt above).

    • video_url_map

      an hash reference containing details about all available formats.

    The video_url_map has one key/value pair for each available format, where the key is the format identifier (can be used as fmt parameter for "download", for example) and the value is a hash reference with the following data:

    • fmt

      the format specifier, that can be passed to "download"

    • resolution

      the resolution as width_x_height

    • suffix

      the suffix, providing a hint about the video format (e.g. webm, flv, ...)

    • url

      the URL where the video can be found

  • ua([$ua])

      $self->ua->agent();
      $self->ua($LWP_LIKE_OBJECT);
    

    Sets and gets LWP::UserAgent object.

  • video_id($url)

    Parses given URL and returns video ID.

  • playlist_id($url)

    Parses given URL and returns playlist ID.

  • user_id($url)

    Parses given URL and returns YouTube username.

  • get_video_id($video_id)

  • get_video_url($video_id)

  • get_title($video_id)

  • get_user($video_id)

  • get_fmt($video_id)

  • get_fmt_list($video_id)

  • get_suffix($video_id)

CONTRIBUTORS

yusukebe

BUG REPORTING

Please use github issues: https://github.com/xaicron/p5-www-youtube-download/issues.

SEE ALSO

WWW::YouTube::Info and WWW::YouTube::Info::Simple. WWW::NicoVideo::Download http://rg3.github.io/youtube-dl/

AUTHOR

xaicron <xaicron {@} cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Yuji Shimada.

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

p5-www-youtube-download's People

Contributors

xaicron avatar oalders avatar kucharskim avatar isync avatar polettix avatar tsibley avatar syaltut avatar chorny avatar grinnz avatar mokko avatar manwar avatar neilb avatar pauloscustodio avatar kiwiroy avatar takaki avatar yusukebe avatar gregoa avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.