import { Defuddle } from "defuddle/node";
import { htmlToMarkdown } from "./markdown.js";
const MIN_CONTENT_THRESHOLD = 100;
async function defuddleExtract(html, url) {
  try {
    const result = await Defuddle(html, url);
    if (!result.content) return null;
    const markdown = htmlToMarkdown(result.content);
    if (markdown.length < MIN_CONTENT_THRESHOLD) return null;
    return {
      title: result.title ?? "",
      markdown,
      metadata: {
        description: result.description || void 0,
        author: result.author || void 0,
        date: result.published || void 0,
        language: result.language || void 0
      },
      links: [],
      images: [],
      extractor: "defuddle"
    };
  } catch {
    return null;
  }
}
export {
  defuddleExtract
};
//# sourceMappingURL=defuddle.js.map