From 299bab161526c62a3274860c5a81de8caac9f695 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 20 Sep 2020 18:26:07 +0200 Subject: [PATCH] =?utf8?q?=E2=9C=A8=20Update=20Business=20Cat=20filter?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../rhynodge/filters/comics/BusinessCatComicFilter.java | 4 ++-- .../rhynodge/filters/comics/BusinessCatComicFilterTest.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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 -- 2.7.4