Created
February 12, 2012 14:45
-
-
Save toritori0318/1808882 to your computer and use it in GitHub Desktop.
Net::Twitter::Liteでリツイート削除
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| use Net::Twitter::Lite; | |
| my($consumer_key, $consumer_secret) = qw/ | |
| vvvvvvvvvvvvvvvvvvvvvv | |
| wwwwwwwwwwwwwwwwwwwwww | |
| /; | |
| my $nt = Net::Twitter::Lite->new( | |
| consumer_key => $consumer_key, | |
| consumer_secret => $consumer_secret, | |
| ); | |
| my($access_token, $access_token_secret) = qw/ | |
| xxxxxxxxxxxxxxxxxxxxxx | |
| yyyyyyyyyyyyyyyyyyyyyy | |
| /; | |
| if ($access_token && $access_token_secret) { | |
| $nt->access_token($access_token); | |
| $nt->access_token_secret($access_token_secret); | |
| } | |
| # 元のツイートID | |
| my $org_id=11111111111111111111; | |
| # リツイートIDを取得 | |
| my $retweet_id; | |
| eval { | |
| my $statuses = $nt->retweeted_by_me(); | |
| for my $status ( @$statuses ) { | |
| if($org_id == $status->{retweeted_status}->{id}) { | |
| $retweet_id = $status->{id}; | |
| last; | |
| } | |
| } | |
| }; | |
| warn "$@\n" if $@; | |
| # リツイートを削除するには destory を発行 | |
| eval { | |
| $nt->destroy_status($retweet_id); | |
| }; | |
| warn "$@\n" if $@; | |
| print "org_id:$org_id\n"; | |
| print "retweet_id:$retweet_id\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment