Commit cc672e8
committed
fix: merge fragmented content divs before Readability parses
archive.today snapshots (and some sites) lay out an article's body as
several sibling divs interleaved with empty/display:none ones (stripped
ad slots or embeds). Each div is scored independently by Readability's
_grabArticle, and the interleaving breaks its sibling-merge heuristic
enough that only the highest-scoring chunk survives, silently dropping
the rest of the article. Collapsing runs of content+empty siblings into
one node before Readability ever sees them avoids the fragmentation.1 parent 9e85b2e commit cc672e8
1 file changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
381 | 412 | | |
382 | 413 | | |
383 | 414 | | |
| |||
389 | 420 | | |
390 | 421 | | |
391 | 422 | | |
| 423 | + | |
392 | 424 | | |
393 | 425 | | |
394 | 426 | | |
| |||
0 commit comments