Last active
February 4, 2024 12:40
-
-
Save victor-torres/9c7d6d6029ed7be425a1624ef57e9741 to your computer and use it in GitHub Desktop.
This JavaScript code snippet can be pasted into Chrome's developer console in order to remove tweets.
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
/* | |
Copyright (c) 2017 Victor Torres | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in | |
all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
THE SOFTWARE. | |
*/ | |
/* | |
Example of usage: | |
Paste the code below on Chrome's developer console and run this method when you're ready. | |
>>> deleteTweets() | |
You can test removing a single tweet before doing the batch process. | |
>>> deleteTweet() | |
When you're done with the batch process run the stop method. | |
>>> stop() | |
*/ | |
function deleteTweet() { | |
// Deletes first tweet on page | |
$(".js-actionDelete")[0].click() | |
$(".delete-action")[0].click() | |
// FIXME: not able to undo retweets | |
} | |
var interval = null; | |
function deleteTweets() { | |
if (interval != null) return; | |
// It's useful to wait 3s, otherwise | |
// requests may be rejected by Twitter. | |
interval = setInterval(deleteTweet, 3000); | |
} | |
function stop() { | |
clearInterval(interval); | |
interval = null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool!