* add legacy_lists_api => 0 to new()
[lab.git] / Dev / twitter / dump_timeline.pl
index 0564d5d..d7b2058 100755 (executable)
@@ -98,8 +98,11 @@ eval {
             foreach my $status (@{$res}) {
                 my $text = "";
                 $text .= "(". $status->{id} . ") ";
-                $text .= $status->{user}{screen_name} . "|";
-                $text .= $status->{user}{name};
+                $text .= ($status->{user}{screen_name}) ?
+                    $status->{user}{screen_name} : $status->{from_user};
+                $text .= "|";
+                $text .= ($status->{user}{name}) ?
+                    $status->{user}{name} : $status->{from_user_name};
                 $text .= " [" . $status->{created_at} . "]";
                 $text .= " ".  $status->{text};
                 $text =~ s/\n//;
@@ -139,6 +142,7 @@ sub login {
     my $bot = Net::Twitter::Lite->new(
         consumer_key    => $conf->{consumer_key},
         consumer_secret => $conf->{consumer_secret},
+        legacy_lists_api => 0,
     );
     
     $bot->access_token($conf->{access_token});