i_delete_my_tweets 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.sample +1 -0
- data/.env.test +1 -0
- data/README.md +20 -16
- data/i_delete_my_tweets.gemspec +2 -2
- data/lib/i_delete_my_tweets/api.rb +12 -3
- data/lib/i_delete_my_tweets/config.rb +15 -1
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 140a25c54062ff5355b112ee908910a650e863083d4f1fef902061174d402dd9
|
4
|
+
data.tar.gz: 2e175592516991303d10d8bd1d7201a61b8968892ad3e274dd53567e43ea019d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a13f497f3ae9c6758bbd048caf9c12222c36a29d03938d1ee2a623f48fe53f3fd78308ebb21f9591b92f8b6ee5193fe3a461c630ed8683987f6551d778a03b22
|
7
|
+
data.tar.gz: df4d7167097cf5b492751133791ca58fdcc50753b80abf6a02a09e9058c710497eed4c2df11c76ea05e7910d82b184168d85ae20772fdeb5c9b3a88425039842
|
data/.env.sample
CHANGED
data/.env.test
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# I Delete My Tweets
|
2
2
|
|
3
|
-
[![Coverage Status](https://coveralls.io/repos/github/spiceee/i_delete_my_tweets/badge.svg?branch=
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/github/spiceee/i_delete_my_tweets/badge.svg?branch=master)](https://coveralls.io/github/spiceee/i_delete_my_tweets?branch=master)
|
4
4
|
|
5
5
|
<img width="800" alt="Screen Shot 2022-05-11 at 19 04 53" src="https://user-images.githubusercontent.com/12278/167955371-a24ec8e6-bd9a-4014-bc25-9fb9e3cb21ce.png">
|
6
6
|
|
7
|
-
A **CLI** (as in Command Line Interface) to delete your tweets based on faves, RTs, and time.
|
7
|
+
A **CLI** (as in Command Line Interface) to delete your tweets based on faves, RTs, words, hashtags, and time.
|
8
8
|
|
9
9
|
There are some services out there with a friendly web interface, but this is not one of them.
|
10
10
|
You must know the basics of working with a UNIX terminal and configuring a Twitter API app, as this
|
@@ -13,11 +13,13 @@ will only work if you have a Twitter Developer account.
|
|
13
13
|
Due to the irrevocable nature of tweet deletion, all delete commands are `dry-run` true, meaning
|
14
14
|
you must call all of them with a `--dry-run=false` flag if you want them to really do something.
|
15
15
|
|
16
|
-
Called with `--dry-run=false`, there is no way to revoke tweet deletion. They are just gone, disappeared into the ether (or
|
16
|
+
Called with `--dry-run=false`, there is no way to revoke tweet deletion. They are just gone, disappeared into the ether (or stashed in the Twitter-owned secret place you have no access to without a mandate since nothing gets _really_ deleted from the web these days, folks).
|
17
17
|
|
18
18
|
This tool won't delete all of your tweets in one fell swoop; it is more of a way to delete your old tweets from time to time. The [Twitter API rate limits](https://developer.twitter.com/en/docs/twitter-api/rate-limits) are relatively complicated, and I don't even wanna go there, but if you do intend on deleting all of your tweets, you can do it with this CLI and some perseverance. I did delete more than 100k of mine by using this script every day for a couple of weeks. The more tweets you delete, the fewer of them you have, and with time the rate limits won't be that much of a problem.
|
19
19
|
|
20
|
-
I Delete My Tweets (IDMT) can delete your tweets by fetching them via API using an APP you will have to set up yourself. Still, it can also delete tweets from
|
20
|
+
I Delete My Tweets (IDMT) can delete your tweets by fetching them via API using an APP you will have to set up yourself. Still, it can also delete tweets from a CSV (comma-separated file) that you can generate from the archive you can request from twitter.com by going to `Settings and privacy > Your Account > Download an archive of your data`.
|
21
|
+
|
22
|
+
Once you get your zipped archive from Twitter, unzip it, and find the `tweet.js` file.
|
21
23
|
|
22
24
|
IDMT can convert that into a CSV file with:
|
23
25
|
|
@@ -31,17 +33,18 @@ These are the keys/values that make the script work. They are read from and writ
|
|
31
33
|
a `.i_delete_my_tweets` env file in your user directory (~/). You can fill
|
32
34
|
the values yourself or work with the <config store> commands (see Usage) to do that interactively.
|
33
35
|
|
34
|
-
| KEY | VALUE | DESCRIPTION
|
35
|
-
| ------------------- | --------------------------- |
|
36
|
-
| CONSUMER_KEY | String | Your Twitter App key
|
37
|
-
| CONSUMER_SECRET | String | Your Twitter App secret
|
38
|
-
| ACCESS_TOKEN | String | Account access token
|
39
|
-
| ACCESS_TOKEN_SECRET | String | Access token secret
|
40
|
-
| OLDER_THAN | "2022-04-28 21:20:47 -0300" | A timestamp
|
41
|
-
| PATH_TO_CSV | './tweets.csv' | A path to a CSV file
|
42
|
-
| FAVE_THRESHOLD | 3 | Minimum number of faves to skip deletion
|
43
|
-
| RT_THRESHOLD | 5 | Minimum number of RTs to skip deletion
|
44
|
-
|
|
36
|
+
| KEY | VALUE | DESCRIPTION |
|
37
|
+
| ------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
38
|
+
| CONSUMER_KEY | String | Your Twitter App key |
|
39
|
+
| CONSUMER_SECRET | String | Your Twitter App secret |
|
40
|
+
| ACCESS_TOKEN | String | Account access token |
|
41
|
+
| ACCESS_TOKEN_SECRET | String | Access token secret |
|
42
|
+
| OLDER_THAN | "2022-04-28 21:20:47 -0300" | A timestamp (quote to avoid system parser problems) |
|
43
|
+
| PATH_TO_CSV | './tweets.csv' | A path to a CSV file |
|
44
|
+
| FAVE_THRESHOLD | 3 | Minimum number of faves to skip deletion |
|
45
|
+
| RT_THRESHOLD | 5 | Minimum number of RTs to skip deletion |
|
46
|
+
| WITH_WORDS | #FML, trump, musk | A comma-separated list of words and hashtags that, if found on a tweet, would delete it immediately.<br>If this list is _not_ empty, IDMT will use the words only and bypass any FAVE or RT threshold criteria.<br>OLDER_THAN is always taken into account, though. |
|
47
|
+
| SCREEN_NAME | jack | The account screen_name |
|
45
48
|
|
46
49
|
Since you have to call commands with `--dry-run=false` for them to really take action, just play around with the skip rules before using `--dry-run=false` and see what works for you.
|
47
50
|
|
@@ -91,6 +94,7 @@ $ i_delete_my_tweets config store RT_THRESHOLD 2
|
|
91
94
|
$ i_delete_my_tweets config store FAVE_THRESHOLD 2
|
92
95
|
$ i_delete_my_tweets config store OLDER_THAN 2021-11-02
|
93
96
|
$ i_delete_my_tweets config store SCREEN_NAME mytwitterhandle
|
97
|
+
$ i_delete_my_tweets config store WITH_WORDS "#fml, #drunktweets, rogan"
|
94
98
|
```
|
95
99
|
|
96
100
|
IDMT can generate an `ACCESS_TOKEN` and `ACCESS_TOKEN_SECRET` for you using a PIN provided
|
@@ -117,7 +121,7 @@ $ i_delete_my_tweets config check
|
|
117
121
|
$ i_delete_my_tweets delete start
|
118
122
|
```
|
119
123
|
|
120
|
-
Will start traversing the API for your tweets and applying the `OLDER_THAN`, `FAVE_THRESHOLD`, and `RT_THRESHOLD` rules (they are applied in this order).
|
124
|
+
Will start traversing the API for your tweets and applying the `OLDER_THAN`, `FAVE_THRESHOLD`, and `RT_THRESHOLD` rules (they are applied in this order). These rules are NOT COMBINED; the tweet is deleted if one of the rules matches. If you set up words or hashtags, then IDMT will use those to match tweets up to deletion; `OLDER_THAN` and presence in `WITH_WORDS` will be used as criteria instead.
|
121
125
|
|
122
126
|
Pass in `--dry-run=false` if you REALLY want to delete them otherwise this command will just output the tweets it would delete but doesn't because
|
123
127
|
the default flag for delete commands is `--dry-run=true`.
|
data/i_delete_my_tweets.gemspec
CHANGED
@@ -6,8 +6,9 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.add_dependency 'activesupport', '~> 6.1.5.1'
|
7
7
|
spec.add_dependency 'csv', '~> 3.0.9'
|
8
8
|
spec.add_dependency 'dotenv', '~> 2.7.6'
|
9
|
-
spec.add_dependency 'oauth', '
|
9
|
+
spec.add_dependency 'oauth', '~> 0.5.5'
|
10
10
|
spec.add_dependency 'progress', '~> 3.6.0'
|
11
|
+
spec.add_dependency 'semver2', '~> 3.4.2'
|
11
12
|
spec.add_dependency 'terminal-table', '~> 3.0.2'
|
12
13
|
spec.add_dependency 'thor', '~> 1.2.1'
|
13
14
|
spec.add_dependency 'twitter', '~> 7.0.0'
|
@@ -15,7 +16,6 @@ Gem::Specification.new do |spec|
|
|
15
16
|
spec.add_development_dependency 'rubocop', '~> 1.29'
|
16
17
|
spec.add_development_dependency 'rubocop-performance', '~> 1.13.3'
|
17
18
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.10.0'
|
18
|
-
spec.add_development_dependency 'semver2', '~> 3.4.2'
|
19
19
|
spec.authors = %w('Fabio Mont Alegre')
|
20
20
|
spec.platform = Gem::Platform::RUBY
|
21
21
|
spec.description = IDeleteMyTweets::Description
|
@@ -117,12 +117,21 @@ module IDeleteMyTweets
|
|
117
117
|
tweet.retweet_count < config.rt_threshold.to_i
|
118
118
|
end
|
119
119
|
|
120
|
+
def includes_words?(tweet)
|
121
|
+
tweet.text.match(config.compiled_words_regex)
|
122
|
+
end
|
123
|
+
|
120
124
|
def can_be_destroyed?(tweet)
|
121
125
|
return false unless satisfies_older_than? tweet
|
122
|
-
return false unless bellow_fave_threshold? tweet
|
123
|
-
return false unless bellow_rt_threshold? tweet
|
124
126
|
|
125
|
-
|
127
|
+
if config.with_words.empty?
|
128
|
+
return false unless bellow_fave_threshold? tweet
|
129
|
+
return false unless bellow_rt_threshold? tweet
|
130
|
+
|
131
|
+
true
|
132
|
+
else
|
133
|
+
includes_words?(tweet)
|
134
|
+
end
|
126
135
|
end
|
127
136
|
|
128
137
|
def collect_with_max_id(collection = [], max_id = nil, &block)
|
@@ -10,10 +10,12 @@ module IDeleteMyTweets
|
|
10
10
|
"PATH_TO_CSV",
|
11
11
|
"FAVE_THRESHOLD",
|
12
12
|
"RT_THRESHOLD",
|
13
|
+
"WITH_WORDS",
|
13
14
|
"SCREEN_NAME"
|
14
15
|
].freeze
|
15
16
|
PATH_TO_ENV = "~/.i_delete_my_tweets".freeze
|
16
17
|
OBFUSCATE_WORDS = %w(secret token key).freeze
|
18
|
+
OPTIONALS = %w(with_words).freeze
|
17
19
|
|
18
20
|
class Config
|
19
21
|
attr_accessor :consumer_key,
|
@@ -24,6 +26,7 @@ module IDeleteMyTweets
|
|
24
26
|
:path_to_csv,
|
25
27
|
:fave_threshold,
|
26
28
|
:rt_threshold,
|
29
|
+
:with_words,
|
27
30
|
:screen_name
|
28
31
|
|
29
32
|
def initialize(opts = {})
|
@@ -35,6 +38,7 @@ module IDeleteMyTweets
|
|
35
38
|
@path_to_csv = opts[:path_to_csv] || ENV.fetch("PATH_TO_CSV", "./")
|
36
39
|
@fave_threshold = opts[:fave_threshold] || ENV.fetch("FAVE_THRESHOLD", 0)
|
37
40
|
@rt_threshold = opts[:rt_threshold] || ENV.fetch("RT_THRESHOLD", 0)
|
41
|
+
@with_words = opts[:with_words] || ENV.fetch("WITH_WORDS", "")
|
38
42
|
@screen_name = opts[:screen_name] || ENV.fetch("SCREEN_NAME", "")
|
39
43
|
end
|
40
44
|
|
@@ -62,7 +66,17 @@ module IDeleteMyTweets
|
|
62
66
|
end
|
63
67
|
|
64
68
|
def empty_values
|
65
|
-
zipped.
|
69
|
+
zipped.reject { |tuples| OPTIONALS.member?(tuples.first.downcase) }
|
70
|
+
.map { |tuples| tuples.second.to_s.empty? ? tuples.first : nil }
|
71
|
+
.compact
|
72
|
+
end
|
73
|
+
|
74
|
+
def compiled_words_regex
|
75
|
+
@compiled_words_regex ||= Regexp.union(
|
76
|
+
with_words.split(",")
|
77
|
+
.map(&:squish)
|
78
|
+
.map { |word| /(?<=\s|^)#{Regexp.quote(word)}\b/i }
|
79
|
+
)
|
66
80
|
end
|
67
81
|
|
68
82
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i_delete_my_tweets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "'Fabio"
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-12-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
name: oauth
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - "
|
61
|
+
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 0.5.5
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- - "
|
68
|
+
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: 0.5.5
|
71
71
|
- !ruby/object:Gem::Dependency
|
@@ -82,6 +82,20 @@ dependencies:
|
|
82
82
|
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: 3.6.0
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: semver2
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 3.4.2
|
92
|
+
type: :runtime
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 3.4.2
|
85
99
|
- !ruby/object:Gem::Dependency
|
86
100
|
name: terminal-table
|
87
101
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,20 +200,6 @@ dependencies:
|
|
186
200
|
- - "~>"
|
187
201
|
- !ruby/object:Gem::Version
|
188
202
|
version: 2.10.0
|
189
|
-
- !ruby/object:Gem::Dependency
|
190
|
-
name: semver2
|
191
|
-
requirement: !ruby/object:Gem::Requirement
|
192
|
-
requirements:
|
193
|
-
- - "~>"
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: 3.4.2
|
196
|
-
type: :development
|
197
|
-
prerelease: false
|
198
|
-
version_requirements: !ruby/object:Gem::Requirement
|
199
|
-
requirements:
|
200
|
-
- - "~>"
|
201
|
-
- !ruby/object:Gem::Version
|
202
|
-
version: 3.4.2
|
203
203
|
description: |
|
204
204
|
A CLI (as in Command Line Interface) to delete your tweets based on faves, RTs, and time.
|
205
205
|
|