From: David ‘Bombe’ Roden Date: Sun, 20 Sep 2020 16:26:07 +0000 (+0200) Subject: ✨ Update Business Cat filter X-Git-Tag: v2~83 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=299bab161526c62a3274860c5a81de8caac9f695;p=rhynodge.git ✨ Update Business Cat filter --- diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilter.java b/src/main/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilter.java index 7b75008..397c261 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilter.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilter.java @@ -18,13 +18,13 @@ public class BusinessCatComicFilter extends ComicSiteFilter { @Override protected Optional extractTitle(Document document) { - String title = document.select("#comic img").attr("title"); + String title = document.select(".comic-title h2").text(); return title.isEmpty() ? Optional.absent() : Optional.of(title); } @Override protected List extractImageUrls(Document document) { - return Arrays.asList(document.select("#comic img").attr("src")); + return Arrays.asList(document.select(".comic-image img").attr("src")); } @Override diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.java index 7fb08b3..c61957a 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.java @@ -19,17 +19,17 @@ public class BusinessCatComicFilterTest { private final Document document; public BusinessCatComicFilterTest() throws IOException { - document = ResourceLoader.loadDocument(getClass(), "business-cat.html", "http://www.businesscat.happyjar.com//"); + document = ResourceLoader.loadDocument(getClass(), "business-cat.html", "https://www.businesscatcomic.com/"); } @Test public void imageTitleCanBeExtracted() { - MatcherAssert.assertThat(filter.extractTitle(document), Matchers.is(Optional.of("Running Late"))); + MatcherAssert.assertThat(filter.extractTitle(document), Matchers.is(Optional.of("Full Circle"))); } @Test public void imageUrlsCanBeExtracted() { - MatcherAssert.assertThat(filter.extractImageUrls(document), Matchers.contains("http://www.businesscat.happyjar.com/wp-content/uploads/2015/01/2015-01-23-Running-Late.png")); + MatcherAssert.assertThat(filter.extractImageUrls(document), Matchers.contains("https://www.businesscatcomic.com/wp-content/uploads/2019/11/2018-09-07-Full-Circle.png")); } @Test