Last active
August 22, 2019 00:29
-
-
Save jpmckinney/5686265 to your computer and use it in GitHub Desktop.
Revisions
-
James McKinney revised this gist
May 31, 2013 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,15 +20,15 @@ def all_list_members(list_owner_username, slug) users end def all_friends(user) users = [] cursor = -1 while cursor.nonzero? response = Twitter.friends(user, :cursor => cursor) users += response.users cursor = response.next_cursor end users end CSV.open('list.csv', 'w') do |csv| -
James McKinney revised this gist
May 31, 2013 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,17 @@ def all_list_members(list_owner_username, slug) users end def all_followers(user) followers = [] cursor = -1 while cursor.nonzero? response = Twitter.followers(user, :cursor => cursor) followers += response.users cursor = response.next_cursor end followers end CSV.open('list.csv', 'w') do |csv| csv << %w(ID Name ScreenName Location Description URL) all_list_members('verified', 'politics').each do |user| -
James McKinney created this gist
May 31, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ require 'csv' require 'twitter' Twitter.configure do |config| config.consumer_key = '' config.consumer_secret = '' config.oauth_token = '' config.oauth_token_secret = '' end def all_list_members(list_owner_username, slug) users = [] cursor = -1 while cursor.nonzero? response = Twitter.list_members(list_owner_username, slug, :cursor => cursor) users += response.users cursor = response.next_cursor end users end CSV.open('list.csv', 'w') do |csv| csv << %w(ID Name ScreenName Location Description URL) all_list_members('verified', 'politics').each do |user| url = user.attrs[:entities][:url] csv << [ user.id, user.screen_name, user.name, user.location, user.description, url && url[:urls][0][:expanded_url], ] end end