The Myth of the Muttering Madman is a project in self-realization.

Tuesday, September 29, 2009

Free Your Twitter

A very quick and dirty Perl script to export your Twitter. No need to critique the script, I know it can be improved :)


$ cat free_your_twitter.pl
#!/usr/bin/perl -w

use Modern::Perl;
use Net::Twitter;
use YAML qw(Dump);
use Carp qw(croak);


my $t = Net::Twitter->new(username => 'snarkyboojum',
password => 'yourpassword');

my @export_msgs;

for my $i (1..80) {
my $msgs = $t->user_timeline( {page => $i, count => 200} );
push @export_msgs, @$msgs;

last if (scalar @$msgs < 200);
}

open my $fh, '>', 'twitter_dump.yml'
or croak "Can't open file for twitter dump: [$!]\n";

print $fh Dump(@export_msgs);

close $fh;

No comments:

about me