简体   繁体   English

从个人 twitter 帐户中删除所有推文

[英]Delete all tweets from personal twitter account

My Twitter account has been hacked and a scam posted about 500 scam-tweets from it.我的 Twitter 帐户被黑,一个骗局从中发布了大约 500 条骗局推文。

The task: delete all tweets with JS in DevTools.任务:在 DevTools 中删除所有带有 JS 的推文。

My solution:我的解决方案:

const tweets = document.querySelectorAll('[data-testid="tweet"]')
for (let i = 0; i<= tweets.length; i++) {
   //1. Click on a tweet to show the tweet-menu:
   setTimeout(() => {tweets[i].querySelector('[aria-label="More"]').click()}, 1000)

   //2. Click on delete option:
   setTimeout(() => {document.querySelector('[role="menuitem"]').click()}, 1000)

   //3. Approve deleting in popup:
   setTimeout(() => {document.querySelector('[data-testid="confirmationSheetConfirm"]').click()}, 1000)
}

Problems:问题:

  1. We need to scroll for more tweets and only then run it again.我们需要滚动查看更多推文,然后才能再次运行它。
  2. Each step (1,2,3) is not waiting for the previous to end running.每一步 (1,2,3) 都不等待前一步结束运行。

I think what you are looking for is the Twitter API, you can find the documentation here: Twitter Developer API我想你要找的是 Twitter API,你可以在这里找到文档: Twitter Developer ZDB974238714CA8ACE4FZ4

It allows you to log into your account with your API Key and post, delete and do basically everything with your account using code.它允许您使用您的 API 密钥登录您的帐户,然后使用代码发布、删除和使用您的帐户进行基本上所有操作。

Alternatively, there is already a web application for bulk deleting tweets: TweetDelete或者,已经有一个用于批量删除推文的 web 应用程序: TweetDelete

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM