View Source:
CommandLineTwitter
Note:
This page has been locked and cannot be edited.
!!Command Line Twitter My notes on setting up the command line twitter client [ttytter|http://www.floodgap.com/software/ttytter/] on my Mac. Install the ttytter readline module with <verbatim> $ sudo cpan Term::ReadLine::TTYtter </verbatim> This gives you a readline which counts total characters per line (VERY IMPORTANT). my <code>~~/.ttytterrc</code>: <verbatim> ansi=1 verify=1 track='#sysadmin' readline=1 vcheck=1 mentions=1 urlopen=open %U avatar=open %U backload=40 simplestart=1 ssl=1 newline=1 exts=/Users/barney/.ttytter/instapaper.pl extpref_instapaper_username=barney@example.com extpref_instapaper_password=badpass </verbatim> <verbatim> mkdir ~/.ttytter </verbatim> Put instapaper.pl in the <code>~~/.ttytter</code> directory: <verbatim> #instapaper.pl Extension code by @augmentedfourth http://www.twitter.com/augmentedfourth # Add a command (/later) to add tweet to Instapaper #Released under the WTFPL: http://en.wikipedia.org/wiki/WTFPL $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; } #modified to use .ttytterrc by @stormdragon2976 http://www.twitter.com/stormdragon2976 if ((!defined($extpref_instapaper_username)) || (!defined($extpref_instapaper_password))) { print $streamout ("Instapaper information not found. "); print $streamout ("Please add extpref_instapaper_username and extpref_instapaper_password "); print $streamout ("to your .ttytterrc.\n"); return 1; } my $ip_user = $extpref_instapaper_username; my $ip_pass = $extpref_instapaper_password; my $add_url="twitter.com/$tweet->{'user'}->{'screen_name'}/statuses/$tweet->{'id'}"; my $ip_url="https://www.instapaper.com/api/add?url=" . $add_url . "&username=" . $ip_user . "&password=" . $ip_pass . "&auto-title=1"; my $content = `curl -s \"$ip_url\"`; if ($content =~ /201/){ print "Added to Instapaper!\n"; }else{ print "Something went wrong, not added. Error code: "; print "$content\n"; } return 1; } return 0; }; </verbatim> !! To Do I really want to rewrite the instapaper extension as an exercise to make it all perl (and try using ~LWP::~Simple). It would also be nice if the extension printed a 'trying to add to instapaper ... success!' sort of message instead of just waiting until success or failure to complete (although the asynchronous nature of ttytter may make that difficult). I also really want to see if I can write an extension to use the bit.ly api to shorten urls instead of using is.gd. Another fun idea: an extension that creates github gists from tweets or something along those lines. CategoryGeekStuff CategoryBlog
Please enable JavaScript to view the
comments powered by Disqus.
HollenbackDotNet
Home Page
Popular Pages
All Categories
Main Categories
General Interest
Geek Stuff
DevOps
Linux Stuff
Pictures
Search
Toolbox
RecentChanges
RecentNewPages
What links here
Printable version
AllPages
RecentChanges
Recent Changes Cached
No changes found
Favorite Categories
ActionPage
(150)
WikiPlugin
(149)
GeekStuff
(137)
PhpWikiAdministration
(102)
Help/PageList
(75)
Help/MagicPhpWikiURLs
(75)
Blog
(69)
Pictures
(60)
GeneralInterest
(44)
LinuxStuff
(38)
Views
View Page
View Source
History
Diff
Sign In