-
Notifications
You must be signed in to change notification settings - Fork 1
/
later.pl
32 lines (26 loc) · 863 Bytes
/
later.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Add a command to add tweet to delicious for storage or later
# viewing from GUI browser
#
use URI::Escape;
$addaction = sub {
my $command = shift;
if ($command =~ m#^/later ([^ ]+) ?#) {
my $tweet_id=$1;
my $tweet=&get_tweet($tweet_id);
if (!$tweet->{'id_str'}) {
print $stdout "-- sorry, no such tweet (yet?).\n";
return 1;
}
chop( my $instapaper_user=`cat ~/.instapaper`);
my $add_url=uri_escape("http://twitter.com/$tweet->{'user'}->{'screen_name'}/statuses/$tweet->{'id_str'}");
my $instapaper_url="https://www.instapaper.com/api/add?username=$instapaper_user&url=" . $add_url;
my $content = `curl -s \"$instapaper_url\"`;
if ($content =~ m!201!){
print "Added to instapaper.com\n";
}else{
print "Something went wrong, not added. Response: $content";
}
return 1;
}
return 0;
};