Skip to content

Instantly share code, notes, and snippets.

@shiflett
Last active April 1, 2016 03:52
Show Gist options
  • Save shiflett/e8f2d6e43fe8ae6a603bf7dc4053c34e to your computer and use it in GitHub Desktop.
Save shiflett/e8f2d6e43fe8ae6a603bf7dc4053c34e to your computer and use it in GitHub Desktop.
Scrape a Twitter Profile for Tweets
#! /bin/bash
# Based on https://gist.github.com/scoates/5935435
for u in $*; do
echo $u
curl -sL http://twitter.com/$u | \
grep 'tweet-text tweet-text' | head -5 | perl -pe 's/.*?>(.*)<\/p>/\1/;s/<.*?>//g'
echo
done
@shiflett
Copy link
Author

shiflett commented Apr 1, 2016

To use this, create a new file called twitter-scrape (or any name of your choosing), make it executable, then:

./twitter-scrape shiflett

You can also pass it multiple usernames:

./twitter-scrape shiflett coates

Or, if you prefer, a file full of usernames:

./twitter-scrape `cat usernames.txt`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment