From 9f3f302328ee86ab0d4b6aabae3f68ea730bd432 Mon Sep 17 00:00:00 2001 From: nonamethanks Date: Sun, 6 Nov 2022 00:03:15 +0100 Subject: [PATCH] Lofter: support another theme Fixes #5334. --- app/logical/source/extractor/lofter.rb | 1 + test/unit/sources/lofter_test.rb | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/app/logical/source/extractor/lofter.rb b/app/logical/source/extractor/lofter.rb index 917627de8..8253616d4 100644 --- a/app/logical/source/extractor/lofter.rb +++ b/app/logical/source/extractor/lofter.rb @@ -49,6 +49,7 @@ module Source ".content .text", ".posts .photo .text", "#post .description", + ".m-post .cont .text", ] page&.search(commentary_selectors.join(", ")).to_a.compact.first&.to_html end diff --git a/test/unit/sources/lofter_test.rb b/test/unit/sources/lofter_test.rb index a3014769f..065c18f6d 100644 --- a/test/unit/sources/lofter_test.rb +++ b/test/unit/sources/lofter_test.rb @@ -47,6 +47,17 @@ module Sources ) end + context "A lofter post with commentary under <.m-post .cont .text>" do + strategy_should_work( + "https://qiuchenghanshuang.lofter.com/post/1f9d6464_2b736607b", + image_urls: [ + "https://imglf4.lf127.net/img/68d1578576f2e8a0/akFYeFo0L0VFMno5d0JuNHlwQ3VMdEFxYysyN1ZseVduNzFkbG9MdUlFVT0.jpg", + "https://imglf6.lf127.net/img/9970d5715bd5f72a/akFYeFo0L0VFMno5d0JuNHlwQ3VMZ3QxbkttTHpHZERWZXlVS3FDNmtYcz0.jpg", + ], + dtext_artist_commentary_desc: /过去与她擦肩而过/ + ) + end + context "A dead link" do strategy_should_work( "https://gxszdddd.lofter.com/post/322595b1_1ca5e6f66",