-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwitter-oauth.rb
38 lines (29 loc) · 1 KB
/
twitter-oauth.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env ruby
# coding: utf-8
#-----------------------------------------------------------------------------
# 「こばと。」 Twitter Bot
#
# 花戸小鳩 非公式bot
# https://twitter.com/ko_bot
#
# 2010/06/01 (for @ko_bot) Tetsuo Kawakami
#-----------------------------------------------------------------------------
require 'rubygems'
require 'oauth'
#require 'oauth-patch'
CONSUMER_KEY = 'XXXXXXXXXXXXXXXXX' # ←ここを書き換える
CONSUMER_SECRET = 'XXXXXXXXXXXXXX' # ←ここを書き換える
consumer = OAuth::Consumer.new(
CONSUMER_KEY,
CONSUMER_SECRET,
:site => 'http://twitter.com'
)
request_token = consumer.get_request_token
puts "Access this URL and approve => #{request_token.authorize_url}"
print "Input OAuth Verifier: "
oauth_verifier = gets.chomp.strip
access_token = request_token.get_access_token(
:oauth_verifier => oauth_verifier
)
puts "Access token: #{access_token.token}"
puts "Access token secret: #{access_token.secret}"