Created
May 15, 2023 18:39
-
-
Save alexmill/0643184a90ddb2ac47ffa1777de23780 to your computer and use it in GitHub Desktop.
Save tweet thread as draft on Twitter web desktop browser (workaround)
This file contains hidden or 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
// 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