Skip to content

Instantly share code, notes, and snippets.

@maxaf
Created February 4, 2010 19:08
Show Gist options
  • Save maxaf/294989 to your computer and use it in GitHub Desktop.
Save maxaf/294989 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
# -*- cperl -*-
use strict;
use HTTP::Proxy qw/:log/;
use Time::HiRes qw/time/;
use HTTP::Proxy::BodyFilter::save;
use File::Path qw/mkpath/;
my $dir = shift @ARGV || die "usage: $0 /path/to/music/dump";
$dir =~ s/\/+$//;
mkpath $dir;
my $proxy = HTTP::Proxy->new(host => '127.0.0.1', port => 3845);
$proxy->logmask(STATUS);
$proxy
->push_filter(
mime => 'audio/x-mpeg',
path => qr!/contentfs/content!,
response => HTTP::Proxy::BodyFilter::save
->new(filename => sub { return "${dir}/" . time() . ".mp3"; }));
$proxy->start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment