Twitter Show All Replies

Automatically click 'show more replies'

  1. // ==UserScript==
  2. // @name Twitter Show All Replies
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.7
  5. // @description Automatically click 'show more replies'
  6. // @author cro
  7. // @match https://*.twitter.com/*
  8. // @match https://*.x.com/*
  9. // @icon https://www.google.com/s2/favicons?domain=twitter.com
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13. /* jshint esversion: 6 */
  14.  
  15. (function() {
  16. 'use strict';
  17. let path_match = new RegExp('^/.+/status/\\d+$');
  18.  
  19. let click_show_more = function()
  20. {
  21. if (!window.location.pathname.match(path_match))
  22. {
  23. return;
  24. }
  25. let nodes = document.querySelector('main[role="main"] section')?.lastChild?.firstChild?.children;
  26. if (!nodes)
  27. {
  28. return;
  29. }
  30. for (let node of nodes)
  31. {
  32. if (node.querySelector('[data-testid="tweet"]'))
  33. {
  34. continue;
  35. }
  36. node.querySelector('[role="button"]')?.click()
  37. }
  38. };
  39.  
  40. setInterval(click_show_more, 500);
  41. })();