Changeset f1b126a in lab.git for Dev/twitter
- Timestamp:
- Dec 19, 2010 12:00:37 AM (14 years ago)
- Branches:
- master, trunk
- Children:
- fe75883
- Parents:
- a7e2c53
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/twitter/dump_timeline.pl
ra7e2c53 rf1b126a 16 16 use Encode; 17 17 18 if (@ARGV < 1) { 19 die "usage: $0 screen_name [number_of_pages|all [dump]]\n"; 18 if ($ARGV[0] && ($ARGV[0] eq '--help' || $ARGV[0] eq '-h') ) { 19 die <<EOM; 20 usage: $0 21 [user_timeline(default)|retweeted_by_me|mentions 22 [screen_name 23 [number_of_pages|all 24 [dump] 25 ] 26 ] 27 ] 28 EOM 20 29 } 21 my $screen_name = $ARGV[0]; 22 my $pages = $ARGV[1] || 1; 30 my $method = $ARGV[0] || 'user_timeline'; 31 my $screen_name = $ARGV[1] || ''; 32 my $pages = $ARGV[2] || 1; 23 33 if ($pages eq 'all') { 24 34 $pages = -1; 25 35 } 26 my $dump = $ARGV[ 2] || 0;36 my $dump = $ARGV[3] || 0; 27 37 28 38 my $conf = loadconf("$Bin/config.yml"); … … 41 51 while ($pages - $page && $page <= 160) { 42 52 $page++; 43 my $res = $bot->user_timeline( 44 { 45 screen_name => $screen_name, 46 page => $page, 47 } 48 ); 53 54 my $param = ($screen_name) 55 ? { page => $page, screen_name => $screen_name, } 56 : { page => $page, } 57 ; 58 59 my $res; 60 if ($method eq 'user_timeline') { 61 $res = $bot->user_timeline($param); 62 } 63 elsif ($method eq 'retweeted_by_me') { 64 $res = $bot->retweeted_by_me($param); 65 } 66 elsif ($method eq 'mentions') { 67 $res = $bot->mentions($param); 68 } 69 else { 70 die "$0: unknown method => $method\n"; 71 } 49 72 50 73 if ($dump) {
Note: See TracChangeset
for help on using the changeset viewer.