i_delete_my_tweets 0.2.0 → 0.5.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 +15 -11
- data/i_delete_my_tweets.gemspec +1 -1
- data/lib/i_delete_my_tweets/api.rb +12 -3
- data/lib/i_delete_my_tweets/config.rb +15 -1
- data/lib/i_delete_my_tweets/version.rb +10 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e03c2ee22696ed493efe66668726bf473b813ec6043f30ce8e5ac26e095040c8
|
4
|
+
data.tar.gz: c659a42b19e9265a52d78bb21e5484658eea8de3335cfe453a2c27de584e2295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b29e101e19c38ee684690bd3046ebb2415864d10b5a92857aebfead4698a3dd91c6032e2d9fd30ae48a7f357e4aa406145cec8466281e932020165c9b712513f
|
7
|
+
data.tar.gz: d72ee4efb6b18138ff23c5d213aecdc16ddeacb06b923a1c8116a6fc27353d8b51cb0e7006cf906a14c724bcf952677b180cd9d491efdc2bc874638ca9ed509a
|
data/.env.sample
CHANGED
data/.env.test
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# I Delete My Tweets
|
2
2
|
|
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
|
+
|
3
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">
|
4
6
|
|
5
7
|
A **CLI** (as in Command Line Interface) to delete your tweets based on faves, RTs, and time.
|
@@ -29,17 +31,18 @@ These are the keys/values that make the script work. They are read from and writ
|
|
29
31
|
a `.i_delete_my_tweets` env file in your user directory (~/). You can fill
|
30
32
|
the values yourself or work with the <config store> commands (see Usage) to do that interactively.
|
31
33
|
|
32
|
-
| KEY | VALUE | DESCRIPTION
|
33
|
-
| ------------------- | --------------------------- |
|
34
|
-
| CONSUMER_KEY | String | Your Twitter App key
|
35
|
-
| CONSUMER_SECRET | String | Your Twitter App secret
|
36
|
-
| ACCESS_TOKEN | String | Account access token
|
37
|
-
| ACCESS_TOKEN_SECRET | String | Access token secret
|
38
|
-
| OLDER_THAN | "2022-04-28 21:20:47 -0300" | A timestamp
|
39
|
-
| PATH_TO_CSV | './tweets.csv' | A path to a CSV file
|
40
|
-
| FAVE_THRESHOLD | 3 | Minimum number of faves to skip deletion
|
41
|
-
| RT_THRESHOLD | 5 | Minimum number of RTs to skip deletion
|
42
|
-
|
|
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 (code to avoid system parser problems) |
|
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
|
+
| 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. |
|
45
|
+
| SCREEN_NAME | jack | The account screen_name |
|
43
46
|
|
44
47
|
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.
|
45
48
|
|
@@ -89,6 +92,7 @@ $ i_delete_my_tweets config store RT_THRESHOLD 2
|
|
89
92
|
$ i_delete_my_tweets config store FAVE_THRESHOLD 2
|
90
93
|
$ i_delete_my_tweets config store OLDER_THAN 2021-11-02
|
91
94
|
$ i_delete_my_tweets config store SCREEN_NAME mytwitterhandle
|
95
|
+
$ i_delete_my_tweets config store WITH_WORDS "#fml, #drunktweets, rogan"
|
92
96
|
```
|
93
97
|
|
94
98
|
IDMT can generate an `ACCESS_TOKEN` and `ACCESS_TOKEN_SECRET` for you using a PIN provided
|
data/i_delete_my_tweets.gemspec
CHANGED
@@ -6,7 +6,7 @@ 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
11
|
spec.add_dependency 'terminal-table', '~> 3.0.2'
|
12
12
|
spec.add_dependency 'thor', '~> 1.2.1'
|
@@ -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
|
@@ -1,11 +1,18 @@
|
|
1
|
-
require '
|
1
|
+
require 'yaml'
|
2
2
|
|
3
3
|
module IDeleteMyTweets
|
4
4
|
module Version
|
5
5
|
module_function
|
6
6
|
|
7
7
|
def parsed_version
|
8
|
-
@parsed_version ||=
|
8
|
+
@parsed_version ||= begin
|
9
|
+
hash = YAML.load_file('.semver')
|
10
|
+
Struct.new(:major, :minor,
|
11
|
+
:patch, :special,
|
12
|
+
:metadata, :prerelease, keyword_init: true).new(major: hash[:major], minor: hash[:minor],
|
13
|
+
patch: hash[:patch], special: hash[:special],
|
14
|
+
metadata: hash[:metadata], prerelease: hash[:prerelease])
|
15
|
+
end
|
9
16
|
end
|
10
17
|
|
11
18
|
# @return [Integer]
|
@@ -25,7 +32,7 @@ module IDeleteMyTweets
|
|
25
32
|
|
26
33
|
# @return [Integer, NilClass]
|
27
34
|
def pre
|
28
|
-
parsed_version.prerelease.empty? ? nil : parsed_version.prerelease
|
35
|
+
parsed_version.prerelease && parsed_version.prerelease.empty? ? nil : parsed_version.prerelease
|
29
36
|
end
|
30
37
|
|
31
38
|
# @return [Hash]
|
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.5.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-06-
|
13
|
+
date: 2022-06-17 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
|