Created
July 29, 2011 10:48
-
-
Save SaitoWu/1113598 to your computer and use it in GitHub Desktop.
weibo client and twitter client, use weibo_oauth and twitter_oauth to get ur own oauth_token and oauth_token_secret
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' | |
Twitter.configure do |config| | |
config.consumer_key="8n30gzQJFwcexyrnbKFTqw" | |
config.consumer_secret="tzwvlxUyENhFEvX2bj0mDevSSLCMVNjY1zhM2O2Z5E" | |
config.oauth_token="34916016-Qph9S5HS2FyDcVIEYIraswexmYpBBRqnLoX6e1ncZ" | |
config.oauth_token_secret="8nkOjeYUK3RO5bRySz3YIYYiOc4mPxjxZM8GVoHDs" | |
end | |
client = Twitter::Client.new | |
client.update("update from twitter.rb") |
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_oauth' | |
client = TwitterOAuth::Client.new( | |
:consumer_key => '8n30gzQJFwcexyrnbKFTqw', | |
:consumer_secret => 'tzwvlxUyENhFEvX2bj0mDevSSLCMVNjY1zhM2O2Z5E' | |
) | |
request_token = client.request_token | |
puts "#{request_token.authorize_url}\n" | |
puts "Hit enter when you have completed authorization." | |
oauth_verifier = STDIN.readline.chomp | |
access_token = client.authorize( | |
request_token.token, | |
request_token.secret, | |
:oauth_verifier => oauth_verifier | |
) | |
puts "oauth_token : #{access_token.params[:oauth_token]}" | |
puts "oauth_token_secret : #{access_token.params[:oauth_token_secret]}" |
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 'weibo' | |
Weibo::Config.api_key = "2345921097" | |
Weibo::Config.api_secret = "4faf28b57f2d14986f2e83ec26545713" | |
atoken = "9411aa14icd103fb7a416189fb9x3cb6" | |
asecret = "23e4v31f4aaxd275d85e51734aceffff" | |
oauth = Weibo::OAuth.new(Weibo::Config.api_key, Weibo::Config.api_secret) | |
oauth.authorize_from_access(atoken, asecret) | |
Weibo::Base.new(oauth).update("update from weibo.rb") |
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 'weibo' | |
Weibo::Config.api_key = "2345921097" | |
Weibo::Config.api_secret = "4faf28b57f2d14986f2e83ec26545713" | |
oauth = Weibo::OAuth.new(Weibo::Config.api_key, Weibo::Config.api_secret) | |
request_token = oauth.consumer.get_request_token | |
puts "#{request_token.authorize_url}\n" | |
puts "Hit enter when you have completed authorization." | |
oauth_verifier = STDIN.readline.chomp | |
access_token = oauth.authorize_from_request( | |
request_token.token, | |
request_token.secret, | |
oauth_verifier | |
) | |
puts "oauth_token : #{access_token.first}" | |
puts "oauth_token_secret : #{access_token.last}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment