Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Is it legal to use WWW::YouTube::Download ?

by Anonymous Monk
on Jan 05, 2020 at 19:31 UTC ( [id://11110999]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am in doubt. I assumed that the use of a CPAN module is legal by definition.

I used WWW::YouTube::Download to ...uh ... download some learning videos. The script is just a modified copy from synopsis and pod, nothing interesting.

Now I get the error "Cannot find the link to video", whichever id I use. Since the ids are definitely existing I assume that I am being blocked.

So the question is - whether it is legal to use the module?

  • Comment on Is it legal to use WWW::YouTube::Download ?

Replies are listed 'Best First'.
Re: Is it legal to use WWW::YouTube::Download ?
by Corion (Patriarch) on Jan 05, 2020 at 19:38 UTC

    Whether it's legal to use the module doesn't come into play at all.

    Maybe Youtube just blacklisted your computer from downloading any more data.

    Consider trying other methods (browser, youtube-dl) to check whether it is your internet connection that is blocked or just your script.

      Thank you! Watching in browser works. Since the POD says "It relies entirely on scraping a video's webpage and does not use YT's /get_video_info URL space." I wonder whether it is possible to block just the script?

Re: Is it legal to use WWW::YouTube::Download ?
by CountZero (Bishop) on Jan 05, 2020 at 22:00 UTC
    YouTube has under "Permissions and Restrictions:

    You are not allowed to:

    (...)

    3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

    So indeed, a "scraper" seems in violation of YouTube's terms and conditions.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics

      I wonder if "un-automating" the scrapper by introducing a tiny user-interaction (as tiny as clicking on a link in a browser or even tinier) can technically remove author's tool from robots and scrappers category.

        I'm quite sure that does not save your skin as it is an obvious "trick" to circumvent that clause in the Terms and Conditions.

        That little "click" is nothing different than starting your scraping tool. Whether you do that at the begining of your scraping session, or again and again on each page makes no difference. A scraper remains a scraper and that kind of tool is explicitly forbidden.

        It might be different if, after manually clicking on a YouTube link, the data streamed to you somehow ends up on our hard-disk where - surpise surprise - you happen to find it later. Of course, there will be issues of copyright law and such, but that is a whole other can of worms.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        My blog: Imperial Deltronics
Re: Is it legal to use WWW::YouTube::Download ?
by haukex (Archbishop) on Jan 05, 2020 at 19:36 UTC

    Asking us programmers to answer legal questions? I think you're better off asking in a legal advice forum ;-) Also: YouTube Terms of Service (which may even be different in different countries, I think?)

      Thank you! I just wanted an answer I could understand ;-)

Re: Is it legal to use WWW::YouTube::Download ?
by stevieb (Canon) on Jan 05, 2020 at 19:35 UTC

    There's nothing legally preventing you from using the module, but Youtube's policies may and probably do restrict automation on their site, and likely with downloading of videos directly as well.

    You'll have to read their terms and policies to find out what they allow and what they don't.

Re: Is it legal to use WWW::YouTube::Download ?
by ikegami (Patriarch) on Jan 06, 2020 at 09:33 UTC

    Downloading a file from the internet is not inherently illegal. After all, you need to download the video in order to watch it. (It could be illegal for the server to send it to you, but that's a different issue.)

    What could be considered illegal is storing it on disk. This could be considered making a copy, one of the exclusive Copyright rights.

    Furthermore, just accessing the site with your tool could be considered a breach of contract, the contract being the site's terms of service. That's not illegal, but a company might be able to seek legal remedies in civil proceedings.

    Finally, since YouTube isn't a government actor, it's free to block your access to the site for pretty much whatever reasons it deems relevant. (A notable exception is blocking based on a protected class such as race.)

Re: Is it legal to use WWW::YouTube::Download ?
by bliako (Abbot) on Jan 07, 2020 at 12:02 UTC

    The server has some rules-of-thumb to identify whether a client is a robot. The most common is the agent string: the client's version, make, OS etc. Just point your browser to any public service which tells you what your ip and agent string are to see what I mean.

    Looking at the source of WWW::YouTube::Download I can see this:

    sub new { my $class = shift; my %args = @_; $args{ua} = LWP::UserAgent->new( agent => __PACKAGE__.'/'.$VERSION, parse_head => 0, ) unless exists $args{ua}; bless \%args, $class; }

    Which basically creates a LWP::UserAgent object with default id (agent): the package and version, e.g. WWW::YouTube::Download/0.62 - something which YT has blacklisted ages ago. There is a workaround because the constructor allows caller to supply his own UserAgent object. (introducing flexibilities like these is why TIMTOWTDI is synonymous to Perl)

    This will get you the videos so that you can continue your education:

    my $ua = new LWP::UserAgent; $ua->agent('wolf-dressed-as-lamb/666'); my $dl = WWW::YouTube::Download->new('ua' => $ua);

    Of course you need to resolve the 2 substantial points raised already: 1) Re: Is it legal to use WWW::YouTube::Download ? and 2) Re: Is it legal to use WWW::YouTube::Download ?

    bw, bliako

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11110999]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-12-12 17:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (65 votes). Check out past polls.