Created
November 13, 2013 12:23
-
-
Save unnitallman/7448221 to your computer and use it in GitHub Desktop.
Convert twitter username to user 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
Add the gem "twitter" to Gemfile. | |
client = Twitter::Client.new( | |
:consumer_key => "key", | |
:consumer_secret => "secret", | |
) | |
[8] pry(main) client.users("unnitallman")[0].id | |
=> 11976602 | |
[8] pry(main)> client.users("ershus")[0].id | |
=> 29364787 | |
client.users(["ershus","unnitallman"])[0].id | |
=> 29364787 | |
[3] pry(main)> client.users(["ershus","unnitallman"])[1].id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment