feedkeeper 0.28.3 → 0.28.4
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
|
@@ -644,6 +644,7 @@ resourcesRouter.get("/items/:id/image", imageLimiter, async (req, res) => {
|
|
|
644
644
|
res.status(503).json({ error: "image_busy" });
|
|
645
645
|
return;
|
|
646
646
|
}
|
|
647
|
+
console.error(`[image_proxy] Failed to fetch image for item ${req.params.id} (${src}):`, error instanceof Error ? error.message : error);
|
|
647
648
|
res.status(502).json({ error: "image_unavailable" });
|
|
648
649
|
}
|
|
649
650
|
});
|
|
@@ -34,6 +34,31 @@ function cleanConsentDom(doc) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
function resolveLazyImages(doc) {
|
|
38
|
+
const images = doc.querySelectorAll("img");
|
|
39
|
+
for (const img of images) {
|
|
40
|
+
const lazySrc = img.getAttribute("data-lazy-src") ||
|
|
41
|
+
img.getAttribute("data-src") ||
|
|
42
|
+
img.getAttribute("data-original") ||
|
|
43
|
+
img.getAttribute("data-actualsrc");
|
|
44
|
+
const src = img.getAttribute("src");
|
|
45
|
+
if (lazySrc && (!src || src.startsWith("data:") || src.length < 10)) {
|
|
46
|
+
img.setAttribute("src", lazySrc);
|
|
47
|
+
}
|
|
48
|
+
const lazySrcset = img.getAttribute("data-lazy-srcset") || img.getAttribute("data-srcset");
|
|
49
|
+
const srcset = img.getAttribute("srcset");
|
|
50
|
+
if (lazySrcset && (!srcset || srcset.startsWith("data:"))) {
|
|
51
|
+
img.setAttribute("srcset", lazySrcset);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const sources = doc.querySelectorAll("source");
|
|
55
|
+
for (const source of sources) {
|
|
56
|
+
const lazySrcset = source.getAttribute("data-lazy-srcset") || source.getAttribute("data-srcset");
|
|
57
|
+
if (lazySrcset) {
|
|
58
|
+
source.setAttribute("srcset", lazySrcset);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
37
62
|
/**
|
|
38
63
|
* Checks if a given URL or extracted HTML/text is a cookie / consent wall rather than article content.
|
|
39
64
|
*/
|
|
@@ -183,6 +208,7 @@ async function extractArticleContent(rawUrl, fetchImpl, signal) {
|
|
|
183
208
|
try {
|
|
184
209
|
const paywall = /"isAccessibleForFree"\s*:\s*(?:false|"false")/i.test(fetched.html);
|
|
185
210
|
cleanConsentDom(dom.window.document);
|
|
211
|
+
resolveLazyImages(dom.window.document);
|
|
186
212
|
parsed = new Readability(dom.window.document, { charThreshold: 60 }).parse();
|
|
187
213
|
if (isConsentContent(fetched.url, parsed?.content ?? fetched.html, parsed?.title, parsed?.textContent)) {
|
|
188
214
|
return { status: "consent_wall" };
|