Last active
December 19, 2015 09:49
-
-
Save scoates/5935435 to your computer and use it in GitHub Desktop.
Get a twitter profile image from a username.
We route around bad APIs. Twitter wears the scumbag hat, these days.
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 | |
# Usage: $0 username | |
# e.g.: | |
# $ ./twitter_user_to_image coates | |
# https://si0.twimg.com/profile_images/1597362183/me.jpg | |
curl -sL http://twitter.com/$1 | grep profile_images | head -n1 | perl -p -e's/.*?http/http/;s/".*//;s/_bigger//' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Suggestion that might come in handy in the future: Add a user agent. :)
--user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0"
Or choose one from this list: http://techblog.willshouse.com/2012/01/03/most-common-user-agents/