Created
June 1, 2016 22:51
-
-
Save jexp/b0800bd9585b7d06def4a50ff1cd3579 to your computer and use it in GitHub Desktop.
scrape twitter stats data from https://analytics.twitter.com/user/<name>/home
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
// On https://analytics.twitter.com/user/<name>/home | |
// run this in developer console | |
// essentially: | |
$(".home-group-row").map(function(x) { var group=$(this); return group.find(".home-group-header").text()+","+ ['tweets','tweetviews','profile-views','mentions','followers'].map(function(tag) { return group.find(".metric-"+tag).text(); }).join(","); }).toArray().join("\n") | |
// prettied up: | |
var metrics = ['tweets','profile-views','mentions','followers','tweetviews']; | |
"month\t" + metrics.join("\t") + "\n" + | |
$(".home-group-row") | |
.map(function(x) { | |
var group=$(this); | |
var values = metrics.map(function(tag) { return group.find(".metric-"+tag).text().replace(",","").replace(/(.+)K/,"=$1*1000"); }).join("\t"); | |
return group.find(".home-group-header").text().replace(" Summary","")+"\t"+ values | |
}).toArray().join("\n"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment