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