Skip to content

Instantly share code, notes, and snippets.

@barnabywalters
Last active November 19, 2022 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barnabywalters/5d560a82ee4c8b5c87eb246404faeda7 to your computer and use it in GitHub Desktop.
Save barnabywalters/5d560a82ee4c8b5c87eb246404faeda7 to your computer and use it in GitHub Desktop.
var urls = {};
// Use browser debug tools to determine the column ID of the column which contains the tweets you want to archive
var columnID = 'e.g. c1668738656730s59';
var col = document.querySelector('.chirp-container[data-column=' + columnID + ']')
// Each time you run this line, new content will be loaded into the column by scrolling, and the new tweet information added
// to urls. Repeat the “up, enter, wait for new content” cycle until either you are satisfied or tweetdeck refuses to load
// more content. If you get HTTP 429 errors, wait a little and continue! Only once you get a 410 or just nothing at all when
// running the line have you reached the end.
col.parentElement.scrollBy(0, col.scrollHeight); document.querySelectorAll('[data-column=' + columnID + '] .tweet-timestamp a').forEach(function (el) {urls[el.href] = true;})
// Once tweetdeck refuses to load any more content (it was after ~3000 tweets for me), the keys of the urls object
// contain the URLs of all the tweets you scrolled past. For quick usage, use the browser console to print a text
// representation of urls, copy and paste it into a text file for further processing e.g. making a script to use
// https://granary.io/ to fetch the data for each tweet you want to archive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment