Created
September 2, 2018 16:42
-
-
Save nzw0301/ed0e78a64cd159f4097cd68dcd244bd0 to your computer and use it in GitHub Desktop.
This file contains 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
# -*- 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