From: David ‘Bombe’ Roden Date: Mon, 25 Feb 2013 05:55:11 +0000 (+0100) Subject: Add a method to comic filters to allow extracting image comments. X-Git-Tag: v2~315 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=18f582bf98ae3957f1ba55a024961c1519eed54e;p=rhynodge.git Add a method to comic filters to allow extracting image comments. This will be used by the upcoming xkcd filter. --- diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/ComicSiteFilter.java b/src/main/java/net/pterodactylus/rhynodge/filters/ComicSiteFilter.java index fb01349..fec856c 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/ComicSiteFilter.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/ComicSiteFilter.java @@ -86,4 +86,16 @@ public abstract class ComicSiteFilter implements Filter { */ protected abstract List extractImageUrls(Document document); + /** + * Extracts the image comments from the given document. The elements of this + * last and of the list returned by {@link #extractImageUrls(org.jsoup.nodes.Document)} + * are paired up and added as {@link Strip}s. If the list returned by this + * method has less elements, an empty string is used for the remaining images. + * + * @param document + * The document to extract the image comments from + * @return The extracted image comments + */ + protected abstract List extractImageComments(Document document); + } diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilter.java b/src/main/java/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilter.java index 600257f..76089e3 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilter.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/comics/SinfestComicFilter.java @@ -67,4 +67,9 @@ public class SinfestComicFilter extends ComicSiteFilter { }).toList() : Collections.emptyList(); } + @Override + protected List extractImageComments(Document document) { + return Collections.emptyList(); + } + }