From 8e75b9568229d1014de1485a348251d84f738daa Mon Sep 17 00:00:00 2001 From: Daniel Muckerman Date: Fri, 2 Feb 2018 13:35:29 -0500 Subject: [PATCH] update to cgi escape html --- slack-pixiv.rb | 2 +- slack-pixiv/commands/illust.rb | 2 +- slack-pixiv/commands/member.rb | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/slack-pixiv.rb b/slack-pixiv.rb index 2a8cec7..f5bbb2e 100644 --- a/slack-pixiv.rb +++ b/slack-pixiv.rb @@ -2,7 +2,7 @@ require 'slack-ruby-bot' require 'wolfram' require 'mechanize' require 'nokogiri' -require 'uri' +require 'cgi' require 'slack-pixiv/commands/illust' require 'slack-pixiv/commands/member' require 'slack-pixiv/app' diff --git a/slack-pixiv/commands/illust.rb b/slack-pixiv/commands/illust.rb index ba765e6..e4bb17c 100644 --- a/slack-pixiv/commands/illust.rb +++ b/slack-pixiv/commands/illust.rb @@ -15,7 +15,7 @@ module SlackMathbot else pixiv_url = "http://www.pixiv.net/member_illust.php" + _match[:url][0..-1] end - pixiv_url = URI.unescape(pixiv_url) + pixiv_url = CGI.unescapeHTML(pixiv_url) puts pixiv_url # Create iOS Illustration URL, regex pixiv_url to diff --git a/slack-pixiv/commands/member.rb b/slack-pixiv/commands/member.rb index 643277e..3f70715 100644 --- a/slack-pixiv/commands/member.rb +++ b/slack-pixiv/commands/member.rb @@ -8,7 +8,8 @@ module SlackMathbot agent = Mechanize.new pixiv_url = "http://www.pixiv.net/member.php" + _match[:url][0..-2] - + pixiv_url = CGI.unescapeHTML(pixiv_url) + puts pixiv_url # Scrape page title title = agent.get(pixiv_url).title