Skip to content

Instantly share code, notes, and snippets.

@nzw0301
Created September 2, 2018 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nzw0301/ed0e78a64cd159f4097cd68dcd244bd0 to your computer and use it in GitHub Desktop.
Save nzw0301/ed0e78a64cd159f4097cd68dcd244bd0 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
require 'twitter'
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
client = Twitter::REST::Client.new do |config|
config.consumer_key = consumer_key
config.consumer_secret = consumer_secret
config.access_token = access_token
config.access_token_secret = access_token_secret
end
# collect deleted tweet ids
ids = []
while l = gets
l.chomp!
l = l.split(',')[0]
if l
i = l.gsub("\"", '').to_i
ids << i
end
end
# delete
ids.each do |i|
next if i < 10000 # skip invalid ids due to incorrect parse in the code block above
t = Twitter::Tweet.new({:id => i})
p t
client.destroy_tweet(t)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment