[33160] in Perl-Users-Digest
Perl-Users Digest, Issue: 4439 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 26 21:09:19 2015
Date: Tue, 26 May 2015 18:09:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 26 May 2015 Volume: 11 Number: 4439
Today's topics:
Re: Why proxy the YouTube data in the following code. <*@eli.users.panix.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 26 May 2015 23:32:06 +0000 (UTC)
From: Eli the Bearded <*@eli.users.panix.com>
Subject: Re: Why proxy the YouTube data in the following code.
Message-Id: <eli$1505261918@qz.little-neck.ny.us>
In comp.lang.perl.misc, Chad <cdalten@gmail.com> wrote:
> http://www.jwz.org/hacks/youtubedown
While that's better than no code at all, the subject line did promise me
code.
> near the bottom of the code in the do_cgi() function he says
> #Proxy the data, so that we can feed it to a non-browser agent.
> The question is why proxy the data? Ie, why not access the data directly?
Here's the block from the copy I have lying around (probably a year or
two old):
if ($redir || $proxy) {
error ("can't specify both url and redir") if ($redir && $url);
error ("can't specify both url and proxy") if ($proxy && $url);
error ("can't specify both redir and proxy") if ($proxy && $redir);
my $name = $ENV{PATH_INFO} || '';
$name =~ s@^/@@s;
$name = ($redir || $proxy) unless $name;
$name =~ s@\"@%22@gs;
if ($redir) {
# Return a redirect to the underlying video URL.
print STDOUT ("Content-Type: text/html\n" .
"Location: $redir\n" .
"Content-Disposition: attachment; filename=\"$name\"\n" .
"\n" .
"<A HREF=\"$redir\">$name</A>\n" .
"\n");
} else {
# Proxy the data, so that we can feed it a non-browser user agent.
print STDOUT "Content-Disposition: attachment; filename=\"$name\"\n";
binmode (STDOUT);
get_url ($proxy, undef, undef, 0, '-');
}
What this block is doing is: if you have requested "redir" it redirects
your browser to the video file, with headers set up to force a download.
And if you have set up to "proxy" it first downloads the file and then
sends it with headers set up to force a download.
Both of these events only happen if you are running youtubedown as a
CGI, which I believe JWZ does for his personal use. The reason to proxy
the data is quite likely due to forcing data to come through a
particular channel, such as private https server instead of from the
open internet, which may help evade a content filter or a youtube
regional restriction on a file.
I know a guy in Germany who downloads youtube videos from a server in
New York to get around things (typically music) that are not licensed
for viewing in Germany.
Elijah
------
has only used youtubedown as a command line tool
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 4439
***************************************