From 6f17a664e95f51ba0a62c2b90596e793eee1270e Mon Sep 17 00:00:00 2001 From: Toks Date: Sun, 6 Sep 2015 23:36:34 -0400 Subject: [PATCH] Fix deviantart source strategy not working for mature works --- app/logical/sources/strategies/deviant_art.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/logical/sources/strategies/deviant_art.rb b/app/logical/sources/strategies/deviant_art.rb index 9a322db21..42023befd 100644 --- a/app/logical/sources/strategies/deviant_art.rb +++ b/app/logical/sources/strategies/deviant_art.rb @@ -105,7 +105,17 @@ module Sources end def agent - @agent ||= Mechanize.new + @agent ||= begin + mech = Mechanize.new + + # This cookie needs to be set to allow viewing of mature works + cookie = Mechanize::Cookie.new("agegate_state", "1") + cookie.domain = ".deviantart.com" + cookie.path = "/" + mech.cookie_jar.add(cookie) + + mech + end end end end