Guest User

Untitled

a guest
Jul 15th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. require 'yaml'
  3. require 'logger'
  4. require 'net/http'
  5. require 'twitter'
  6.  
  7. LOG = Logger.new('log')
  8. LISTS = [22926920, 22919856, 22917276, 22914957, 22912272, 22898839]
  9. USER= 'niku_name'
  10.  
  11. ACCOUNT = YAML.load_file('account.yaml')
  12. Twitter.configure do |config|
  13. config.consumer_key = ACCOUNT['consumer']['key']
  14. config.consumer_secret = ACCOUNT['consumer']['secret']
  15. config.oauth_token = ACCOUNT['access']['key']
  16. config.oauth_token_secret = ACCOUNT['access']['secret']
  17. end
  18. @client = Twitter::Client.new
  19.  
  20. begin
  21. LISTS.each do |list_id|
  22. LOG.info "#{list_id} 削除中..."
  23. @client.list_delete(USER, list_id)
  24. LOG.info "#{list_id} 削除完了"
  25. end
  26. rescue
  27. LOG.warn $!
  28. ensure
  29. LOG.info "残り #{@client.lists(USER).lists.map{ |l| l.name }}"
  30. end
Add Comment
Please, Sign In to add comment