wrolpi/modules
lrnselfreliance 1f07b5f944
Readability extraction no longer takes minutes on image-heavy pages (#838)
* Readability extraction no longer takes minutes on image-heavy pages

SingleFile inlines every image as a base64 data URI, and readability-extractor
(jsdom) slows to minutes on a page carrying megabytes of them, so these pages
hit the readability timeout and were saved without readability text.

Replace each base64 payload with a short placeholder before running
readability-extractor, then restore the payloads in its output.  Applied in
both the archive container and the native (Raspberry Pi/Debian) path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Data URI placeholders cannot be forged by page text

The placeholder was a fixed string, so a page containing placeholder-like
text could index past the payloads (IndexError, failing the archive on the
native path) or repeat a placeholder to copy a large image into the output
many times.  Each extraction now uses a random token, and text that is not a
known placeholder is left as-is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Data URI placeholders survive Readability's lazy-image cleanup

Readability's _fixLazyImages removes an <img> src whose base64 payload is
shorter than 133 characters when another attribute names an image file
(alt="cat.png", title, a leftover data-src), treating it as a lazy-load
placeholder.  The ~50 character placeholder triggered this, so those images
lost their inline data.  The token is now 160 hex characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 18:50:21 -06:00
..
archive Readability extraction no longer takes minutes on image-heavy pages (#838) 2026-10-15 18:50:21 -06:00
docs Model reprs read only loaded state (#819) 2026-10-11 16:47:32 -06:00
flasher db: request-path library functions use the request's connection (#774) 2026-10-04 11:05:20 -06:00
inventory Strip whitespace from inventory item string values on save 2026-07-30 17:34:46 -06:00
map Map previews that never drew, and a Docker map with no world under it (#658) 2026-08-11 20:37:23 -06:00
repos Model reprs read only loaded state (#819) 2026-10-11 16:47:32 -06:00
videos Video transcodes run at the least CPU priority (#824) 2026-10-12 12:10:44 -06:00
zim Model reprs read only loaded state (#819) 2026-10-11 16:47:32 -06:00
__init__.py Add a Repos module that mirrors git repositories (#783) 2026-10-07 15:16:58 -06:00