Last active
June 19, 2020 00:10
-
-
Save sk22/eff7868c5d6dd053fd5501821a7fd54c to your computer and use it in GitHub Desktop.
Count tweets per day
This file contains hidden or 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
| #!/usr/bin/env node | |
| // download: https://twitter.com/settings/your_twitter_data/data | |
| // run in twitter-archive/data/ | |
| window = {} | |
| window.YTD = {} | |
| window.YTD.tweet = {} | |
| require('./tweet.js') | |
| require('fs').writeFileSync('tweets.csv', | |
| window.YTD.tweet.part0 | |
| .map(t => ({ text: t.tweet.full_text, date: new Date(t.tweet.created_at) })) | |
| .map(({ text, date }) => `${text}\t${date.toISOString().split('T')[0]}\t${date.toISOString().split('T')[1].slice(0, 5)}`) | |
| .join('\n').toString()) |
This file contains hidden or 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
| #!/bin/bash | |
| # requires https://harelba.github.io/q/ | |
| q -t 'SELECT c2, count(*) FROM ./tweets.csv WHERE c2 IS NOT NULL GROUP BY c2' > tweets-by-date.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment