Skip to content

Instantly share code, notes, and snippets.

@niku
Created November 28, 2010 04:23
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 niku/718586 to your computer and use it in GitHub Desktop.
Save niku/718586 to your computer and use it in GitHub Desktop.
指定したidのリストを削除する
# -*- coding: utf-8 -*-
require 'yaml'
require 'logger'
require 'net/http'
require 'twitter'
LOG = Logger.new('log')
LISTS = [22926920, 22919856, 22917276, 22914957, 22912272, 22898839]
USER= 'niku_name'
ACCOUNT = YAML.load_file('account.yaml')
Twitter.configure do |config|
config.consumer_key = ACCOUNT['consumer']['key']
config.consumer_secret = ACCOUNT['consumer']['secret']
config.oauth_token = ACCOUNT['access']['key']
config.oauth_token_secret = ACCOUNT['access']['secret']
end
@client = Twitter::Client.new
begin
LISTS.each do |list_id|
LOG.info "#{list_id} 削除中..."
@client.list_delete(USER, list_id)
LOG.info "#{list_id} 削除完了"
end
rescue
LOG.warn $!
ensure
LOG.info "残り #{@client.lists(USER).lists.map{ |l| l.name }}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment