How to Grab Media off the Internet

Posted by Prolific Programmer Mon, 26 Nov 2007 08:20:00 GMT

You're familiar with the streaming media, right? It's the same as a download. Indeed, one can actually capture the stuff in its native format. After the flip, I've included perl code to do just that! For those too lazy to cut and paste, it's at the usual place as well.

use LWP::Simple;
use HTML::TreeBuilder;
use File::Temp;
foreach my $page (@ARGV) {
    my $pagedata = get $page;
    my $tree = HTML::TreeBuilder->new;
    $tree->parse($pagedata);
    $tree->eof;
    my @base = $tree->find('base');
    my $base_url = '';
    $base_url = $base[0]->{'href'} if @base;
    my @embeds = $tree->find('embed');
    foreach my $embed (@embeds) {
        my $target = $embed->{'src'};
        my $newurl = "$base_url$target";
        my @newurl_parts = split (/\//);
        my $filename = $newurl_parts[-1];
        my ($fh, $fname) = tempfile("$filename");
        print $fh get $newurl;
        close $fh;
        print STDERR "$filename saved as $fname";
    }
    $tree->delete;
}

How to Remember Your Passwords

Posted by Prolific Programmer Wed, 21 Nov 2007 21:08:00 GMT

Only if you use Firefox (if you don't get it!), but you can reveal the passwords for a certain website by typing the following javascript snippet into your addressbar.