|
|||||||
| General Banter All off-topic chitty chat |
| View Poll Results: Do you use Twitter? | |||
| Yes |
|
5 | 26.32% |
| No |
|
11 | 57.89% |
| What's Twitter? (read on) |
|
3 | 15.79% |
| Voters: 19. You may not vote on this poll | |||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
| 03-22-2007 | #31 (permalink) |
|
Concierge
|
So getting rather annoyed with Twitterific and Twitter Post not working, I decided to dive into messing with the Twitter API via Terminal to see if I couldn't bypass the apps. For simply posting to Twitter via the command line:
$curl -u username:password --form status="Message text here." http://twitter.com/statuses/update.xml And voila, your message is posted. Although it takes a while because Twitter's server sucks and can't handle the traffic of its popularity. As for reading posts, I am still trying to get that correct, but I don't know enough programming to write a good script to output exactly what I would like, so at current I am running the following in GeekTool and having it post on my desktop, refreshing every minute (or at least a minute after the two or three minutes it takes to fetch the data from Twitter's crappy server). So here is the code: $curl -u username:password http://twitter.com/statuses/friends_timeline.xml|grep "<text>\|<relative_created_at>\|<name>" The possible fields you can choose to display are: <created_at> standard time stamp instead of relative that I am using <screen_name> screen name instead of full name that I am using <location> user's location <description> user's description of self <profile_image_url> the profile image, good if you were going to use this to write an actual app, useless for the command line <url> user's homepage Additionally, you can check 3 other lists rather than the Friends and You timeline: http://twitter.com/statuses/public_timeline.xml http://twitter.com/statuses/friends.xml http://twitter.com/statuses/followers.xml The first is obviously the public timeline, the second and third show a list of each of your friends (or followers) and their last post with the same tags as the timelines. If you have growlnotify installed, you could then pipe whatever feed into a growl notification, but you would want to modify your grep to grab the first instance or the first two, rather than spitting out your whole list (-m3 after grep to tell it to print three lines). Anyhow, I am trying to clean this up so that I can get a solid output, though after a few minutes the tags just disappear to my eyes. although if you are running this in Terminal, rather than GeekTool, you can add --color=always between grep and the patterns and the tags will show up bold and red, making it easy to look past them. Hopefully there will be other feedback on cleaning this up and simplifying it. Of course adding an alias to your .profile for whatever command you want to use would be greatly useful. twitter is now my command for checking my timeline feed. It is ridiculous that I wasted time today messing with this! Perhaps posting all of the information here somehow justifies it a bit. _________________________ So thanks to Equin I have here is the code to clean out the tags sed -e :a -e 's/<[^>]*>//g;/</N;//ba' So the line I am now refreshing in GeekTool is: $curl -u username:password http://twitter.com/statuses/friends_timeline.xml|grep "<text>\|<relative_created_at>\|<name>"|sed -e :a -e 's/<[^>]*>//g;/</N;//ba' The result is a clean string of text, a thing of beauty! Then utilizing GeekTool I also have a similar string which is then piped into growlnotify every five minutes, giving me the last post every five minutes. Between the desktop and the growl reminders I am able to stay on top of my friends posts without any problems.
__________________
17" MBP 2.33GHz C2D 3GB RAM 160GB HDD TV [courtesy of the fine folks at TAB] & iPhone Last edited by divigation; 03-22-2007 at 09:04 PM. Reason: Updated info thanks to Equin's command of Unix |
|
|
|
| Sponsored Links | |
|
|
|
| 03-23-2007 | #33 (permalink) |
|
Concierge
|
If you want the result of some real coding to do what I am doing, TweetyPy was released today by Muffin Research Labs. They created a TextMate bundle for Twitter that allows you to post from TM. TweetyPy allows you to post to Twitter and to get your friends timeline or the public timeline from the command line. This util is written in python to format all of the text into clean columns. Works wonderfully with GeekTool and is much cleaner than my solution.
__________________
17" MBP 2.33GHz C2D 3GB RAM 160GB HDD TV [courtesy of the fine folks at TAB] & iPhone |
|
|
|
| 03-24-2007 | #34 (permalink) | |
|
Concierge
|
Quote:
I wanted to use it to as a way to update the status of blog posts, but the Javascript Twitter provides takes forever to load, even if the content hasn't changed. Boo. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
|
|