Created
December 22, 2014 08:18
-
-
Save mactkg/fb607c3cb9e0830569a0 to your computer and use it in GitHub Desktop.
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
source "https://rubygems.org" | |
require 'twitter' | |
require 'terminal-notifier' |
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
require 'twitter' | |
require 'terminal-notifier' | |
topics = ["#CG基礎"] | |
client = Twitter::Streaming::Client.new do |config| | |
config.consumer_key = "" | |
config.consumer_secret = "" | |
config.access_token = "" | |
config.access_token_secret = "" | |
end | |
# twitter api configuring | |
puts "ready" | |
puts "query:#{topics}" | |
# filetering | |
client.filter(:track => topics.join(",")) do |object| | |
if object.is_a?(Twitter::Tweet) then | |
uri = object.user.profile_image_uri :normal | |
puts "#{object.user.name} said \"#{object.text}\"" | |
TerminalNotifier.notify(object.text, title: object.user.name, appIcon: uri) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment