Created
September 3, 2017 06:40
-
-
Save michenriksen/e9c4fcd6c424bf203c24a46c696234ee to your computer and use it in GitHub Desktop.
Quick Ruby script to generate a Twitter search URL combining Tweets from multiple users
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
#!/usr/bin/env ruby | |
require "cgi" | |
BASE_URI = "https://twitter.com/search?f=tweets".freeze | |
if ARGV.empty? | |
puts "USAGE: tweeter_feed screenname1 [screenname2] ... [screennameN]" | |
exit 1 | |
end | |
screen_names = ARGV.map do |arg| | |
screen_name = arg.strip | |
if screen_name.start_with?("@") | |
screen_name = screen_name[1..-1] | |
end | |
screen_name | |
end | |
query = screen_names.map { |sn| "from:#{sn}" }.join(" OR ") | |
puts "#{BASE_URI}&q=#{CGI.escape(query)}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment