diff options
Diffstat (limited to 'bucky2/rest/dropsy.pl')
| -rwxr-xr-x | bucky2/rest/dropsy.pl | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/bucky2/rest/dropsy.pl b/bucky2/rest/dropsy.pl new file mode 100755 index 0000000..c986abe --- /dev/null +++ b/bucky2/rest/dropsy.pl @@ -0,0 +1,56 @@ +#!/usr/bin/perl +use lib "../lib"; +use Rest::Topsy; +use Rest::Dailyrotten; +my $topsy = new Rest::Topsy; +my $dr = new Rest::Dailyrotten; +$topsy->url('http://twitter.com/dailyrotten'); +my $entries = $topsy->topsy_load; +my $stories = $dr->dailyrotten_load; + +my $topsy_map = {}; +map { $topsy_map->{$_->{'description'}} = $_->{'total'} } @$entries; + +my $dr_topsy_match = []; +foreach my $day (@$stories) + { + my $is_ffa = 1; + foreach my $story (reverse @{ $day->{'post'} }) + { + my $title = $story->{'title'}; + my $rec = + { + date => nice_date($day->{'file'}), + title => $title, + forum => $story->{'comments'}, + ffa => $is_ffa, + }; + $is_ffa = 0; + if (exists($topsy_map->{$title})) + { + $rec->{'topsy'} = $topsy_map->{$title}, + } + push @$dr_topsy_match, $rec; + } + } + +# foreach my $p (sort { $b->{'date'} cmp $a->{'date'} } @$dr_topsy_match) +# foreach my $p (sort { $b->{'topsy'} <=> $a->{'topsy'} } @$dr_topsy_match) + foreach my $p (sort { $b->{'forum'} <=> $a->{'forum'} } @$dr_topsy_match) + { + #next if $p->{'ffa'}; + if ($p->{'ffa'}) { $p->{'forum'} .= "*"; } + print + $p->{'date'} . "\t" . + $p->{'forum'} . "\t" . + $p->{'topsy'} . "\t" . + $p->{'title'} . "\n"; + } + +sub nice_date + { + my ($date) = @_; + $date =~ s/^_//; + $date =~ s/\.html$//; + return $date; + } |
