From 92569ecab7f1761822bbf45fbf3e0a5a2ba69003 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 8 Mar 2024 15:50:14 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=90=9B=20Fix=20Chief=20O=E2=80=99Brian=20a?= =?utf8?q?t=20Work=20filter?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../comics/ChiefOBrienAtWorkComicFilter.java | 4 +- .../comics/ChiefOBrienAtWorkComicFilterTest.kt | 4 +- .../filters/comics/chief-obrien-at-work.html | 981 +++++++++++++-------- 3 files changed, 614 insertions(+), 375 deletions(-) diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilter.java b/src/main/java/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilter.java index 8ec8e21..5671bc4 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilter.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilter.java @@ -19,7 +19,7 @@ public class ChiefOBrienAtWorkComicFilter extends ComicSiteFilter { @Override protected List extractImageUrls(Document document) { - return Arrays.asList(document.select(".P .P-H .larger-width img").get(0).attr("src")); + return Arrays.asList(document.select("article a img.image").get(0).attr("src")); } @Override @@ -29,7 +29,7 @@ public class ChiefOBrienAtWorkComicFilter extends ComicSiteFilter { @Override protected Optional extractTitle(Document document) { - return Optional.fromNullable(document.select(".P-post .captions p").get(0).text()); + return Optional.fromNullable(document.select("article .caption p").get(0).text()); } } diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.kt index 61d5c31..d5a44b8 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/comics/ChiefOBrienAtWorkComicFilterTest.kt @@ -16,7 +16,7 @@ class ChiefOBrienAtWorkComicFilterTest { @Test fun `image url is parsed correctly`() { - assertThat(filter.extractImageUrls(document), contains("http://41.media.tumblr.com/db92f4218b8a100f216863ce980e19a9/tumblr_njaewe7vNU1tjd8fao1_1280.jpg")) + assertThat(filter.extractImageUrls(document), contains("https://64.media.tumblr.com/232470107c558ea4e1d37813fe2d083b/3bf229ad9e15b880-85/s2048x3072/a001c59dd84c4961266fd9e9574dc0ff497e1946.jpg")) } @Test @@ -26,7 +26,7 @@ class ChiefOBrienAtWorkComicFilterTest { @Test fun `comic titles are parsed correctly`() { - assertThat(filter.extractTitle(document), equalTo(Optional.of("EPISODE 60: Being Human"))) + assertThat(filter.extractTitle(document), equalTo(Optional.of("EPISODE 384: So Sorry"))) } private val filter = ChiefOBrienAtWorkComicFilter() diff --git a/src/test/resources/net/pterodactylus/rhynodge/filters/comics/chief-obrien-at-work.html b/src/test/resources/net/pterodactylus/rhynodge/filters/comics/chief-obrien-at-work.html index cb0485c..ab30189 100644 --- a/src/test/resources/net/pterodactylus/rhynodge/filters/comics/chief-obrien-at-work.html +++ b/src/test/resources/net/pterodactylus/rhynodge/filters/comics/chief-obrien-at-work.html @@ -1,371 +1,610 @@ - - - - - - - - - -CHIEF O'BRIEN AT WORK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHIEF O'BRIEN AT WORK
From the man who brought you Chief O’Brien after Star Trek brought you Chief O’Brien,
comes a comic for fans of space travel, dead-end jobs, and ennui.
- - - - -
- -
- -
- -
- - - - - - - - - - - - - - - -
- - - -
- - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + CHIEF O'BRIEN AT WORK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

+ + + + CHIEF O'BRIEN AT WORK + + + + + + +

+
+ + + +
+ +
+
+ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + +
+ + + +
+ + + + + + + +
+ +
+ + +
+ + + + + + -- 2.7.4