From 810fff2ec276bde876f03874acfdbe853f493185 Mon Sep 17 00:00:00 2001 From: Robb Kidd Date: Tue, 4 Oct 2016 16:54:36 -0400 Subject: [PATCH] update protocol scheme for Reddit and provide a user-agent to avoid rate-limiting --- plugins/awwww.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/awwww.rb b/plugins/awwww.rb index dee0c14..a265a08 100644 --- a/plugins/awwww.rb +++ b/plugins/awwww.rb @@ -5,8 +5,8 @@ def initialize end def on_message(message, matches) - reddit = "http://www.reddit.com/r/aww.json" - doc = ActiveSupport::JSON.decode(open(reddit).read) + reddit = "https://www.reddit.com/r/aww.json" + doc = ActiveSupport::JSON.decode(open(reddit, "User-Agent"=>"Linkbot").read) url = doc["data"]["children"][rand(doc["data"]["children"].length)]["data"]["url"] # Check if it's an imgur link without an image extension