Created
June 7, 2015 04:22
-
-
Save khws4v1/eae84c4873339105183a 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
# coding: utf-8 | |
require "twitter" | |
def is_spam(tweet) | |
text = tweet.text | |
if /.*現在の価格.*現在の入札人数.*詳しくはコチラ!.*/m =~ text | |
true | |
elsif /.*現在価格:.*,入札数:.*,終了日時:.*/ =~ text | |
true | |
elsif /.*詳細はコチラ→.*#ヤフオク.*/m =~ text | |
true | |
else | |
false | |
end | |
end | |
stream = Twitter::Streaming::Client.new do |config| | |
config.consumer_key = "" | |
config.consumer_secret = "" | |
config.access_token = "" | |
config.access_token_secret = "" | |
end | |
rest = Twitter::REST::Client.new do |config| | |
config.consumer_key = "" | |
config.consumer_secret = "" | |
config.access_token = "" | |
config.access_token_secret = "" | |
end | |
stream.filter(track: "ヤフオク, applunch x0 to") do |object| | |
if object.is_a?(Twitter::Tweet) then | |
if is_spam(object) then | |
p object.user.id.to_s | |
t = Thread.new do | |
rest.block(object.user) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
使い方教えて下さい