From a2d7a52e25115b9ab73ae7fac71e5ff4380c2b76 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 13 Jun 2017 23:19:32 +0200 Subject: [PATCH] Update comic filter for SMBC --- .../SaturdayMorningBreakfastCerealComicFilter.java | 4 +- ...urdayMorningBreakfastCerealComicFilterTest.java | 6 +- .../comics/saturday-morning-breakfast-cereal.html | 410 +++++++++++++-------- 3 files changed, 261 insertions(+), 159 deletions(-) diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilter.java b/src/main/java/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilter.java index fc5c4d9..7f4bc15 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilter.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilter.java @@ -43,14 +43,14 @@ public class SaturdayMorningBreakfastCerealComicFilter extends ComicSiteFilter { @Override protected List extractImageUrls(Document document) { - String imageUrl = document.select("img#comic").get(0).attr("src"); + String imageUrl = document.select("img#cc-comic").get(0).attr("src"); String afterImageUrl = document.select("#aftercomic img").attr("src"); return FluentIterable.from(Arrays.asList(imageUrl, afterImageUrl)).filter(url -> url.length() > 0).toList(); } @Override protected List extractImageComments(Document document) { - String imageComment = document.select("img#comic").get(0).attr("title"); + String imageComment = document.select("img#cc-comic").get(0).attr("title"); return Arrays.asList(imageComment, ""); } diff --git a/src/test/java/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilterTest.java b/src/test/java/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilterTest.java index 25e4e28..947ef15 100644 --- a/src/test/java/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilterTest.java +++ b/src/test/java/net/pterodactylus/rhynodge/filters/comics/SaturdayMorningBreakfastCerealComicFilterTest.java @@ -42,9 +42,9 @@ public class SaturdayMorningBreakfastCerealComicFilterTest { Comic comic = comicState.comics().get(0); MatcherAssert.assertThat(comic.title(), Matchers.is("")); MatcherAssert.assertThat(comic.strips(), Matchers.hasSize(2)); - MatcherAssert.assertThat(comic.strips().get(0).imageUrl(), Matchers.is("http://www.smbc-comics.com/comics/1430750631-20150504.png")); - MatcherAssert.assertThat(comic.strips().get(0).comment(), Matchers.is("And they say there's no use for a liberal arts degree!")); - MatcherAssert.assertThat(comic.strips().get(1).imageUrl(), Matchers.is("http://smbc-comics.com/comics/1430750631-20150504after.png")); + MatcherAssert.assertThat(comic.strips().get(0).imageUrl(), Matchers.is("http://www.smbc-comics.com/comics/1496144390-soonish6%20(1).png")); + MatcherAssert.assertThat(comic.strips().get(0).comment(), Matchers.is("It's not an old man rant if you put it in the mouths of children!")); + MatcherAssert.assertThat(comic.strips().get(1).imageUrl(), Matchers.is("http://smbc-comics.com/comics/1496144435-soonish6after.png")); MatcherAssert.assertThat(comic.strips().get(1).comment(), Matchers.is("")); } diff --git a/src/test/resources/net/pterodactylus/rhynodge/filters/comics/saturday-morning-breakfast-cereal.html b/src/test/resources/net/pterodactylus/rhynodge/filters/comics/saturday-morning-breakfast-cereal.html index ff32f72..0ee18ee 100644 --- a/src/test/resources/net/pterodactylus/rhynodge/filters/comics/saturday-morning-breakfast-cereal.html +++ b/src/test/resources/net/pterodactylus/rhynodge/filters/comics/saturday-morning-breakfast-cereal.html @@ -1,27 +1,80 @@ - - - + + + + + + - Saturday Morning Breakfast Cereal - + + Saturday Morning Breakfast Cereal - Moody + + + + + + + - - + + - + +
-
+