Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexmill/0643184a90ddb2ac47ffa1777de23780 to your computer and use it in GitHub Desktop.
Save alexmill/0643184a90ddb2ac47ffa1777de23780 to your computer and use it in GitHub Desktop.
Save tweet thread as draft on Twitter web desktop browser (workaround)
// Copy this code into your browser's console to print out the text content of all tweets
// a thread that you are currently composing on Twitter desktop web. This will print out
// all the text of your tweets to the console, which you can then copy to a work/text doc,
// presumably for tweeting at a later time. Unofortunately, this does not work with images.
(function() {
// All your tweet inputs have a div with the attribute 'aria-label' set to 'Tweet text'
var tweetInputs = document.querySelectorAll('div[aria-label="Tweet text"]');
var tweetTexts = [];
for (var i = 0; i < tweetInputs.length; i++) {
// Extracting the textContent as the text is not in a value attribute in a div
tweetTexts.push(tweetInputs[i].textContent);
}
// Concatenate all tweet texts with two new lines
var tweetTextsString = tweetTexts.join('\n\n');
// Log the tweet texts to the console
console.log(tweetTextsString);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment