node-unfluff icon indicating copy to clipboard operation
node-unfluff copied to clipboard

Extraction fails on plain text files

Open bogdanionitabp opened this issue 2 years ago • 0 comments

Some webpages (such as https://github.com/JeremySkinner/WebMatrix.Data.StronglyTyped/blob/master/License.txt ) detect whether they're loaded from a browser or from other tools and serve different content type. The one in the example will serve HTML when loaded from the browser, but plain text when loaded via wget. Thus:

wget https://github.com/JeremySkinner/WebMatrix.Data.StronglyTyped/blob/master/License.txt | unfluff will yield no content: {"title":"","softTitle":"","date":null,"author":[],"publisher":null,"copyright":null,"lang":null,"tags":[],"image":null,"videos":[],"links":[],"text":""}

because the tool fails to detect plain text.

This makes it untrustworthy for parsing webpages extracted via GET requests made from tools. I can do a workaround in my code and search for any HTML tags in the text before calling unfluff and only call it if I find any, otherwise assume it's plain text already, but it would be nice if the tool could do that automatically.

bogdanionitabp avatar Sep 05 '23 06:09 bogdanionitabp