Earlier today, a TwitRSS.me user, @pur_wie asked me if there was a way to get follower counts from Twitter.
@ciderpunx Thanks for twitRSS.me. It works great in getting tweet texts.Is it possible to get the count,num of followers/followees?
— Pur (@pur_wie) June 7, 2014
Depending on your use case, I suppose you could try Twitter’s closed API. But OAuth is a faff. The quickest thing to do would be to crack out Yahoo’s YQL tool and screen scrape the data. I boshed together this little YQL expression that does the job http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20from%20html%20where%20url="http://twitter.com/ciderpunx"%20AND%20xpath="//li[contains(@class,'ProfileNav-item--followers')]/a/span[@class='ProfileNav-value']|//li[contains(@class,'ProfileNav-item--following')]/a/span[@class='ProfileNav-value']"
However, @pur_wie also needed a count of the users Tweets, which meant evolving the xpath expression a bit. http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20from%20html%20where%20url="http://twitter.com/ciderpunx"%20AND%20xpath="//li[contains(@class,'ProfileNav-item--followers')]/a/span[@class='ProfileNav-value']|//li[contains(@class,'ProfileNav-item--following')]/a/span[@class='ProfileNav-value']|//li[contains(@class,'ProfileNav-item--tweets')]/a/span[@class='ProfileNav-value']"
A proof of concept
It occurred to me that I could very easily wrap this in a bit of jQuery and make a little tool for putting together the tweets. So here it is. You can type a twitter username into the box and find out how many times they have tweeted, how many followers they have got and how many people they follow.