feedkeeper 0.38.0 → 0.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/dist/feeds/content/patterns/boilerplate/de.js +4 -0
- package/server/dist/feeds/content/patterns/boilerplate/en.js +4 -0
- package/server/dist/feeds/content/patterns/boilerplate/ja.js +4 -0
- package/server/dist/feeds/contentNoise.js +50 -11
- package/server/package.json +1 -1
package/package.json
CHANGED
|
@@ -20,5 +20,9 @@ export const TRAILING = [
|
|
|
20
20
|
/^(?:Der Beitrag|Dieser Beitrag|Der Artikel|Dieser Artikel) .{3,200} (?:erschien|erschien zuerst|erschien erstmals) (?:zuerst )?(?:auf|bei) .{2,60}$/i,
|
|
21
21
|
/^Der Beitrag .{3,200} wurde (?:zuerst|erstmals) (?:auf|bei) .{2,60} veröffentlicht\.?$/i,
|
|
22
22
|
/^Diskutiere (?:diesen|den) (?:Artikel|Beitrag) .{0,40}$/i,
|
|
23
|
+
// Autoren-Follow-Zeilen am Artikelende.
|
|
24
|
+
/^(?:Folge|Folgen Sie)\s+[^.!?]{1,60}:\s*(?:X(?:\s*\/\s*Twitter)?|Twitter|Bluesky|Mastodon|Threads|Instagram|Facebook|YouTube|LinkedIn|TikTok|RSS)\b.{0,120}$/i,
|
|
25
|
+
// Verwaiste Empfehlungs-/Rubrik-Überschriften am Artikelende ohne nachfolgende Liste.
|
|
26
|
+
/^(?:Topaktuell|Mehr zum Thema|Weitere (?:Artikel|Meldungen)|Ähnliche Artikel|Verwandte Artikel|Auch interessant|Meistgelesen(?:e Artikel)?|Beliebte Artikel)$/i,
|
|
23
27
|
];
|
|
24
28
|
//# sourceMappingURL=de.js.map
|
|
@@ -17,5 +17,9 @@ export const TRAILING = [
|
|
|
17
17
|
/^(?:Tag|Tags|Buyer's Guides?|Related Forums?):.{0,200}$/i,
|
|
18
18
|
// The Verge: the box that offers to follow the story's topics and authors.
|
|
19
19
|
/^Follow topics and authors from this story\b.{0,200}$/i,
|
|
20
|
+
// Author social follow lines at the end of an article.
|
|
21
|
+
/^Follow [^.!?]{1,60}:\s*(?:X(?:\s*\/\s*Twitter)?|Twitter|Bluesky|Mastodon|Threads|Instagram|Facebook|YouTube|LinkedIn|TikTok|RSS)\b.{0,120}$/i,
|
|
22
|
+
// Orphaned recommendation headings at the end of an article when the list itself was stripped or empty.
|
|
23
|
+
/^(?:Top Stories|Trending(?: Now| Stories)?|More (?:Stories|Articles)|Related (?:Articles|Stories|Posts)|Most (?:Read|Popular)|Recommended(?: for you)?)$/i,
|
|
20
24
|
];
|
|
21
25
|
//# sourceMappingURL=en.js.map
|
|
@@ -16,5 +16,9 @@ export const TRAILING = [
|
|
|
16
16
|
/^(?:この記事|本記事|本稿).{3,120}(?:で初出|に初出|で公開|に掲載|転載).*$/i,
|
|
17
17
|
/^(?:この記事について(?:話し合う|語る|コメント)|コメントする)\b.{0,40}$/i,
|
|
18
18
|
/^(?:関連記事|トピック|タグ|関連タグ):.{0,200}$/i,
|
|
19
|
+
// Author social follow lines at the end of an article.
|
|
20
|
+
/^[^.!?。]{1,40}(?:をフォロー|のSNS)\s*[::]\s*(?:X(?:\s*\/\s*Twitter)?|Twitter|Bluesky|Mastodon|Threads|Instagram|Facebook|YouTube|LinkedIn|TikTok|RSS)\b.{0,120}$/i,
|
|
21
|
+
// Orphaned recommendation headings at the end of an article when the list itself was stripped or empty.
|
|
22
|
+
/^(?:関連記事|おすすめ記事|オススメ記事|人気の記事|人気記事|最新記事|新着記事|注目の記事)$/i,
|
|
19
23
|
];
|
|
20
24
|
//# sourceMappingURL=ja.js.map
|
|
@@ -61,8 +61,14 @@ const DATE_PREFIX = "(?:(?:stand|zuletzt aktualisiert|aktualisiert(?:\\s+am)?|ve
|
|
|
61
61
|
const DATE_PART = `(?:\\d{1,2}\\.\\s?\\d{1,2}\\.\\s?\\d{2,4}|\\d{1,2}\\.?\\s(?:${MONTHS})\\.?\\s\\d{4}|(?:${MONTHS})\\.?\\s\\d{1,2},?\\s\\d{4})`;
|
|
62
62
|
const DATE_ONLY = new RegExp(`^${DATE_PREFIX}${DATE_PART}${TIME_OF_DAY}$`, "iu");
|
|
63
63
|
/** The date at the end of a byline (`von Michael Bartl I 15.10.2026 - 11:41`): the author stays, the date is in the reader's head. */
|
|
64
|
-
const BYLINE = /^(von|by|text|autor(in)?|author|written by|words by|story by|report(ed)? by|posted by|photo(s)? by)\b/i;
|
|
64
|
+
const BYLINE = /^(?:(?:von|by|text|autor(?:in)?|author|written by|words by|story by|report(?:ed)? by|posted by|photo(?:s)? by)\b|著者|文)/i;
|
|
65
65
|
const BYLINE_DATE_TAIL = new RegExp(`(?:^|\\s)[|•·–—I-]\\s*${DATE_PART}${TIME_OF_DAY}\\s*$`, "iu");
|
|
66
|
+
const EMPTY_BYLINE_PART = new RegExp(`(?:^(?:(?:von|by|text|autor(?:in)?|author|written by|words by|story by|report(?:ed)? by|posted by|photo(?:s)? by)\\b|著者|文)|${DATE_PART}${TIME_OF_DAY}|\\d{4}[-/年]\\d{1,2}[-/月]\\d{1,2}日?${TIME_OF_DAY}|\\b(?:kommentieren|kommentare?|comments?|leave a comment)\\b|コメント(?:する)?)`, "giu");
|
|
67
|
+
function isEmptyBylineMetadata(text) {
|
|
68
|
+
if (!BYLINE.test(text) || text.length > 120)
|
|
69
|
+
return false;
|
|
70
|
+
return text.replace(EMPTY_BYLINE_PART, "").replace(/[\s|•·–—I:/-]+/g, "") === "";
|
|
71
|
+
}
|
|
66
72
|
function stripBylineDate(block) {
|
|
67
73
|
const walker = block.ownerDocument.createTreeWalker(block, 4);
|
|
68
74
|
let last = null;
|
|
@@ -210,6 +216,33 @@ function removeReaderNoise(root, title, stats, author) {
|
|
|
210
216
|
const headline = normalized(title ?? "");
|
|
211
217
|
const seen = new Set();
|
|
212
218
|
const authorKeys = (author ?? "").split(",").map(name => normalized(name)).filter(Boolean);
|
|
219
|
+
if (authorKeys.length > 0) {
|
|
220
|
+
for (const box of [...root.querySelectorAll("div, section, aside")]) {
|
|
221
|
+
if (!root.contains(box) || charsBefore(root, box) > 400)
|
|
222
|
+
continue;
|
|
223
|
+
if (box.querySelector("h1, h2, h3, ul, ol, table, blockquote, video, audio, iframe"))
|
|
224
|
+
continue;
|
|
225
|
+
const boxText = flat(box.textContent);
|
|
226
|
+
if (!boxText || boxText.length > 350)
|
|
227
|
+
continue;
|
|
228
|
+
const images = [...box.querySelectorAll("img")];
|
|
229
|
+
if (images.length > 1)
|
|
230
|
+
continue;
|
|
231
|
+
const hasSmallAvatar = images.length === 1 && (() => {
|
|
232
|
+
const w = Number(images[0].getAttribute("width") ?? 0);
|
|
233
|
+
const h = Number(images[0].getAttribute("height") ?? 0);
|
|
234
|
+
return (w > 0 && w <= 96 && h > 0 && h <= 96) || Boolean(box.querySelector('a[href*="/author/"], a[href*="/authors/"]'));
|
|
235
|
+
})();
|
|
236
|
+
const hasAuthorLink = Boolean(box.querySelector('a[href*="/author/"], a[href*="/authors/"]'));
|
|
237
|
+
const hasAuthorNameBlock = [...box.querySelectorAll("p, span, div, a, strong")].some(el => {
|
|
238
|
+
const t = normalized(flat(el.textContent));
|
|
239
|
+
return t.length > 0 && authorKeys.includes(t);
|
|
240
|
+
});
|
|
241
|
+
if (hasAuthorNameBlock && (hasSmallAvatar || hasAuthorLink || boxText.length <= 120)) {
|
|
242
|
+
drop(box, "author-bio");
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
213
246
|
const cleanByline = (block, text) => {
|
|
214
247
|
if (!BYLINE.test(text))
|
|
215
248
|
return;
|
|
@@ -261,24 +294,30 @@ function removeReaderNoise(root, title, stats, author) {
|
|
|
261
294
|
}
|
|
262
295
|
}
|
|
263
296
|
// Near the start, a line that is only a date or a reading time repeats what the reader shows in its own head.
|
|
264
|
-
if (!pastStart && text.length <=
|
|
297
|
+
if (!pastStart && text.length <= 120) {
|
|
265
298
|
const before = charsBefore(root, block);
|
|
266
299
|
if (before > 800) {
|
|
267
300
|
pastStart = true;
|
|
268
301
|
}
|
|
269
302
|
else {
|
|
270
|
-
if (
|
|
271
|
-
drop(block, "
|
|
303
|
+
if (isEmptyBylineMetadata(text)) {
|
|
304
|
+
drop(block, "byline");
|
|
272
305
|
continue;
|
|
273
306
|
}
|
|
274
|
-
if (
|
|
275
|
-
|
|
276
|
-
|
|
307
|
+
if (text.length <= 60) {
|
|
308
|
+
if (DATE_ONLY.test(text)) {
|
|
309
|
+
drop(block, "dateline");
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
if (READING_TIME_ONLY.test(text)) {
|
|
313
|
+
drop(block, "reading-time");
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
// When the feed names the author, the reader shows the name in its head: a byline that only says that goes.
|
|
317
|
+
cleanByline(block, text);
|
|
318
|
+
if (!root.contains(block))
|
|
319
|
+
continue;
|
|
277
320
|
}
|
|
278
|
-
// When the feed names the author, the reader shows the name in its head: a byline that only says that goes.
|
|
279
|
-
cleanByline(block, text);
|
|
280
|
-
if (!root.contains(block))
|
|
281
|
-
continue;
|
|
282
321
|
}
|
|
283
322
|
}
|
|
284
323
|
// A block that holds a picture is more than the repeated headline: the picture stays.
|