feedkeeper 0.47.1 → 0.47.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feedkeeper",
3
- "version": "0.47.1",
3
+ "version": "0.47.2",
4
4
  "description": "A lightweight, self-hosted RSS reader and remote MCP server for your news, blogs, and AI workflows.",
5
5
  "keywords": [
6
6
  "rss",
@@ -234,7 +234,12 @@ function extractMediaImageUrl(source) {
234
234
  const url = mediaAttribute(entry, "url");
235
235
  const medium = mediaAttribute(entry, "medium");
236
236
  const type = mediaAttribute(entry, "type");
237
- if (isValidImageUrl(url) && (medium === "image" || !medium || (typeof type === "string" && type.startsWith("image/")))) {
237
+ const isImageType = typeof type === "string" && type.toLowerCase().startsWith("image/");
238
+ const isNonImageType = typeof type === "string" && type.trim() !== "" && !isImageType;
239
+ const isNonImageMedium = typeof medium === "string" && medium.trim() !== "" && medium.toLowerCase() !== "image";
240
+ if (isNonImageType || isNonImageMedium)
241
+ continue;
242
+ if (isValidImageUrl(url) && (medium === "image" || !medium || isImageType)) {
238
243
  return cleanImageUrl(url);
239
244
  }
240
245
  }
@@ -423,6 +428,34 @@ function extractXmlArtworkUrl(parsed) {
423
428
  return parsed.icon.trim();
424
429
  return undefined;
425
430
  }
431
+ function extractXmlMediaDescription(item) {
432
+ const direct = asNonEmptyString(item["media:description"]);
433
+ if (direct)
434
+ return direct;
435
+ const mediaGroup = item.mediaGroup ?? item["media:group"];
436
+ if (mediaGroup) {
437
+ for (const group of asMediaEntries(mediaGroup)) {
438
+ if (!isRecord(group))
439
+ continue;
440
+ const grouped = asNonEmptyString(group["media:description"] ?? group.mediaDescription);
441
+ if (grouped)
442
+ return grouped;
443
+ }
444
+ }
445
+ return undefined;
446
+ }
447
+ function escapePlainDescriptionHtml(text) {
448
+ const escaped = text
449
+ .replace(/&/g, "&")
450
+ .replace(/</g, "&lt;")
451
+ .replace(/>/g, "&gt;")
452
+ .replace(/"/g, "&quot;");
453
+ return escaped
454
+ .split(/\n{2,}/)
455
+ .map((block) => `<p>${block.trim().replace(/\n/g, "<br>")}</p>`)
456
+ .filter((block) => block !== "<p></p>")
457
+ .join("");
458
+ }
426
459
  export async function parseFeedBody(body) {
427
460
  if (body.trimStart().startsWith("{")) {
428
461
  return parseJsonFeed(body);
@@ -445,17 +478,22 @@ export async function parseFeedBody(body) {
445
478
  icons,
446
479
  logos,
447
480
  artworkUrl,
448
- items: parsed.items.map((item) => ({
449
- guid: itemGuid(item),
450
- title: plainTitle(item.title),
451
- link: itemLink(item),
452
- contentSnippet: decodeEntities(item.contentSnippet ?? item.content) ?? undefined,
453
- contentHtml: item.contentEncoded ?? item["content:encoded"] ?? item.content ?? null,
454
- publishedAt: normalizePublishedAt(item.isoDate ?? item.pubDate) ?? undefined,
455
- imageUrl: extractXmlImageUrl(item),
456
- authors: [item.creator, item.author],
457
- ...extractXmlMedia(item),
458
- })),
481
+ items: parsed.items.map((item) => {
482
+ const mediaDescription = extractXmlMediaDescription(item);
483
+ const rawSnippet = item.contentSnippet ?? item.content ?? mediaDescription;
484
+ const rawHtml = item.contentEncoded ?? item["content:encoded"] ?? item.content ?? null;
485
+ return {
486
+ guid: itemGuid(item),
487
+ title: plainTitle(item.title),
488
+ link: itemLink(item),
489
+ contentSnippet: decodeEntities(rawSnippet) ?? undefined,
490
+ contentHtml: rawHtml ?? (mediaDescription ? escapePlainDescriptionHtml(mediaDescription) : null),
491
+ publishedAt: normalizePublishedAt(item.isoDate ?? item.pubDate) ?? undefined,
492
+ imageUrl: extractXmlImageUrl(item),
493
+ authors: [item.creator, item.author],
494
+ ...extractXmlMedia(item),
495
+ };
496
+ }),
459
497
  };
460
498
  }
461
499
  function isYouTubeUrl(rawUrl) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedkeeper/server",
3
- "version": "0.47.1",
3
+ "version": "0.47.2",
4
4
  "private": true,
5
5
  "type": "module"
6
6
  }