Skip to content

Instantly share code, notes, and snippets.

@Code-Hex
Last active August 29, 2015 14:23
Show Gist options
  • Save Code-Hex/231b5f47ad15c6596c49 to your computer and use it in GitHub Desktop.
Save Code-Hex/231b5f47ad15c6596c49 to your computer and use it in GitHub Desktop.
友達用
#!/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