Changes to the compse yml and the way and amout of artikeltexte are delivered and taht not duplicates are displayed
This commit is contained in:
@@ -38,10 +38,16 @@ async function loadNews() {
|
||||
const lines = text.split("\n").map((line) => line.trim()).filter(Boolean);
|
||||
|
||||
const items = [];
|
||||
const seen = new Set();
|
||||
for (const line of lines) {
|
||||
try {
|
||||
const parsed = JSON.parse(line);
|
||||
const fallbackTitle = stripTags(parsed.title);
|
||||
const id = parsed.id || parsed.link || fallbackTitle || `idx:${items.length}`;
|
||||
if (seen.has(id)) continue;
|
||||
seen.add(id);
|
||||
items.push({
|
||||
id,
|
||||
title: stripTags(parsed.title),
|
||||
text: stripTags(parsed.text),
|
||||
link: parsed.link,
|
||||
@@ -49,7 +55,7 @@ async function loadNews() {
|
||||
} catch (err) {
|
||||
console.warn("NDJSON parse error", err);
|
||||
}
|
||||
if (items.length >= 60) break;
|
||||
if (items.length >= 20) break;
|
||||
}
|
||||
|
||||
newsContainer.innerHTML = "";
|
||||
|
||||
Reference in New Issue
Block a user