Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get a twitter profile image from a username. We route around bad APIs. Twitter wears the scumbag hat, these days.
#!/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//'
@beryllium

This comment has been minimized.

Copy link

beryllium commented Jul 5, 2013

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.