Created
October 24, 2012 14:33
-
-
Save nefo-mi/3946411 to your computer and use it in GitHub Desktop.
userstreamからurlが含まれるツイートだけ収集する
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 | |
# -*- encoding: utf-8 -*- | |
require 'user_stream' | |
require 'yaml' | |
require 'uri' | |
config_path = File.expand_path(File.dirname(__FILE__) + '/config.yml') | |
stream_config = YAML.load_file(config_path) | |
UserStream.configure do |config| | |
config.consumer_key = stream_config[:consumer_key] | |
config.consumer_secret = stream_config[:consumer_secret] | |
config.oauth_token = stream_config[:oauth_token] | |
config.oauth_token_secret = stream_config[:oauth_token_secret] | |
end | |
client = UserStream.client | |
client.user do |status| | |
if status.has_key? "text" | |
if status.text =~ URI.regexp | |
puts status.text | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment