From: David ‘Bombe’ Roden Date: Tue, 13 Jun 2017 21:19:32 +0000 (+0200) Subject: Update comic filter for SMBC X-Git-Tag: v2~104 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a2d7a52e25115b9ab73ae7fac71e5ff4380c2b76;p=rhynodge.git Update comic filter for SMBC --- 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 + + + + + + + - - + + - + +
-
+