Created
November 28, 2010 04:23
-
-
Save niku/718586 to your computer and use it in GitHub Desktop.
指定したidのリストを削除する
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 '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