vendor
Rev | Line | |
---|
[d200f4d] | 1 | #!/usr/bin/env perl |
---|
| 2 | use strict; |
---|
| 3 | use warnings; |
---|
| 4 | use utf8; |
---|
| 5 | use Net::Twitter; |
---|
| 6 | |
---|
| 7 | my $consumer_key = 'CONSUMER_KEY'; |
---|
| 8 | my $consumer_key_secret = 'CONSUMER_KEY_SECRET'; |
---|
| 9 | |
---|
| 10 | my $nt = Net::Twitter->new( |
---|
| 11 | traits => ['API::REST', 'OAuth'], |
---|
| 12 | consumer_key => $consumer_key, |
---|
| 13 | consumer_secret => $consumer_key_secret, |
---|
| 14 | ); |
---|
| 15 | print 'access this url by bot account : '.$nt->get_authorization_url."\n"; |
---|
| 16 | print 'input verifier PIN : '; |
---|
| 17 | my $verifier = <STDIN>; |
---|
| 18 | chomp $verifier; |
---|
| 19 | |
---|
| 20 | my $token = $nt->request_token; |
---|
| 21 | my $token_secret = $nt->request_token_secret; |
---|
| 22 | |
---|
| 23 | $nt->request_token($token); |
---|
| 24 | $nt->request_token_secret($token_secret); |
---|
| 25 | |
---|
| 26 | my($at, $ats) = $nt->request_access_token(verifier => $verifier); |
---|
| 27 | |
---|
| 28 | print "Access token : ".$at."\n"; |
---|
| 29 | print "Access token secret : ".$ats."\n"; |
---|
Note: See
TracBrowser
for help on using the repository browser.