Created
March 8, 2022 19:54
-
-
Save SpikePy/6408b8cea510740e18c20510cfe748c1 to your computer and use it in GitHub Desktop.
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
twitter_api_bearer_token=xxx | |
hashtag=spotify | |
granularity=hour | |
curl \ | |
-X GET \ | |
-H "Authorization: Bearer ${twitter_api_bearer_token}" \ | |
"https://api.twitter.com/2/tweets/counts/recent?query=%23${hashtag}&granularity=${granularity}&search_count.fields" \ | |
| jq -r '.data[] \ | |
| {"start","end","tweet_count"} \ | |
| join(" ")' \ | |
| sed -e 's/.000Z/Z/g' | |
# create csv to plat a table via excel/calc | |
curl \ | |
-X GET \ | |
-H "Authorization: Bearer ${twitter_api_bearer_token}" \ | |
"https://api.twitter.com/2/tweets/counts/recent?query=%23${hashtag}&granularity=${granularity}&search_count.fields" \ | |
| jq -r '.data[] \ | |
| {"start","end","tweet_count"} \ | |
| join(",")' | sed -e 's/.000Z/Z/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment