Posted By

garretjames on 12/06/08

Viewed 4 times

Twitter Bash Script


/ Published in: Bash

URL: http://robertplevy.net/tw.txt

I did not write the script, a friend did.

  1. # Author: Robert P. Levy
  2. # Description: Displays continuous pages of tweets from oldest to newest.
  3. # Instructions: Copy the function into your .bashrc file.
  4.  
  5. # parameter 1 is number of pages to show
  6. # ( shows tweets made by all users you are following )
  7. # parameter 2 (optional) is name of specific user on twitter
  8. # ( shows all tweets made by that user )
  9.  
  10. function tw {
  11. if [ $(echo "$2" | wc -c) -gt 1 ] ; then
  12. url="http://twitter.com/$2"
  13. else
  14. url="http://twitter.com/home"
  15. fi
  16. pages=$1
  17. for i in $(seq 1 $pages) ; do curl --basic --silent --user "USERNAME:PASSWORD" --data-ascii "page=$i" $url; done | grep -B 6 -A 1 "entry-content" | sed 's/<[^>]*>//g' | sed 's/&[^;]*;//g' | sed 's/\s*/ /' | grep -v "^ $" | tac
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.