Tuesday, November 30, 2010

From the Linux command line to update Twitter and FriendFeed

Analysis of analysis output through Twitterfeed, you know you need to first use sed process it to get a real, easy-to-read results.

XML is really easy to read, but after viewing the results can be concluded, you will need to resolve all the stuff between the tags. However, there is an obstacle. XML does not contain any new rows or CR code, it is just a long XML string. So, how do you resolve it? here you must select a different output formats. Available formats with JSON, XML, RSS or Atom. For this example, you can select RSS because it is the most clean and tidy, and contains what you need to wrap. View the results in the RSSfeed. What you need is between the tags, so use a modified version of the sed command processing output: curl-s-u "nickname: key" http://friendfeed.com/api/feed/home?format=rss|sed-ne <\ ff:body="">'///gp ' you got the stuff! all the entries in the FriendFeed can see. Knowledge summary from the command line manually run these commands to track the feed is not appropriate. Don't forget, in site press F5 to complete this task. Therefore, in order to be as close to the command line, you can use the shell script to write into the script. Of course, you can also use Python, Perl or platforms available any scripting language, but from the command to run the examples to get the results you want. By creating a named lintweet script, you can use Twitter stream to write into the script. Of course, you can choose any name. Listing 1 shows the script. Manifest 1.Lintweet.s!/bin/bas while: docurl-shttp://twitter.com/statuses/public_timeline.xml | <\ text="">sed-ne'///gp ' sleep10doneexitNext, makethisscriptexecutable.Then, runitusingthecommand:./lintweet every 10 seconds, the window is the latest tweet updates. For Twitter, because the terms of service (TOS) have no restrictions on the frequency, so publicfeed can sleep is set to 1, every one second will update the settings. However, you should reduce the pressure on the server, or set it to 10. (If you insist on the sleep set to 1, and not much can keep track of things, because the result will be a series of fast flowing through updates). Closing now you know how to work with most Linux distributions available 2 tools — cURL and GNUWget — from the Linux command line gets the tweet. You can also manually from Twitter and FriendFeed to track feed, or use a simple shell script tracing feed. You can extend the shell script, according to some keywords to filter to show only contains certain words or phrases for status updates. Or you can save the script to a file that gets the archiving of Twitter and FriendFeed updates. If you are running MacOSX, or even the script hooks received on Growl notification system, such as (see references). This objective is varied, you need your own practice.

No comments:

Post a Comment