Skip to content

Instantly share code, notes, and snippets.

@nishantrpai
Last active March 13, 2023 16:01
Show Gist options
  • Save nishantrpai/441d507cf395abc7c57b01417f416839 to your computer and use it in GitHub Desktop.
Save nishantrpai/441d507cf395abc7c57b01417f416839 to your computer and use it in GitHub Desktop.
Delete old Tweets using Twitter advanced search and console

Bulk Delete Old Tweets

  1. Search your query on twitter advanced search

Example:

image

  1. Open Console: Option + ⌘ + J (on macOS), or Shift + CTRL + J (on Windows/Linux).

Paste:

Array.from(
  document.querySelectorAll('article .css-1dbjc4n .r-18u37iz .r-1h0z5md svg')
).map((node, i) => {
  if (node.parentElement.parentElement.parentElement) {
    setTimeout(() => {
      node.parentElement.parentElement.parentElement.click();
      document.querySelector('[role="menuitem"]').click();
      document
        .querySelector('[style="background-color: rgb(244, 33, 46);"]')
        .click();
    }, i * 1000);
  }
});

Note: Script may stop sometime press the up arrow key (you'll see the code again)

  1. Drink your coffee or milk and relax, watch the tweets disappear into the void.

image

@nishantrpai
Copy link
Author

updated the script

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