Guest User

Untitled

a guest
Jul 17th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #!/opt/local/bin/ruby
  2. # -*- encoding: utf-8 -*-
  3.  
  4. require 'twitter'
  5.  
  6. APP_TAKEN = [ "あぷりのとーくん", "あぷりのしーくれっと" ]
  7. PIN_CODE = 42
  8.  
  9. def get_atoken(oauth)
  10. request_token = oauth.customer.get_request_token
  11. return request_token.get_acccess_token( :oauth_verifier => PIN_CODE )
  12. end
  13.  
  14.  
  15. oauth = Twitter::OAuth.new( *APP_TOKEN )
  16. atoken = get_atoken( oauth )
  17. user_atoken = [ "#{atoken.token}", "#{atoken.secret}" ]
  18. oauth.authorize_from_access( *user_token )
  19. # ついったーアカウントを作成します。
  20. account = Twitter::Base.new( get_oauth )
  21. # TL を取得します。
  22. timeline = account.friends_timeline
  23.  
  24. account.update( "うふふ…" )
Add Comment
Please, Sign In to add comment