import java.net.URI;
import java.net.URISyntaxException;
+import java.util.Collections;
import java.util.List;
import net.pterodactylus.rhynodge.Filter;
List<String> imageComments = extractImageComments(htmlState.document());
/* store comic, if found, into state. */
- if (!title.isPresent() || imageUrls.isEmpty()) {
+ if (imageUrls.isEmpty()) {
return new FailedState();
}
- ComicState comicState = new ComicState();
- Comic comic = new Comic(title.get());
+ Comic comic = new Comic(title.or(""));
int imageCounter = 0;
for (String imageUrl : imageUrls) {
String imageComment = (imageCounter < imageComments.size()) ? imageComments.get(imageCounter) : "";
throw new IllegalStateException(String.format("Could not resolve image URL “%s” against base URL “%s”.", imageUrl, htmlState.uri()), use1);
}
}
- comicState.add(comic);
- return comicState;
+ return new ComicState(Collections.singletonList(comic));
}
//