Twitter Bulk Deleter is a Chrome Extension designed to help users delete tweets in bulk by simulating user interactions with the Twitter interface. This tool is particularly useful for those looking to manage their Twitter presence efficiently.
It takes in an input json like so..
{
"url": "https://twitter.com/username/status/tweetid",
"text": "It is attractive when the vocals are naturally silky in texture.",
"created_at": "2023-04-22 14:45:22"
}and deletes it. You have to be logged in and have permissions to delete the tweet.
- Deletes tweets in bulk by automating user clicks.
- Simulates deletion while adhering to Twitter’s UI structure.
- Customizable to handle confirmation dialogs and additional steps if necessary.
.
├── background
│ └── background.js # Service worker script for handling actions.
├── content
│ └── contentScript.js # Script injected into Twitter to automate deletion.
├── popup
│ ├── popup.html # HTML for the extension’s popup UI.
│ └── popup.js # JavaScript for popup interaction.
├── images # Icons and visuals for the extension.
├── manifest.json # Chrome extension configuration file.
└── README.md # Documentation for the codebase.
-
Clone or download the repository:
git clone https://github.com/richadaf/twitter-bulk-deleter.git
-
Navigate to the
twitter-bulk-deleterdirectory and compress the folder into a ZIP file (if required by your browser). -
Open your Chrome browser and navigate to:
chrome://extensions/ -
Enable Developer mode (toggle in the top-right corner).
-
Click Load unpacked and select the folder containing the extension files.
-
The extension should now appear in your Chrome Extensions list.
-
Log in to Twitter/X and navigate to your profile or tweets page.
-
Click the Twitter Bulk Deleter extension icon in the Chrome toolbar.
-
In the popup UI, configure the deletion options (e.g., auto-confirm dialogs).
-
Click "Start Deletion" to begin deleting tweets. The extension will simulate the process automatically.
This service worker listens for actions triggered via the extension UI and coordinates the deletion process:
- Opens tweet URLs in new tabs.
- Injects the
contentScript.jsinto those tabs.
This script is responsible for:
- Identifying the "Delete" button on the tweet menu.
- Simulating clicks to delete the tweet.
- Handling confirmation dialogs if required.
Defines the permissions, host permissions, and configuration for the extension. Key settings include:
- Host Permissions:
*://twitter.com/*,*://x.com/*. - Permissions:
tabs,storage,scripting,activeTab.
-
Issue:
Delete menu item not found.- Solution: Ensure the selector in
contentScript.jsmatches the current Twitter/X UI.
- Solution: Ensure the selector in
-
Issue:
TypeError: deleteMenuItem.click is not a function.- Solution: Use
document.querySelectorAllto get a NodeList and access individual elements with[0].
- Solution: Use
If Twitter/X changes their UI, selectors in contentScript.js may need to be updated:
- Inspect the page using Chrome Developer Tools.
- Locate the updated element and note its attributes.
- Modify the selectors in
contentScript.jsaccordingly.
Example:
const deleteMenuItem = document.querySelectorAll('NEW_SELECTOR_HERE');- Open the relevant script (e.g.,
contentScript.jsorbackground.js). - Add your feature logic and ensure it aligns with the current workflow.
- Test thoroughly before deploying.
- UI-dependent: Changes to Twitter/X’s interface may require updates to the selectors.
- Rate Limits: Excessive usage may trigger Twitter’s rate-limiting mechanisms.
- JSON input: You need to download your data from twitter and create a json containing tweet id and text to the extension
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add new feature" - Push to your fork:
git push origin feature-name
- Open a pull request.
Made with contrib.rocks.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or support, feel free to reach out:
- Email: richardfamoroti@gmail.com
- GitHub Issues: Issues Page