Last active
April 1, 2016 03:48
-
-
Save shiflett/d98f8f37c4b7bcd25de1 to your computer and use it in GitHub Desktop.
Scrape a Twitter Profile for Bio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Based on https://gist.github.com/scoates/5935435 | |
for u in $*; do | |
echo $u | |
curl -sL http://twitter.com/$u > /tmp/tw.html | |
cat /tmp/tw.html | grep '<title' | perl -pe 's/.*?>//;s/ \(.*//' | |
cat /tmp/tw.html | grep ProfileAvatar-image | head -n1 | perl -p -e's/.*?http/http/;s/".*//' | |
cat /tmp/tw.html | grep ProfileHeaderCard-bio -a2 | tail -n1 | perl -pe 's/.*?>(.*)<\/p>/\1/;s/<.*?>//g' | |
echo | |
rm /tmp/tw.html | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use this, create a new file called
twitter-scrape
(or any name of your choosing), make it executable, then:You can also pass it multiple usernames:
Or, if you prefer, a file full of usernames: