Replaces subscribing feeds through a self-hosted Full-Text RSS proxy. Feed URLs go back to being real feed URLs and extraction happens inside tt-rss, using the same ftr-site-config rules the proxy used. The engine in lib/ has no tt-rss dependencies, so rules can be developed and audited from the command line; init.php is a thin adapter over it. Two findings from measuring the real subscription first, both of which shaped the design: - Firecrawl's own onlyMainContent is far too coarse to extract with (73KB of chrome on a Cloudflare post), but it is an excellent renderer. So it is used for rawHtml only and the rule engine does the extraction. - A body rule that stops matching after a redesign falls through to Readability and still produces a plausible article, so the breakage is invisible. Every extraction now records which rule matched and whether it fell back; auditing the 34 live feeds surfaced five community rules that match nothing. Custom rules included for the sites that needed them, including three comics where the article is an image and text-scoring extractors return the wrong thing or nothing at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sSJdftQx5bW5HZHgUKF3i
49 lines
1.7 KiB
JavaScript
49 lines
1.7 KiB
JavaScript
/* global xhr, App, Plugins, Article, Notify */
|
|
|
|
Plugins.Af_Fulltext = {
|
|
orig_attr_name: 'data-af-fulltext-orig-content',
|
|
|
|
/**
|
|
* Toggle extracted content in place for one article.
|
|
*
|
|
* Doubles as the rule-debugging loop: edit a rule, hit the button, see the
|
|
* result immediately -- and the notification names the rule that produced it,
|
|
* so a rule that quietly stopped matching is visible rather than merely
|
|
* disappointing.
|
|
*/
|
|
embed: function(id) {
|
|
const content = document.querySelector(App.isCombinedMode() ?
|
|
`.cdm[data-article-id="${id}"] .content-inner` :
|
|
`.post[data-article-id="${id}"] .content`);
|
|
|
|
if (!content) return;
|
|
|
|
if (content.hasAttribute(this.orig_attr_name)) {
|
|
content.innerHTML = content.getAttribute(this.orig_attr_name);
|
|
content.removeAttribute(this.orig_attr_name);
|
|
|
|
if (App.isCombinedMode()) Article.cdmMoveToId(id);
|
|
|
|
return;
|
|
}
|
|
|
|
Notify.progress("Extracting, please wait...");
|
|
|
|
xhr.json("backend.php", App.getPhArgs("af_fulltext", "embed", {id: id}), (reply) => {
|
|
if (reply && reply.content) {
|
|
content.setAttribute(this.orig_attr_name, content.innerHTML);
|
|
content.innerHTML = reply.content;
|
|
|
|
Notify.info(reply.summary || "Extracted");
|
|
|
|
if (App.isCombinedMode()) Article.cdmMoveToId(id);
|
|
} else {
|
|
const why = reply && reply.errors && reply.errors.length ?
|
|
reply.errors[0] : "no content extracted";
|
|
|
|
Notify.error("af_fulltext: " + why);
|
|
}
|
|
});
|
|
}
|
|
};
|