From 22fd90c62c7935d999f2c4c6626666515fbfb5b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 20 Apr 2013 11:44:42 +0200 Subject: [PATCH] Girl Genius may have multiple images. --- .../rhynodge/filters/comics/GirlGeniusComicFilter.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 -- 2.7.4