From 5946544f71a63093103ae71d055a6b449b8c11a7 Mon Sep 17 00:00:00 2001 From: nonamethanks Date: Sat, 30 Oct 2021 17:22:45 +0200 Subject: [PATCH] Lofter: Add support for additional theme --- app/logical/sources/strategies/lofter.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/logical/sources/strategies/lofter.rb b/app/logical/sources/strategies/lofter.rb index c5c136365..0e12b582b 100644 --- a/app/logical/sources/strategies/lofter.rb +++ b/app/logical/sources/strategies/lofter.rb @@ -12,6 +12,7 @@ # * https://gengar563.lofter.com/post/1e82da8c_1c98dae1b # * https://yuli031458.lofter.com/post/3163d871_1cbdc5f6d (different theme/css selectors) # * https://ssucrose.lofter.com/post/1d30f3e4_1cc58e9f0 (another different theme) +# * https://zuodaoxing.lofter.com/post/30b9c9c3_1cd15b686 (another theme) # # Profile URLs # @@ -79,10 +80,18 @@ module Sources tags.to_a.map do |tag| [tag.text.gsub(/^● /, ""), tag.attr("href")] end + + if tags.blank? + tags = page&.search(".main .tags a").to_a.map do |tag| + [tag.text.gsub(/^#/, ""), tag.attr("href")] + end + end + + tags end def artist_commentary_desc - page&.search(".ct .text, .content .text").to_a.compact.first&.to_html + page&.search(".ct .text, .content .text, .posts .photo .text").to_a.compact.first&.to_html end def normalize_for_source