Created
April 19, 2019 11:13
-
-
Save elgreg/5e29b46e46ef907ba2865aff47f387ad to your computer and use it in GitHub Desktop.
Get all the tweets in a thread starting at the end
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
#!/usr/bin/env bash | |
START=$1 | |
CURRENT="${START}" | |
mkdir $START | |
download_tweet () { | |
twurl "/1.1/statuses/show/${CURRENT}.json" > "${START}/${1}.json" | |
} | |
download_all_tweets () { | |
echo $CURRENT | |
CURRENT="$1" | |
twurl "/1.1/statuses/show/${CURRENT}.json" > "${START}/${1}.json" | |
PREV=`cat ${START}/${CURRENT}.json | jq -r .in_reply_to_status_id_str` | |
if [ ! -z "$PREV" ] | |
then | |
echo "Going to get $PREV" | |
download_all_tweets $PREV | |
else | |
echo "Tweet not in reply" | |
fi | |
} | |
download_all_tweets $CURRENT | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment