X-Git-Url: http://lab.mitty.jp/git/?a=blobdiff_plain;f=Dev%2Ftwitter%2Fdump_timeline.pl;h=0564d5dadf240fc88e711cca71cc2b4ec7e91b38;hb=52c76fd42f32a43fdb145980161126a4e7503065;hp=deba425020a55e9f0ef604f85e1895a952cb37d5;hpb=294a3aa0a1afb56d06c211c969bca66aabcc360b;p=lab.git diff --git a/Dev/twitter/dump_timeline.pl b/Dev/twitter/dump_timeline.pl index deba425..0564d5d 100755 --- a/Dev/twitter/dump_timeline.pl +++ b/Dev/twitter/dump_timeline.pl @@ -18,7 +18,7 @@ use Encode; my $help = sub { die <user_timeline($param); } - elsif ($method eq 'retweeted_by_me') { + elsif ($method eq 'retweeted_by_me' || $method eq 'r') { $res = $bot->retweeted_by_me($param); } - elsif ($method eq 'mentions') { + elsif ($method eq 'mentions' || $method eq 'm') { $res = $bot->mentions($param); } + elsif ($method eq 'search' || $method eq 's') { + my $key; + foreach my $word (@{ $conf->{hashtag} }) { + if ($key) { + $key .= " OR $word"; + } + else { + $key = $word; + } + } + $param->{q} = $key; + $res = $bot->search($param)->{results}; + } else { warn "$0: unknown method '$method'"; &{$help}; @@ -84,9 +97,10 @@ eval { else { foreach my $status (@{$res}) { my $text = ""; + $text .= "(". $status->{id} . ") "; + $text .= $status->{user}{screen_name} . "|"; $text .= $status->{user}{name}; $text .= " [" . $status->{created_at} . "]"; - $text .= " (". $status->{id} . ")"; $text .= " ". $status->{text}; $text =~ s/\n//; print encode('utf8', $text), "\n";