Another way to save your own tweets exactly as they are rendered on Twitter, with replies, using snscrape and SingleFile/cli:
-
TWEETER=someusername snscrape twitter-user ${TWEETER} | grep -o -P '\d+$' | sed -r 's,^,https://twitter.com/i/status/,g' > ${TWEETER}-tweets # write a URL list
- Make sure the oldest tweet in this list is in fact your oldest tweet, and that snscrape did not stop early due to Twitter Search problems.
- Merge in all the tweet URLs from your Twitter data export, to include retweets and Circle tweets:
cat data/tweets.js | sed -r 's/^window\.YTD\.tweets\.part0 = //' | jq -r '.[].tweet.id' | sed -r 's,^,https://twitter.com/i/status/,g' >> ${TWEETER}-tweets cat ${TWEETER}-tweets | sort | uniq > ${TWEETER}-tweets.uniq && mv -f ${TWEETER}-tweets{.uniq,}
- Write a
cookies.txt
file with your Twitter cookies, exported using the cookie.txt browser extension. - Unmute people if you want their replies included.
-
single-file \ --browser-executable-path google-chrome-unstable \ --browser-cookies-file cookies.txt \ --browser-wait-delay 2000 \ --urls-file ${TWEETER}-tweets \ --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36" \ --save-original-urls \ --filename-template '{page-title} - {url-href-flat}.html'
Then run it again for all the URLs that failed due to transient Twitter errors...
I observed this crash after 5920 tweets: https://gist.github.com/ivan/2eb572eaafb588f07b729a3315cbf265, so watch out for that.