From 09dfab1f0d922613e6df4bb00c78277f20922827 Mon Sep 17 00:00:00 2001 From: evazion Date: Tue, 23 Aug 2022 22:31:14 -0500 Subject: [PATCH] hentai foundry: update url for Hentai Foundry tags. Change the URL used for Hentai Foundry tags from: https://www.hentai-foundry.com/search/index?query=elf&search_in=keywords to: https://www.hentai-foundry.com/pictures/tagged/elf --- app/logical/source/extractor/hentai_foundry.rb | 4 ++-- test/unit/sources/hentai_foundry_test.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/logical/source/extractor/hentai_foundry.rb b/app/logical/source/extractor/hentai_foundry.rb index d3499ae14..a36aeeb99 100644 --- a/app/logical/source/extractor/hentai_foundry.rb +++ b/app/logical/source/extractor/hentai_foundry.rb @@ -36,10 +36,10 @@ module Source end def tags - tags = page&.search(".boxbody [rel='tag']") || [] + tags = page&.search(".boxbody [rel='tag']").to_a.map(&:text) tags.map do |tag| - [tag.text, URI.join(page_url, tag.attr("href")).to_s] + [tag, "https://www.hentai-foundry.com/pictures/tagged/#{CGI.escape(tag)}"] end end diff --git a/test/unit/sources/hentai_foundry_test.rb b/test/unit/sources/hentai_foundry_test.rb index a761c524d..858c9ff9b 100644 --- a/test/unit/sources/hentai_foundry_test.rb +++ b/test/unit/sources/hentai_foundry_test.rb @@ -39,8 +39,8 @@ module Sources end should "get the tags" do - assert_equal([["elf", "https://www.hentai-foundry.com/search/index?query=elf&search_in=keywords"]], @image_1.tags) - assert_equal([["elf", "https://www.hentai-foundry.com/search/index?query=elf&search_in=keywords"]], @image_2.tags) + assert_equal([["elf", "https://www.hentai-foundry.com/pictures/tagged/elf"]], @image_1.tags) + assert_equal([["elf", "https://www.hentai-foundry.com/pictures/tagged/elf"]], @image_2.tags) end should "find the correct artist" do