✨ Update Business Cat filter
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 20 Sep 2020 16:26:07 +0000 (18:26 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 20 Sep 2020 16:26:07 +0000 (18:26 +0200)
src/main/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilter.java
src/test/java/net/pterodactylus/rhynodge/filters/comics/BusinessCatComicFilterTest.java

index 7b75008..397c261 100644 (file)
@@ -18,13 +18,13 @@ public class BusinessCatComicFilter extends ComicSiteFilter {
 
        @Override
        protected Optional<String> extractTitle(Document document) {
-               String title = document.select("#comic img").attr("title");
+               String title = document.select(".comic-title h2").text();
                return title.isEmpty() ? Optional.<String>absent() : Optional.of(title);
        }
 
        @Override
        protected List<String> extractImageUrls(Document document) {
-               return Arrays.asList(document.select("#comic img").attr("src"));
+               return Arrays.asList(document.select(".comic-image img").attr("src"));
        }
 
        @Override
index 7fb08b3..c61957a 100644 (file)
@@ -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