From: David ‘Bombe’ Roden Date: Sat, 20 Apr 2013 09:44:42 +0000 (+0200) Subject: Girl Genius may have multiple images. X-Git-Tag: v2~297 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=22fd90c62c7935d999f2c4c6626666515fbfb5b1;p=rhynodge.git Girl Genius may have multiple images. --- diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/comics/GirlGeniusComicFilter.java b/src/main/java/net/pterodactylus/rhynodge/filters/comics/GirlGeniusComicFilter.java index 1f26740..1bda719 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/comics/GirlGeniusComicFilter.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/comics/GirlGeniusComicFilter.java @@ -17,14 +17,16 @@ package net.pterodactylus.rhynodge.filters.comics; -import java.util.Arrays; import java.util.Collections; import java.util.List; import net.pterodactylus.rhynodge.filters.ComicSiteFilter; +import com.google.common.base.Function; import com.google.common.base.Optional; +import com.google.common.collect.FluentIterable; import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; import org.jsoup.select.Elements; /** @@ -42,7 +44,13 @@ public class GirlGeniusComicFilter extends ComicSiteFilter { @Override protected List extractImageUrls(Document document) { Elements imageElements = document.select("#MainTable img[alt=Comic]"); - return imageElements.hasAttr("src") ? Arrays.asList(imageElements.attr("src")) : Collections.emptyList(); + return imageElements.hasAttr("src") ? FluentIterable.from(imageElements).transform(new Function() { + + @Override + public String apply(Element imageElement) { + return imageElement.attr("src"); + } + }).toList() : Collections.emptyList(); } @Override