Skip to content

Instantly share code, notes, and snippets.

@elgreg
Created April 19, 2019 11:13
Show Gist options
  • Save elgreg/5e29b46e46ef907ba2865aff47f387ad to your computer and use it in GitHub Desktop.
Save elgreg/5e29b46e46ef907ba2865aff47f387ad to your computer and use it in GitHub Desktop.
Get all the tweets in a thread starting at the end
#!/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