delete_my_tweets 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +36 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +65 -0
- data/Rakefile +1 -0
- data/bin/config.yml +5 -0
- data/bin/delete_my_tweets +6 -0
- data/delete_my_tweets.gemspec +25 -0
- data/lib/delete_my_tweets.rb +5 -0
- data/lib/delete_my_tweets/cli.rb +30 -0
- data/lib/delete_my_tweets/config.rb +43 -0
- data/lib/delete_my_tweets/twitter.rb +40 -0
- data/lib/delete_my_tweets/version.rb +16 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 08d0818269fac01da289d4a7d38959b71b09e9b6
|
4
|
+
data.tar.gz: 3812d98f413362dd147bb64f4273145c6f8028c4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 52983e520b664332035a29a518eee8f3106ec3e63ad62093724318ec62a873adc74b08953888fb8b9ab533824b27f6a6f009f309c7b82403536b3cdc2310506c
|
7
|
+
data.tar.gz: 77458c25ffa0d65585a53e4015904f6a340a69e083cfd8337bcb63126e65bd52ebd58612d87c4a250be3e91b2778bfeb08e46d47057b527ab87b3747c5cc09eb
|
data/.gitignore
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
17
|
+
|
18
|
+
## Documentation cache and generated files:
|
19
|
+
/.yardoc/
|
20
|
+
/_yardoc/
|
21
|
+
/doc/
|
22
|
+
/rdoc/
|
23
|
+
|
24
|
+
## Environment normalization:
|
25
|
+
/.bundle/
|
26
|
+
/vendor/bundle
|
27
|
+
/lib/bundler/man/
|
28
|
+
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
31
|
+
Gemfile.lock
|
32
|
+
# .ruby-version
|
33
|
+
# .ruby-gemset
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# delete_my_tweets
|
2
|
+
|
3
|
+
When you just want to start fresh š¤
|
4
|
+
|
5
|
+
![](http://i.giphy.com/5xaOcLwEvFOizxHVyVy.gif)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```shell
|
10
|
+
$ git clone https://github.com/dkhamsing/delete_my_tweets.git
|
11
|
+
$ cd delete_my_tweets/
|
12
|
+
$ rake install
|
13
|
+
```
|
14
|
+
|
15
|
+
## Configuration
|
16
|
+
|
17
|
+
```shell
|
18
|
+
$ delete_my_tweets --config
|
19
|
+
delete_my_tweets 0.1.0
|
20
|
+
open this url in your browser (sign in and authorize): https://api.twitter.com/oauth/authorize?oauth_token=qAkIxAAAAAAAkM7bAAABVFNhDts
|
21
|
+
enter pin: 8166988
|
22
|
+
wrote config.yml š¤
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
```shell
|
28
|
+
$ delete_my_tweets
|
29
|
+
delete_my_tweets 0.1.0
|
30
|
+
found 122 tweets
|
31
|
+
1 š RT @a2: OH @iwasleeg: āIām a programmer. Iām paid to think I know what Iām doing.ā
|
32
|
+
2 š RT @CoolAssPuppy: Kids, don't do drugs. Also don't start eating @WholeFoods trail mix. Same thing. #Help https://t.co/8Sr1YknywZ
|
33
|
+
# ...
|
34
|
+
all done š¤
|
35
|
+
```
|
36
|
+
|
37
|
+
### Filtering
|
38
|
+
|
39
|
+
You can exclude tweets by editing config.yml. The following will exclude tweets with "Add" or "add" from deletion.
|
40
|
+
|
41
|
+
```yml
|
42
|
+
#...
|
43
|
+
access_token_secret: somethingsomethingsometh..
|
44
|
+
filter:
|
45
|
+
exclude:
|
46
|
+
- Add
|
47
|
+
- add
|
48
|
+
```
|
49
|
+
|
50
|
+
## Related
|
51
|
+
|
52
|
+
| Name | Language | SLOC | Stars |
|
53
|
+
| ---- | -------- | ---: | ----: |
|
54
|
+
| [delete-tweets](https://github.com/koenrh/delete-tweets) |`python` | 49 | 15
|
55
|
+
| [oldtweets](https://github.com/olivierthereaux/oldtweets) |`python` | 115 | 26
|
56
|
+
| [TwitterDelete](https://github.com/mikemcquaid/TwitterDelete) | `ruby` | 109 | 24
|
57
|
+
|
58
|
+
## Contact
|
59
|
+
|
60
|
+
- [github.com/dkhamsing](https://github.com/dkhamsing)
|
61
|
+
- [twitter.com/dkhamsing](https://twitter.com/dkhamsing)
|
62
|
+
|
63
|
+
## License
|
64
|
+
|
65
|
+
This project is available under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/config.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'delete_my_tweets/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = DeleteMyTweets::PROJECT
|
8
|
+
spec.version = DeleteMyTweets::VERSION
|
9
|
+
spec.authors = ['Daniel Khamsing']
|
10
|
+
spec.email = ['dkhamsing8@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'Delete my tweets'
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = 'https://github.com/dkhamsing/delete_my_tweets'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'bin'
|
19
|
+
spec.executables = [spec.name]
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.required_ruby_version = '>= 2.0.0'
|
23
|
+
|
24
|
+
spec.add_runtime_dependency 'twitter_oauth_token'
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module DeleteMyTweets
|
2
|
+
require 'delete_my_tweets/config'
|
3
|
+
require 'delete_my_tweets/version'
|
4
|
+
require 'delete_my_tweets/twitter'
|
5
|
+
|
6
|
+
class << self
|
7
|
+
OPT_CONFIG = '--config'
|
8
|
+
|
9
|
+
def cli
|
10
|
+
puts "#{PROJECT} #{VERSION}"
|
11
|
+
|
12
|
+
if ARGV.include? OPT_CONFIG
|
13
|
+
config_create
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
|
17
|
+
if config_missing? CONFIG
|
18
|
+
puts "config missing, type: #{PROJECT} #{OPT_CONFIG}"
|
19
|
+
exit
|
20
|
+
end
|
21
|
+
|
22
|
+
c = config_get(CONFIG)
|
23
|
+
|
24
|
+
twitter_delete(c) do |o|
|
25
|
+
puts o
|
26
|
+
end
|
27
|
+
puts 'all done š¤'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module DeleteMyTweets
|
2
|
+
require 'twitter_oauth_token'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def config_create()
|
7
|
+
c = TwitterOAuthToken::consumer(DELETE_APP_CONSUMER_KEY, DELETE_APP_CONSUMER_SECRET)
|
8
|
+
request_token = TwitterOAuthToken::request_token(c)
|
9
|
+
url = TwitterOAuthToken::authorize_url(request_token)
|
10
|
+
|
11
|
+
puts "open this url in your browser (sign in and authorize): #{url}"
|
12
|
+
|
13
|
+
print "enter pin: "
|
14
|
+
pin = STDIN.gets.strip
|
15
|
+
|
16
|
+
begin
|
17
|
+
access_token = TwitterOAuthToken::access_token(request_token, pin)
|
18
|
+
rescue => e
|
19
|
+
puts "error: #{e}"
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
|
23
|
+
config = {
|
24
|
+
CONSUMER_KEY => DELETE_APP_CONSUMER_KEY,
|
25
|
+
CONSUMER_SECRET => DELETE_APP_CONSUMER_SECRET,
|
26
|
+
ACCESS_TOKEN => access_token.token,
|
27
|
+
ACCESS_TOKEN_SECRET => access_token.secret
|
28
|
+
}
|
29
|
+
|
30
|
+
File.open(CONFIG, 'w') { |f| f.write config.to_yaml }
|
31
|
+
puts "wrote #{CONFIG} š¤"
|
32
|
+
end
|
33
|
+
|
34
|
+
def config_get(file)
|
35
|
+
f = File.read(file)
|
36
|
+
YAML.load(f)
|
37
|
+
end
|
38
|
+
|
39
|
+
def config_missing?(file)
|
40
|
+
!File.exist?(file)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module DeleteMyTweets
|
2
|
+
require 'twitter'
|
3
|
+
require 'delete_my_tweets/version'
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def twitter_delete(t)
|
7
|
+
client = Twitter::REST::Client.new do |config|
|
8
|
+
config.consumer_key = t[CONSUMER_KEY]
|
9
|
+
config.consumer_secret = t[CONSUMER_SECRET]
|
10
|
+
config.access_token = t[ACCESS_TOKEN]
|
11
|
+
config.access_token_secret = t[ACCESS_TOKEN_SECRET]
|
12
|
+
end
|
13
|
+
|
14
|
+
options = {count: 200, include_rts: true}
|
15
|
+
user = client.user.screen_name
|
16
|
+
|
17
|
+
begin
|
18
|
+
exclude = t['filter']['exclude']
|
19
|
+
rescue
|
20
|
+
exclude = []
|
21
|
+
end
|
22
|
+
puts "excluding: #{exclude}" if block_given? && exclude.count>0
|
23
|
+
|
24
|
+
begin
|
25
|
+
tweets = client.user_timeline(user, options)
|
26
|
+
puts "found #{tweets.count} tweets" if block_given?
|
27
|
+
tweets.each_with_index do |t, i|
|
28
|
+
r = exclude.any? { |i| t.text.include? i }
|
29
|
+
if r == false
|
30
|
+
puts "#{i+1} š deletin #{t.text}" if block_given?
|
31
|
+
client.destroy_status t
|
32
|
+
end
|
33
|
+
end
|
34
|
+
rescue Twitter::Error::TooManyRequests => error
|
35
|
+
sleep error.rate_limit.reset_in + 1
|
36
|
+
retry
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Project constants
|
2
|
+
module DeleteMyTweets
|
3
|
+
VERSION = '0.1.0'
|
4
|
+
|
5
|
+
PROJECT = 'delete_my_tweets'
|
6
|
+
|
7
|
+
CONFIG = 'config.yml'
|
8
|
+
|
9
|
+
DELETE_APP_CONSUMER_KEY = 'X7TNI7gi1Bo3l3hRwShZr6Q5l'
|
10
|
+
DELETE_APP_CONSUMER_SECRET = 'clafmSRaf7AnnusNMaZEhMajEESfhw3XTGBfTwlfgBcjwRSHcn'
|
11
|
+
|
12
|
+
CONSUMER_KEY = 'consumer_key'
|
13
|
+
CONSUMER_SECRET = 'consumer_secret'
|
14
|
+
ACCESS_TOKEN = 'access_token'
|
15
|
+
ACCESS_TOKEN_SECRET = 'access_token_secret'
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: delete_my_tweets
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Khamsing
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: twitter_oauth_token
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Delete my tweets
|
28
|
+
email:
|
29
|
+
- dkhamsing8@gmail.com
|
30
|
+
executables:
|
31
|
+
- delete_my_tweets
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- .gitignore
|
36
|
+
- Gemfile
|
37
|
+
- LICENSE
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- bin/config.yml
|
41
|
+
- bin/delete_my_tweets
|
42
|
+
- delete_my_tweets.gemspec
|
43
|
+
- lib/delete_my_tweets.rb
|
44
|
+
- lib/delete_my_tweets/cli.rb
|
45
|
+
- lib/delete_my_tweets/config.rb
|
46
|
+
- lib/delete_my_tweets/twitter.rb
|
47
|
+
- lib/delete_my_tweets/version.rb
|
48
|
+
homepage: https://github.com/dkhamsing/delete_my_tweets
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.0.0
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.0.14.1
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: Delete my tweets
|
72
|
+
test_files: []
|