fix(parser): handle missing results table in GoodReads search and log a warning (#2187)

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
This commit is contained in:
Balázs Szücs
2026-01-07 14:16:57 -07:00
committed by GitHub
parent 13a617a9e9
commit 251fe65ec0
@@ -478,10 +478,15 @@ public class GoodReadsParser implements BookParser {
try {
String searchUrl = generateSearchUrl(searchTerm);
Elements previewBooks = fetchDoc(searchUrl)
.select("table.tableList")
.first()
.select("tr[itemtype=http://schema.org/Book]");
Document doc = fetchDoc(searchUrl);
Element tableList = doc.select("table.tableList").first();
if (tableList == null) {
log.warn("GoodReads: No results table found for search term: {}", searchTerm);
return Collections.emptyList();
}
Elements previewBooks = tableList.select("tr[itemtype=http://schema.org/Book]");
List<BookMetadata> metadataPreviews = new ArrayList<>();
FuzzyScore fuzzyScore = new FuzzyScore(Locale.ENGLISH);