How to get the number of twitter followers without a twitter application on the twitter API
You can download the latest version from: http://phantomjs.org/download.html
Copy this into a directory along with your PhantomJS binary and name it "weworkwefollow.js" (or something)
test the script using this command; replace PATH_TO_PHANTOMJS with the path to the directory you've stored your phantomJS binary, give the twitter usernames as command line arguments to the script
[PATH_TO_PHANTOMJS]/phantomjs weworkwefollow.js [TWITTER_USERNAME] [TWITTER_USERNAME] [TWITTER_USERNAME]
example:
phantomjs weworkwefollow.js weworkweplay pharrell nosajthing bibio
the script returns a JSON, something like this:
{
"weworkweplay":"135",
"pharrell":"2.92M",
"nosajthing":"36.8K",
"bibio":"9,748"
}
Small example in php that you can use in a cronjob or as a async javascript call on your site:
As someone on reddit suggested you can also easily scrape a page using cURL
on ubuntu just apt-get install with:
sudo apt-get install curl
curl https://twitter.com/weworkweplay | grep js-mini-profile-stat | grep followers | awk 'gsub(/.*title="|" class.*/,"")' >> output.txt
This will scrape the page and output the number of followers to a text file. You can then easily add this to your crontab and voila, you got yourself a twitter scraper!