{"by":"andrew_zhong","descendants":50,"id":47526486,"kids":[47528370,47526977,47526760,47526820,47562573,47529494,47527749,47553394,47528197,47527053,47534228,47527286,47526911,47526830,47528608,47527431,47527069,47526690,47527218,47530583,47530025,47529913,47528428],"score":72,"text":"We&#x27;ve been building data pipelines that scrape websites and extract structured data for a while now. If you&#x27;ve done this, you know the drill: you write CSS selectors, the site changes its layout, everything breaks at 2am, and you spend your morning rewriting parsers.<p>LLMs seemed like the obvious fix — just throw the HTML at GPT and ask for JSON. Except in practice, it&#x27;s more painful than that:<p>- Raw HTML is full of nav bars, footers, and tracking junk that eats your token budget. A typical product page is 80% noise.\n- LLMs return malformed JSON more often than you&#x27;d expect, especially with nested arrays and complex schemas. One bad bracket and your pipeline crashes.\n- Relative URLs, markdown-escaped links, tracking parameters — the &quot;small&quot; URL issues compound fast when you&#x27;re processing thousands of pages.\n- You end up writing the same boilerplate: HTML cleanup → markdown conversion → LLM call → JSON parsing → error recovery → schema validation. Over and over.<p>We got tired of rebuilding this stack for every project, so we extracted it into a library.<p>Lightfeed Extractor is a TypeScript library that handles the full pipeline from raw HTML to validated, structured data:<p>- Converts HTML to LLM-ready markdown with main content extraction (strips nav, headers, footers), optional image inclusion, and URL cleaning\n- Works with any LangChain-compatible LLM (OpenAI, Gemini, Claude, Ollama, etc.)\n- Uses Zod schemas for type-safe extraction with real validation\n- Recovers partial data from malformed LLM output instead of failing entirely — if 19 out of 20 products parsed correctly, you get those 19\n- Built-in browser automation via Playwright (local, serverless, or remote) with anti-bot patches\n- Pairs with our browser agent (@lightfeed&#x2F;browser-agent) for AI-driven page navigation before extraction<p>We use this ourselves in production at Lightfeed, and it&#x27;s been solid enough that we decided to open-source it.<p>GitHub: <a href=\"https:&#x2F;&#x2F;github.com&#x2F;lightfeed&#x2F;extractor\" rel=\"nofollow\">https:&#x2F;&#x2F;github.com&#x2F;lightfeed&#x2F;extractor</a> npm: npm install @lightfeed&#x2F;extractor Apache 2.0 licensed.<p>Happy to answer questions or hear feedback.","time":1774497352,"title":"Show HN: Robust LLM extractor for websites in TypeScript","type":"story","url":"https://github.com/lightfeed/extractor"}