Created
October 23, 2017 20:59
-
-
Save kylebragger/92300e7c053fd2843d8a518d548e45ae to your computer and use it in GitHub Desktop.
Original source: https://gist.github.com/kirillzubovsky/6333f09f3d557397dc6f
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
# Step 1: request and download your twitter archive | |
# Step 2: create a twitter app (on their dev site) so you can fill out the key and secret data | |
# Step 3: run, and prosper | |
require 'twitter' | |
require "json" | |
USERNAME = 'YOURUSERNAME' | |
ARCHIVE_PATH = '/YOUR/DOWNLOADS/FOLDER/data/js/tweets' | |
client = Twitter::REST::Client.new do |config| | |
config.consumer_key = '-set-' | |
config.consumer_secret = '-set-' | |
config.access_token = '-set-' | |
config.access_token_secret = '-set-' | |
end | |
Dir.foreach(ARCHIVE_PATH) do |item| | |
unless (item == '.') or (item == '..') or (item == '.DS_Store') | |
#ignore system files and paths | |
file = File.readlines("#{ARCHIVE_PATH}/#{item}")[1..-1].join() | |
data = JSON.parse(file) | |
data.each do |tweet| | |
removeId = tweet['id'] | |
begin | |
client.destroy_status(removeId) | |
puts "destroyed tweet_id: #{removeId}" | |
rescue => e | |
puts "ooops: #{e} -- t_id: #{removeId}" | |
end | |
end | |
sleep(60) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment