Compare commits

...

2 Commits

Author SHA1 Message Date
rov
1aa6a39c96 Merge pull request 'feat: update image selection logic in BatoProvider for chapter pages' (#20) from feature/bato into main
All checks were successful
ci/woodpecker/push/pipeline Pipeline was successful
Reviewed-on: #20
2025-11-14 08:32:30 -03:00
08ad47a875 feat: update image selection logic in BatoProvider for chapter pages
All checks were successful
ci/woodpecker/push/pipeline Pipeline was successful
ci/woodpecker/pr/pipeline Pipeline was successful
2025-11-14 08:22:48 -03:00

View File

@ -59,14 +59,19 @@ public class BatoProvider implements ContentProvider {
webScrapperClientProxyService.scrapeToJsoupDocument(
"https://battwo.com" + chapterUrl + "?load=2");
var imgElements = document.select("img[src*='media/mbch']");
// Select all chapter page images
var imgElements = document.select("img.z-10.w-full.h-full");
List<String> imageUrls = new ArrayList<>();
for (var img : imgElements) {
String src = img.attr("src");
if (src.startsWith("http") && src.contains("/media/mbch/")) {
imageUrls.add(src);
// Normalize if needed
if (!src.startsWith("http")) {
src = "https://battwo.com" + src;
}
imageUrls.add(src);
}
return IntStream.range(0, imageUrls.size())
@ -74,6 +79,7 @@ public class BatoProvider implements ContentProvider {
.collect(
Collectors.toMap(
i -> i, imageUrls::get, (existing, replacement) -> existing, LinkedHashMap::new));
} catch (Exception e) {
log.warn(e.getMessage());
return null;