Last active
August 29, 2015 14:07
-
-
Save denysonique/5079ccbd6a3659498b0e 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
From 68641f096d2a48ee3e1dfabd17c455a3a8d397c4 Mon Sep 17 00:00:00 2001 | |
From: denysonique <[email protected]> | |
Date: Sun, 12 Oct 2014 02:46:57 +0100 | |
Subject: [PATCH] implement Config[:scrape][:url_blacklist] blacklisting | |
--- | |
plugins/scrape.rb | 4 ++++ | |
1 file changed, 4 insertions(+) | |
diff --git a/plugins/scrape.rb b/plugins/scrape.rb | |
index 0a2f92a..0dc8363 100644 | |
--- a/plugins/scrape.rb | |
+++ b/plugins/scrape.rb | |
@@ -37,6 +37,10 @@ Client.register_trigger("PRIVMSG") do |msg| | |
return 0 if msg[:params][1].nil? | |
msg[:params][1].split.each do |word| | |
return 0 if word =~ /notitle/ | |
+ return 0 if Config[:scrape][:url_blacklist].any? do |url| | |
+ url = Regexp.new Regexp.escape(url) unless url.is_a? Regexp | |
+ word =~ url | |
+ end | |
if word =~ /^https?:\/\// then | |
original_url = word | |
if word =~ /4cdn[.]org/ then | |
-- | |
1.9.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example config setup: