Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save walaura/5ba06ceacaef43f28c678c9ce9c60c40 to your computer and use it in GitHub Desktop.
Save walaura/5ba06ceacaef43f28c678c9ce9c60c40 to your computer and use it in GitHub Desktop.
Get Twitter stats as TSV
/*
scroll aaaall the way down in https://analytics.twitter.com/
then run this in the devtools. you can paste the data straight
into google sheets
*/
copy([...document.querySelectorAll('.DataPoint-info.metric-tweetviews')].map(_=>
_.closest('.home-group-row').querySelector('.home-group-header').innerText.replace(' SUMMARY','')
+"\t"+
_.innerText.replace(',','').replace(/\.([0-9][0-9])K/,'$10').replace(/\.([0-9])K/,'$100').replace(/\.([0-9][0-9])M/,'$10000').replace(/\.([0-9])M/,'$100000').replace('K','000').replace('M','000000')
).concat(['time'+"\t"+'engagement']).reverse().join("\n"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment