Return to Snippet

Revision: 10077
at December 6, 2008 16:48 by garretjames


Initial Code
# Author: Robert P. Levy
# Description: Displays continuous pages of tweets from oldest to newest.
# Instructions: Copy the function into your .bashrc file.

# parameter 1 is number of pages to show 
#   ( shows tweets made by all users you are following )
# parameter 2 (optional) is name of specific user on twitter 
#   ( shows all tweets made by that user )

function tw {
    if [ $(echo "$2" | wc -c) -gt 1 ] ; then
	url="http://twitter.com/$2"
    else
	url="http://twitter.com/home"
    fi
    pages=$1
    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
}

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

Initial Description
I did not write the script, a friend did.

Initial Title
Twitter Bash Script

Initial Tags
command, Bash, twitter

Initial Language
Bash