Skip to content

Instantly share code, notes, and snippets.

@beppu
Created April 23, 2011 11:51

Revisions

  1. John Beppu revised this gist Apr 24, 2011. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions video.google.com-download
    Original file line number Diff line number Diff line change
    @@ -8,10 +8,13 @@ use URI::Escape;

    while(<>) {
    my ($url, $title) = split(/\|/);
    next unless $url;
    $url =~ s/\s*$//;
    $url =~ s/^\s*//;
    $title =~ s/\s*$//;
    $title =~ s/^\s*//;
    if ($title) {
    $title =~ s/\s*$//;
    $title =~ s/^\s*//;
    }
    my $id;
    my $uri = URI->new($url);
    my $html = get($url);
  2. John Beppu revised this gist Apr 24, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion video.google.com-download
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #!perl
    #!/usr/bin/env perl
    use strict;
    use warnings;
    use LWP::Simple;
  3. John Beppu revised this gist Apr 24, 2011. 1 changed file with 5 additions and 14 deletions.
    19 changes: 5 additions & 14 deletions video.google.com-download
    100644 → 100755
    Original file line number Diff line number Diff line change
    @@ -1,34 +1,25 @@
    #!perl
    use strict;
    use warnings;
    use Data::Dump 'pp';
    use LWP::Simple;
    use URI;
    use URI::QueryParam;
    use URI::Escape;
    use Tie::Storable;
    use Storable;

    tie my %record => 'Tie::Storable', 'record.po';
    while(<>) {
    my ($url, $title) = split(/\|/);
    $url =~ s/\s*$//;
    $url =~ s/^\s*//;
    $url =~ s/\s*$//;
    $url =~ s/^\s*//;
    $title =~ s/\s*$//;
    $title =~ s/^\s*//;
    my $id;
    my $uri = URI->new($url);
    my $uri = URI->new($url);
    my $html = get($url);
    $html =~ m{videoUrl\\x3d(http.*?)\\x};
    my $video_url = URI->new(uri_unescape($1));
    $id = $video_url->query_param('id');
    $title = $id unless ($title);
    print $title, " => ", $video_url, "\n";
    my $rc;
    my $status = $record{$id}{status};
    if ($status && $status != 200) {
    $rc = getstore($video_url, "$title.flv");
    $record{$id} = { title => $title, status => $rc };
    store \%record, 'record.po';
    }
    my $rc = getstore($video_url, "$title.flv");
    print "$rc\n";
    }
  4. John Beppu created this gist Apr 23, 2011.
    34 changes: 34 additions & 0 deletions video.google.com-download
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    #!perl
    use strict;
    use warnings;
    use Data::Dump 'pp';
    use LWP::Simple;
    use URI;
    use URI::QueryParam;
    use URI::Escape;
    use Tie::Storable;
    use Storable;

    tie my %record => 'Tie::Storable', 'record.po';
    while(<>) {
    my ($url, $title) = split(/\|/);
    $url =~ s/\s*$//;
    $url =~ s/^\s*//;
    $title =~ s/\s*$//;
    $title =~ s/^\s*//;
    my $id;
    my $uri = URI->new($url);
    my $html = get($url);
    $html =~ m{videoUrl\\x3d(http.*?)\\x};
    my $video_url = URI->new(uri_unescape($1));
    $id = $video_url->query_param('id');
    $title = $id unless ($title);
    print $title, " => ", $video_url, "\n";
    my $rc;
    my $status = $record{$id}{status};
    if ($status && $status != 200) {
    $rc = getstore($video_url, "$title.flv");
    $record{$id} = { title => $title, status => $rc };
    store \%record, 'record.po';
    }
    }