Created
February 13, 2022 02:29
-
-
Save ayaz-ac/3f3cb7c4000bf6acb81f280bba4f51e1 to your computer and use it in GitHub Desktop.
Clean Twitter account
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
require 'twitter' | |
# SETUP | |
# Create an app on https://developer.twitter.com | |
# Be sure that you enabled OAUTH 1.0A with the 'Read and write and Direct message' in your twitter app | |
# For the required URLs (callback, website, etc.) you can put a random domain name, ex: https//localhost.com | |
# Initialize client with credentials | |
# Note: Consumer Key = API Key and Consumer Secret = API Secret | |
client = Twitter::REST::Client.new do |config| | |
config.consumer_key = 'YOUR_CONSUMER_KEY' | |
config.consumer_secret = 'YOUR_CONSUMER_SECRET' | |
config.access_token = 'YOUR_ACCESS_TOKEN' | |
config.access_token_secret = 'YOUR_ACCESS_TOKEN_SECRET' | |
end | |
# Delete the 200 latest tweets | |
tweets = client.user_timeline('TWITTER_USER', count: 200) | |
client.destroy_status(tweets) | |
# Delete the 200 latest favorites | |
favorites = client.favorites(count: 200) | |
client.unfavorite!(favorites) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment