Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# Fork Notes

添加了两个选项,推文中多于一定的 点赞/转发 数量的推文,将被略过,不被删除。只在使用 twitter 的导出文档进行删除时生效。

Add two options to skip tweets more than a certain amount of favorites or retweets, only work in Archive mode.

```
"min_favorite_count":99999999,
"min_retweet_count":99999999,
```

注意:

1. 代码**默认为不使用 archive 文件**,直接删除用户页面上的推文(可能只删最新的 3200 条)。如果配合 twitter 的导出文档删除,请先更改代码中的 from_archive 和 old_tweets 设置。
2. 下面的原作者的攻略,在使用 Chrome Proxy 翻墙时,可能不好用,找不到 Bearer id。需要在全局翻墙模式下使用。

---

# Disclaimer

It should work just fine, I regularly use the script myself, but if anything wrong happens I am not taking any responsibility. Do not use this script if the 0.1% possible failure scares you.
Expand All @@ -13,8 +31,6 @@ I use Google Chrome. I don't know if it will work elsewhere. It probably will, b
## Video Tutorial
https://github.com/teisseire117/DeleteTweets/assets/43145883/249584c3-ce01-424b-8ce5-751e976c8df0



## Text Tutorial

- Go to https://twitter.com/
Expand Down
17 changes: 17 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ var delete_options = {
],
/* old_tweets : IF the script worked without any error but haven't deleted some old tweets, set this to true.*/
"old_tweets":false,

/* minimum favorite / retweet count: IF you want to keep tweets with a certain amount of favorites or retweets.
only work in Archive mode.
*/
"min_favorite_count":99999999,
"min_retweet_count":99999999,

/*
after_date // before_date : allows you to delete tweets that belong in a specific time frame
In the example below, tweets that were made before 2100-01-01 AND after 1900-01-01 will be deleted. (these dates are not included. It's AFTER and BEFORE)
Expand Down Expand Up @@ -245,6 +252,14 @@ function check_filter_archive(tweet_obj) {
if ((delete_options["tweets_to_ignore"].includes(tweet_id) || delete_options["tweets_to_ignore"].includes( parseInt(tweet_id) ) )) {
return false
}
if (parseInt(tweet_obj["favorite_count"]) >= delete_options["min_favorite_count"])
{
return false
}
if (parseInt(tweet_obj["retweet_count"]) >= delete_options["min_retweet_count"])
{
return false
}
if (check_keywords(tweet_str) && check_date_archive(tweet_date))
return true
return false
Expand Down Expand Up @@ -277,6 +292,8 @@ function parseTweetsFromArchive(data) {
tweet_obj["id"] = item.tweet.id_str
tweet_obj["text"] = item.tweet.full_text
tweet_obj["date"] = item.tweet.created_at
tweet_obj["favorite_count"] = item.tweet.favorite_count
tweet_obj["retweet_count"] = item.tweet.retweet_count
if (!isInReplyToExcludedUser
&& ((delete_options["unretweet"] == true && startsWithRT == true) || (delete_options["unretweet"] == false && startsWithRT == false))
&& check_filter_archive(tweet_obj)) {
Expand Down