diff --git a/pom.xml b/pom.xml index d9a83279..02277212 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ 1.5.5.Final 9.31 1.9.0 - 1.4.0 + 1.4.1 1.6.1 5.2.1 1.1.6.RELEASE diff --git a/sandside/src/main/java/fr/ght1pc9kc/baywatch/scraper/domain/filters/OpenGraphFilter.java b/sandside/src/main/java/fr/ght1pc9kc/baywatch/scraper/domain/filters/OpenGraphFilter.java index 8104c3b9..5ffab08c 100644 --- a/sandside/src/main/java/fr/ght1pc9kc/baywatch/scraper/domain/filters/OpenGraphFilter.java +++ b/sandside/src/main/java/fr/ght1pc9kc/baywatch/scraper/domain/filters/OpenGraphFilter.java @@ -71,15 +71,23 @@ private RawNews handleMetaData(RawNews news, Metas metas) { raw = raw.withTitle(metas.title()); } + if (!metas.errors().isEmpty()) { + metas.errors().forEach(e -> log.atDebug() + .addArgument(e.getLocalizedMessage()) + .addArgument(news.link()) + .setMessage("Error when parsing headers: {} on {}") + .log()); + } OpenGraph og = metas.og(); if (nonNull(og) && !og.isEmpty()) { - raw = Optional.ofNullable(og.title).map(raw::withTitle).orElse(raw); - raw = Optional.ofNullable(og.description).map(raw::withDescription).orElse(raw); - raw = Optional.ofNullable(og.image) + raw = Optional.ofNullable(og.title()).map(raw::withTitle).orElse(raw); + raw = Optional.ofNullable(og.description()).map(raw::withDescription).orElse(raw); + raw = Optional.ofNullable(og.image()) .filter(i -> SUPPORTED_SCHEMES.contains(i.getScheme())) .map(raw::withImage).orElse(raw); } else { - log.debug("No OG meta found for {}", news.link()); + log.atDebug().addArgument(news.link()) + .setMessage("No OG meta found for {}").log(); } if (nonNull(links) && isNull(raw.image())) { diff --git a/sandside/src/test/java/fr/ght1pc9kc/baywatch/scraper/domain/filters/OpenGraphFilterTest.java b/sandside/src/test/java/fr/ght1pc9kc/baywatch/scraper/domain/filters/OpenGraphFilterTest.java index fba7b72b..e8689bde 100644 --- a/sandside/src/test/java/fr/ght1pc9kc/baywatch/scraper/domain/filters/OpenGraphFilterTest.java +++ b/sandside/src/test/java/fr/ght1pc9kc/baywatch/scraper/domain/filters/OpenGraphFilterTest.java @@ -5,6 +5,7 @@ import fr.ght1pc9kc.scraphead.core.HeadScraper; import fr.ght1pc9kc.scraphead.core.http.ScrapRequest; import fr.ght1pc9kc.scraphead.core.model.Metas; +import fr.ght1pc9kc.scraphead.core.model.ex.HeadScrapingException; import fr.ght1pc9kc.scraphead.core.model.links.Links; import fr.ght1pc9kc.scraphead.core.model.opengraph.OpenGraph; import org.junit.jupiter.api.Assertions; @@ -49,8 +50,9 @@ void should_filter_opengraph() { .title("Opengraph title") .description("Opengraph description") .image(URI.create("https://open.graph.img/image.jpg")) - .build() - ).build() + .build()) + .error(new HeadScrapingException("Test error message")) + .build() )); StepVerifier.create(tested.filter(RAW)) diff --git a/seaside/src/techwatch/components/newslist/NewsCard.vue b/seaside/src/techwatch/components/newslist/NewsCard.vue index ca3182c9..c2fb4bbe 100644 --- a/seaside/src/techwatch/components/newslist/NewsCard.vue +++ b/seaside/src/techwatch/components/newslist/NewsCard.vue @@ -23,7 +23,7 @@
+ @click="$emit('clickTitle')" v-html="card.data.title">