Skip to content

Instantly share code, notes, and snippets.

@PapeCoding
Last active January 30, 2019 21:47
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 PapeCoding/a9b669d18ebdf6b3e2b503938576282c to your computer and use it in GitHub Desktop.
Save PapeCoding/a9b669d18ebdf6b3e2b503938576282c to your computer and use it in GitHub Desktop.
Get all displayed tweets from a timeline as plaintext in single lines! This is very usefull to get data from twitter without having an api key. This especially works fine on the "advanced search"-results!
a = ""; Array.from(document.getElementsByClassName("tweet-text")).forEach(function(t) {if(t.getAttribute("lang") == "en") a += t.innerText.replace(/\n|\s\s+/g, " ").trim() + "\n"}); var input = document.createElement("textarea"); document.querySelectorAll('.AppContent-main, .AppContent')[0].prepend(input); input.value = a;
@PapeCoding
Copy link
Author

To use it just open the console window with CTRL+SHIFT+I and paste the gist content and hit ENTER. On the top of the timeline a small textarea should appear containing your tweets text.

Make sure to never paste code into your console that you have not checked for validity!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment