Last active
August 29, 2015 14:23
-
-
Save Code-Hex/231b5f47ad15c6596c49 to your computer and use it in GitHub Desktop.
友達用
This file contains 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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Net::Twitter; | |
use URI::Escape; | |
my ($id, $latest_id); | |
my $twi = Net::Twitter->new({ | |
traits => ['API::RESTv1_1'], | |
consumer_key => '', | |
consumer_secret => '', | |
access_token => '', | |
access_token_secret => '', | |
ssl => 1 | |
}); | |
while (1) { | |
my $res = $twi->search({ | |
q => 'jinx', | |
result_type => 'recent' | |
}); | |
for (@{$res->{statuses}}){ | |
$id = $_->{id}; | |
last if $_->{text} =~ /jinx/; | |
} | |
$twi->create_favorite($id) unless $latest_id == $id; | |
$latest_id = $id; | |
sleep 10; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment