How to get your Twitter followers in Excel for…
A couple days ago I needed getting a complete list of people following a Twitter account and I couldn’t find a quick solution.
First of all, I tried Scraper for Chrome, but since Twitter uses infinite scroll, on a very long list (mine is not) it would have needed too much time and steps.
I checked Followerwonk, and even if I could check the list I couldn’t export it without a Pro plan.
I thought of building an Excel Scraper using Twitter API, but I discovered information isn’t available easily since v1.1 requires authentication to send GET requests from a client. And I didn’t want to build an app (nor I’m able to do it, probably).
So I had to do put a few things together to achieve my goal.
At the end of the day I built a little Excel file that basically scrapes Followerwonk. This is not that great, I know, but the little detail to highlight is it handles paginated results without requiring any further inputs besides the first page URL.
Let me explain…
If you login in Followerwonk, you have the chance to check all your followers/followings but you can’t download them if you’re not a Pro user.
Even if I endorse Followerwonk for its analysis capabilities, I just needed my followers in a useable form: too little to start a paid plan. So I checked if you could scrape the list using SEO tools for Excel.
This means the list can be scraped, given you correctly handle the pagination.
I know you want the bacon, so first of all this is what you need:
And then, if you’re interested, a bit of explanations.
1) Sheet2!$B$1 is the cell in which you have the URL to scrape, without the page value (ie. https://followerwonk.com/?session=slcdb.203513782.422017.fl.db&track_p=).
2) A column contains numeric values from 1 to the number of your followers.
3) We append the page value to the URL with a simple check: MOD(A1;50) is different from zero when the current index is not a multiple of 50. In the true case, INT(A1/50) is 0 when we are in page 1; it’s 1 when we are on page 2; and so on. Then INT(A1/50)+1 is the page value. When we are at the row 50, 100, 150, etc we fall in the false case and we just get the value of INT(A1/50).
4) We use XpathOnURL on the built URL (you need SEO tools for Excel) to get the href attribute of the //table/tbody/tr/td/a/ element.
5) The tr index changes from 1 to 50. We check if MOD(A1;50) is different from 0 that means we are not at the last item of the current page. If false, we just need the 50th element (A$50); if true, we need to know count to 1 to 49 and then, after 50, restart from 1. We check if INT(A1/50)>=1, that means we are past the 50th row: in this case A101-INT(A101/50)*50=101-100=1. On the contrary, if we have not reached the 50th row, we just pick the current index (A51).
Et voilà: your list, for free.
Now, I hope to be in the list of people you follow.
And if you liked the post and it will come in handy, you can say thanks by linking it in your next one and sharing it via your social profiles and/or Inbound.org.
Thanks for writing this up – very useful – I’ve actually been toying with Selenium and Excel for some basic scraping tasks you should check it out and I might even write about it if I get a chance.