Hi, this is Iván Sánchez, and these are my miscellaneous and geolocation extensions for TTYtter, the amazing text-mode twitter client.
The where.pl and where-inline.pl extensions allow you to see other tweets' locations and do not have any requirements.
gpsd.pl, place.pl, teleport.pl and geoip.pl allow you set the location of your tweets. Your account needs to be geo-enabled, and you should set location=true in your .ttytterrc.
The deshortify.pl extension expands all those t.co URLs into actually useful, informative URLs.
| Geolocation for other people's tweets | Geolocation for your own tweets | Miscellaneous stuff |
|---|---|---|
| These will tell you where other people are tweeting from (geographically). | Add location metadata to your tweets. Or, said other way, tell other people where you're tweeting from (geographically). You need you account to be geo-enabled and run ttytter with location=1 for these to work. |
Useful non-geographical stuff. |
The where.pl extension adds a new command: /where. Use it to refer to a geo-located tweet (as in /where a1), and it will query OpenStreetMap's geocoding service and turn those ugly coordinates into a human-readable address, so you can actually have an idea about where the tweet was sent from.
b7> [2011-10-08 0:41:30] <+ajturner> must be in Texas - TSA signs reminding passengers to remove large jewelry for screening #beltbucklesnotguns
TTYtter> /where b7 <009
-- Sent at 32.8903961,-97.03627702, which is near Dfw, Grapevine, Tarrant County, Texas, 75261, United States of America
Hey, maybe you'd like this /where functionality to work automatically on new tweets. If that's the case, just use where-inline.pl in order to automagically call the reverse geocoder:
u5+ West Main Street, Madisonville, Madison, Texas, 77864, United States of America
u5> [2011-10-08 17:47:43] <+SeanGorman> @ajturner has gone full cowboy in honor of #ratdiver http://t.co/KPPCaYCX
However, it bugs me that the geo info is displayed before, not after the default handler, even if the sub call to the default handler is the first thing the overloaded handler does. Perl, thou art a harsh mistress.
But what if you want to send geo-located tweets by yourself? The /set lat and /set long commands are cumbersome... but if you got a working GPS receiver and GPSD, then the gpsd.pl extension takes care of that! As soon as GPSD's got a GPS fix, you won't have to type in coordinates ever again.
Alas, the gpsd.pl extension is not too stable at this moment. It makes use of the libnet-gpsd3-perl library, which seems to arbitrarily enter a race condition when trying to poll gpsd for no apparent reason. Be advised, and read the extension's comments.
TTYtter> Trying out gpsd support for ttytter <035
-- No GPS fix, not using geolocation.
-- waiting 3 seconds to tweet, ^C cancels: "Trying out gpsd support for ttytter"
^C
-- not sent, cancelled by user
TTYtter> Trying out ttytter+gpsd geolocation (again) <043
-- using lat/long: (40.7379316893733, -3.44560555824903)
-- waiting 3 seconds to tweet, ^C cancels: "Trying out ttytter+gpsd geolocation (again)"
-- sending to server
g0> [2011-10-08 14:10:47] <+RealIvanSanchez> Trying out ttytter+gpsd geolocation (again)
TTYtter> /dump g0 <008
user->screen_name RealIvanSanchez
retweeted_status->id_str
user->geo_enabled true
tag->type timeline
tag->payload
geo->coordinates (40.73793169, -3.44560556)
created_at Sat Oct 08 12:10:47 +0000 2011
id_str 122645109530558464
in_reply_to_status_id_str
menu_select g0
retweet_count 0
source TTYtter (RealIvanSanchez)
text Trying out ttytter+gpsd geolocation (again)
-- %URL% is now https://twitter.com/RealIvanSanchez/statuses/122645109530558464 (/short to shorten)
TTYtter> /where g0 <009
-- Sent at 40.73793169,-3.44560556, which is near El Coto, El Casar, Guadalajara, Castilla-La Mancha, Spain
But what if you don't have a GPS receiver lying around, yet want to issue some geo-located tweets? Then you'll need place.pl.
This allows you to issue a /place (name of the place you're at) command. Typical requests are /place City, country, or /place Street, city, country.
TTYtter> /place Rio de Janeiro, Brazil <029
-- Your next tweet will be sent at -22.9112163,-43.2093781, which is near Rio de Janeiro, Brasil, South America (a city)
TTYtter> Wish my tweets could have a sunbath (testing yet another @ttytter geolocation extension) <088
-- using lat/long: (-22.9112163, -43.2093781)
-- waiting 3 seconds to tweet, ^C cancels: "Wish my tweets could have a sunbath (testing yet another @ttytter geolocation extension)"
-- sending to server
c2+ Viaduto dos Fuzileiros, Praça da Bandeira, Rio de Janeiro, 20211-445, Brasil
c2> [2011-10-14 20:31:16] <+RealIvanSanchez> Wish my tweets could have a sunbath (testing yet another @ttytter geolocation extension)
Then you can use /place off to turn off geolocation of any tweets after that. It does the same as /set lat undef and then /set long undef, but it's faster to type and easier to remember.
This extension uses the OpenStreetMap's geocoding service (the same where.pl uses). The accuracy of your /place queries will depend on the quality of local OpenStreetMap data. You may (or may not) be able to query for a postcode, a neighborhood, or even a singular building:
TTYtter> /place Rio de Janeiro, Brazil <029
-- Your next tweet will be sent at -22.9112163,-43.2093781, which is near Rio de Janeiro, Brasil, South America (a city)
TTYtter> /place NG8 1, United Kingdom <029
-- Your next tweet will be sent at 52.950996099129,-1.19203191262383, which is near NG8 1, United Kingdom (a postcode)
TTYtter> /place Bronx, New York <022
-- Your next tweet will be sent at 40.8501002,-73.8662464, which is near Bronx, New York, United States of America (a hamlet)
TTYtter> /place Coors Field, Denver, Colorado <036
-- Your next tweet will be sent at 39.7561146965203,-104.994083810925, which is near Coors Field, Blake Street, Denver, Denver County, Colorado, 80205, United States of America (a stadium)
TTYtter> /place Statue of Liberty, Liberty Island <040
-- Your next tweet will be sent at 40.689245737137,-74.0445412130299, which is near Statue of Liberty, Hudson River Waterfront Walkway, Jersey City, Hudson County, New Jersey, 07302, United States of America (a attraction)
TTYtter> /place Hospital Clinico San Carlos, Madrid, Spain <049
-- Your next tweet will be sent at 40.4407617610234,-3.71992637213825, which is near Hospital Clínico San Carlos, Calle Profesor Martín Lagos, Chamberí, Moncloa-Aravaca, Madrid, 28008, Spain (a hospital)
TTYtter> /place Konig Frankfurter, Girona <032
-- Your next tweet will be sent at 41.9854809,2.8221996, which is near Konig Frankfurter, Gran Via de Jaume I, Girona, Generalitat de Catalunya, Catalunya, 17002, Spain (a restaurant)
TTYtter> /place off <010
-- Turning geolocation off
If this extension is unable to find a place, I suggest you go to OpenStreetMap, and repeat the search there. OpenStreetMap is an open-source, editable map of the world, so feel free to fix any errors and add missing places!
(Please also note that the example above uses the where-inline.pl extension too, that's why you can read the location of the tweets just above them.)
Thanks to TTYtter user @xurxosanz for the idea for this extension.
Maybe you want to tweet from the same place another person is tweeting from. Maybe you are at the same place as another user, or even at a event with lots of people and geo-located tweets around. Or maybe you'd wish to be there.
Hey, TTYtter cannot teleport you there, but it can teleport your tweets next to another person's tweets. And that's where teleport.pl comes into play. You will be able to issue a /teleport command to mimic another tweet's location:
d8+ Rua Miguel Couto, Centro, Rio de Janeiro, 20070-030, Brasil
d8> [2011-10-14 16:58:02] <+Nighto> http://t.co/4rqPEKEt OH YEAH
TTYtter> /teleport d8 <013
-- Your next tweet will be sent at -22.903032,-43.17926.
TTYtter> Beam me down to Brazil, Scotty! (testing another @ttytter geolocation extension) <080
-- using lat/long: (-22.903032, -43.17926)
-- waiting 3 seconds to tweet, ^C cancels: "Beam me down to Brazil, Scotty! (testing another @ttytter geolocation extension)"
-- sending to server
e1+ Rua Miguel Couto, Centro, Rio de Janeiro, 20070-030, Brasil
e1> [2011-10-14 19:48:34] <+RealIvanSanchez> Beam me down to Brazil, Scotty! (testing another @ttytter geolocation extension)
Please note that *all* your tweets from now on will be sent geo-located at those coordinates, unless you issue a /place off command (you'll need place.pl for that).
(Please also note that the example above uses the where-inline.pl extension too, that's why you can read the location of the tweets just above them.)
Thanks to TTYtter user @vehrka for the idea for this extension.
So you don't have a GPS, and you are lazy enough to not /place or /teleport your tweets. There is still hope for you.
Say hi to geoip.pl. This will fetch your public IP address from teh internets, and query a local GeoIP database to get an approximate pair of coordinates. You might need to do some minor fiddling to get Geo::IP working in Perl, so check the extension's comments.
TTYtter> Trying out #GeoIP extension for @ttytter <040
-- GeoIP extension will try to locate your public IP address now
-- GeoIP: 83.50.223.514 is near Valencia, Comunidad Valenciana, Spain
-- using lat/long: (39.4667, -0.3667)
-- waiting 3 seconds to tweet, ^C cancels: "Trying out #GeoIP extension for @ttytter"
-- sending to server
c2+ Císcar - Comte d'Altea, Calle de Císcar, Eixample, Valencia, València/Valencia, Comunitat Valenciana, 46006, Spain
c2> [2011-10-26 0:40:54] <+RealIvanSanchez> Trying out #GeoIP extension for @ttytter
See? It got my general location right, and put the tweet over the city centre. Don't expect accurate geolocation with this method. You might even end up in the wrong city if ISPs do a lazy job.
GeoIP location will only happen once, just before your first tweet. If coordinates are already set (e.g. GPSD got a fix, or you've run /place before your first tweet), GeoIP location will not happen. It is quite fair to assume that if coordinates are already set, they're better than the ones GeoIP can provide.
Yes, yes, I know. You're fed up with all those t.co URLs all over, and blindly clicking through them. If only TTYtter was able to resolve them...
Well, it can, silly. You just need deshortify.pl, and all of a sudden stuff like this:
v1> [2012-03-13 23:53:35] <RealIvanSanchez> Dear @ttytter users: Behold! The new and improved de-shortifier: http://t.co/Xgqqu9Ra (now with underlining!)
Will start looking like this:
v1> [2012-03-13 23:53:35] <RealIvanSanchez> Dear @ttytter users: Behold! The new and improved de-shortifier: http://ivan.sanchezortega.es/ttytter/deshortify.pl (now with underlining!)
It will use up more screen real state, but it's easier to read with those underlines.
It will also does some tricks to some URLs to make them shorter: resolves feedburner and google news URLs, and cuts off some extraneous tracking stuff from the end of URLs (those "utm_source=twitter" bits that don't do anything useful to you and just take up space).
So, the other day I read this:
zf5> [2012-03-28 20:24:20] <metazool> considering unfollowing anyone who utters the word 'license' over the next week and i mean anyone. Or is it 'licence'? Well, either, both
And I said to myself: "This calls for a ttytter extension!". Behold, autounfollow.pl!:
TTYtter> /follow nyancat <015
-- ok, you have started following user nyancat.
TTYtter> /friends +1 <011
nyan cat (nyancat) (f:4/203) (u:1)
TTYtter> /killword !!! <013
-- Auto-unfollow armed and ready.
-- Auto-unfollow killword active: !!!
TTYtter> /a nyancat <010
-- Found tweet from nyancat with killword: !!!
-- ok, you have stopped following user nyancat.
za0> [2011-12-17 22:35:34] (x12) <nyancat> lets nyan!!!
TTYtter> /friends +1 <011
Big Ben (big_ben_clock) (f:0/173677) (u:20302)
"Established November 2009. Entirely unofficial & apparently imitated e..."
What is going on in there? Well, I started following @nyancat, but then wanted to unfollow anyone who abuses exclamation signs. As it appears, @nyancat does, so the extension automatically unfollowed it when the tweet was loaded. And it's really unfollowed, because it doesn't appear among my list of followed users anymore.
In case you want to stop the unfollowing massacre, just specify no killwords, like:
TTYtter> /killword <009
-- Auto-unfollow is now disarmed.
Want more than one term? Eeeasy peasy:
TTYtter> /killword "Please RT" viagra "buy rolex" <040
-- Auto-unfollow armed and ready.
-- Auto-unfollow killword active: Please RT
-- Auto-unfollow killword active: viagra
-- Auto-unfollow killword active: buy rolex
This extension is a bit buggy still. Supposedly, it should save you from viewing the tweet that caused you to enter a mad rage and unfollow the user, but right now it doesn't. I'm returning 0 and not calling &defaulthandle, but still... Well, this shouldn't be a problem, 'cause you won't see that user in your timeline ever again!
q5> [2012-03-29 21:31:25] <@xurxosanz> @RealIvanSanchez auto-autounfollow based on trending topics #concepto #heytío //@metazool
s2> [2012-03-29 21:35:38] <RealIvanSanchez> Thinking about #hipstter, a @ttytter extension to unfollow anyone tweeting about any trending topic, thanks to @xurxosanz
s5> [2012-03-29 21:37:42] <@tjh> @RealIvanSanchez Please, please do it. PLEASE.
t3> [2012-03-29 21:42:33] <@pr4wn> @xurxosanz @RealIvanSanchez @ttytter Best keep quiet about my #bieber fixation, then. #hipstter
You asked for it, folks. Go get hipstter.pl before I fix the bugs and is outfashioned.
Right now, hipstter mostly works, but is not able to process trends with non-ascii-7 characters.
On a non-georelated note, consider using the libcaca utilities (apt-get install caca-utils on Debian-like systems) for displaying the avatar image (when doing /whois username), by adding this line to .ttytterrc:
avatar=wget -q %U -O /tmp/avatar && img2txt -f utf8 /tmp/avatar