From 7c63e0bed9c605f0ce35eef4b05d68676bb0ed29 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Fri, 15 Nov 2024 12:15:46 +0100 Subject: backend/plugins: Have exhentai assume no censorship for non-h Non-H usually has nothing to censor, so this should be a safe default. We have not come across anything where this would have been a false positive. --- src/hircine/plugins/scrapers/handlers/exhentai.py | 3 +++ tests/plugins/scrapers/test_handlers.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hircine/plugins/scrapers/handlers/exhentai.py b/src/hircine/plugins/scrapers/handlers/exhentai.py index 33733be..7bffc4f 100644 --- a/src/hircine/plugins/scrapers/handlers/exhentai.py +++ b/src/hircine/plugins/scrapers/handlers/exhentai.py @@ -59,6 +59,9 @@ class ExHentaiHandler: yield Censorship(enums.Censorship.NONE) else: yield Censorship(enums.Censorship.BAR) + else: + if not self.has_censorship_tag: + yield Censorship(enums.Censorship.NONE) if self.is_likely_rtl: yield Direction(enums.Direction.RIGHT_TO_LEFT) diff --git a/tests/plugins/scrapers/test_handlers.py b/tests/plugins/scrapers/test_handlers.py index e9f5d0e..4e71041 100644 --- a/tests/plugins/scrapers/test_handlers.py +++ b/tests/plugins/scrapers/test_handlers.py @@ -404,12 +404,12 @@ def test_exhentai_non_h(): assert set(scraper.collect()) == set( [ Artist(name="shimahara"), + Censorship(value=enums.Censorship.NONE), + Circle(name="animachine"), Date(value=date(2017, 2, 4)), Language(value=enums.Language.EN), OriginalTitle(value="嫌な顔されながらおパンツ見せてもらいたい漫画"), Rating(value=enums.Rating.QUESTIONABLE), - World(name="iya na kao sare nagara opantsu misete moraitai"), - Circle(name="animachine"), Tag(namespace="female", tag="femdom"), Tag(namespace="female", tag="schoolgirl uniform"), Tag(namespace="other", tag="full color"), @@ -417,6 +417,7 @@ def test_exhentai_non_h(): value="A manga about girl showing you her panties while making a disgusted face" # noqa: E501 ), URL("https://exhentai.org/g/1025913/fdaabef1a2"), + World(name="iya na kao sare nagara opantsu misete moraitai"), ] ) @@ -517,6 +518,7 @@ def test_exhentai_sanitizes(text, sanitized): {"category": "non-h"}, set( [ + Censorship(value=enums.Censorship.NONE), Rating(value=enums.Rating.QUESTIONABLE), ] ), @@ -525,6 +527,7 @@ def test_exhentai_sanitizes(text, sanitized): {"category": "western", "tags": ["other:western non-h"]}, set( [ + Censorship(value=enums.Censorship.NONE), Rating(value=enums.Rating.QUESTIONABLE), ] ), -- cgit v1.2.3-2-gb3c3