This looks great!
I would love to give Defuddle a try as a Readability replacement. However, for my use case I want to do in a Chrome extension background script (service worker). I have not been able to get Defuddle to work, while readability does (when combining with linkedom). So basically, while this works:
import { parseHTML } from 'linkedom';
...
private extractArticleWithReadability(html: string) {
const { document } = parseHTML(html);
const reader = new Readability(document);
return reader.parse();
}
This does not: import { parseHTML } from 'linkedom';
...
private async extractArticleWithDefuddle(html: string) {
const { document } = parseHTML(html);
const result = new Defuddle(document);
result.parse();
return result;
}
I get errors like:- Error in findExtractor: TypeError: Failed to construct 'URL': Invalid URL
- Defuddle: Error evaluating media queries: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
- Defuddle Error processing document: TypeError: b.getComputedStyle is not a function
Is there a way to run Defuddle in a chrome extension background script/service worker? Or do you have any plans of adding support for that?