Skip to content

Instantly share code, notes, and snippets.

@fdv
Created April 16, 2017 08:42
Show Gist options
  • Save fdv/a140d176d47903fefcd59773cdedfd70 to your computer and use it in GitHub Desktop.
Save fdv/a140d176d47903fefcd59773cdedfd70 to your computer and use it in GitHub Desktop.
Delete tweets you don't want anymore
# 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