Created
April 16, 2017 08:42
-
-
Save fdv/a140d176d47903fefcd59773cdedfd70 to your computer and use it in GitHub Desktop.
Delete tweets you don't want anymore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Before running that script, use Twitter backup CSV file to pick up the tweets | |
# you want to delete. Save, then run: | |
# cat tweets.csv | cut -f 2 -d '"' | grep '^[0-9]*$' | sed '/^$/d' > delete.csv | |
# gem install twitter (in case you miss the gem already) | |
require 'twitter' | |
client = Twitter::REST::Client.new do |config| | |
config.consumer_key = '' | |
config.consumer_secret = '' | |
config.access_token = '' | |
config.access_token_secret = '' | |
end | |
File.readlines("delete.csv").reverse.each do |line| | |
begin | |
client.destroy_status(line.strip!) | |
puts "deleted #{line}" | |
rescue Exception => e | |
puts "Failed to delete #{line}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment