Skip to content

Instantly share code, notes, and snippets.

@michenriksen
Created September 3, 2017 06:40
Show Gist options
  • Save michenriksen/e9c4fcd6c424bf203c24a46c696234ee to your computer and use it in GitHub Desktop.
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
#!/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