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
All checks were successful
ci/woodpecker/push/pipeline Pipeline was successful
Reviewed-on: #20
This commit is contained in:
commit
1aa6a39c96
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user