HNHacker News
TopNewBestAskShowJobs

andrew_zhong

19 karma · joined March 4, 2022

Building LightFeed - News Hub powered by LLM and Revar Immersive - a gaming platform that teach children coding
submissionscomments
andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
You can use a browser automation library for rendering JS + interaction (like click collapse button) and then use this library to extract the HTML after interaction. Here is an example of using a AI browser automation library with prompt to interact (but you can also use playwright if you know the exact element to interact)

https://github.com/lightfeed/extractor?tab=readme-ov-file#us...

andrew_zhong··on Show HN: Robust LLM Extractor for Websites in TypeScript
[Update]] I will replace the stealth browser with plain playwright and remove anti-bot as a feature.
andrew_zhong··on Show HN: Robust LLM Extractor for Websites in TypeScript
I hear you loud and clear - will replace the stealth browser with plain playwright and remove anti-bot as a feature.
andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
[Update] I will replace the stealth browser with plain playwright and remove anti-bot as a feature.
andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
I agree that When pages have similar structure, for one time extraction as it is (not reasoning from context), scraping with selectors is the way to go.

This library also supports HTML as input so running a browser is not required.

andrew_zhong··on Show HN: Robust LLM Extractor for Websites in TypeScript
What kind of LLMs are you using? In structured output mode?

In this library we recover nullable and optional fields, invalid elements in nested array, bad urls, repair incomplete JSONs. If these issues are what you see, yes it should work for your case.

andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
Put things to perspective - Gemini 2.5 flash is 0.3/1M tokens - assuming each page is 700 tokens and output is not much you are looking at $210 for 1M pages
andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
Agreed - in this project I did a one path sanitation to recover invalid optional / nullable fields or discard invalid objects in nested array.

I know multi path LLM approaches exist: e.g. generating JSON patches

https://github.com/hinthornw/trustcall

andrew_zhong··on Show HN: Robust LLM Extractor for Websites in TypeScript
We do see fewer invalid JSONs on latest bigger LLMs but still can happen on smaller and cheaper models. There is also case when input is truncated or a required field not found, which are inherently difficult.

On XML vs JSON, I think the goal here is to generate typed output where JSON with zod shines - for example the result can type check and be inserted to database typed columns later

andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
HTML -> markdown -> LLM is standard practice. We strip elements like aside, embed, head , iframe etc. the criteria is conservatively set to avoid removing too many elements (especially in extractMain mode)

https://github.com/lightfeed/extractor/blob/main/src/convert...

I have used gemma 3 and had good results.

Once Gemini 3 flash drops the preview suffix, will update the examples. Thank you for the pointer.

andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
In context of e-commerce web extraction, invalid JSON can occur especially in edge cases, for example:

price: z.number().optional() -> price: “n/a”

url: z.string().url().nullable() -> url: “not found”

It can also be one invalid object (e.g. missing required field, truncated input) in an array causing the entire output to fail.

The unique contribution here is we can recover invalid nullable or optional field, and also remove invalid nested objects in an array.

andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
I will add a PR to enforce robots.txt before the actual scraping.
andrew_zhong··on Show HN: Robust LLM Extractor for Websites in TypeScript
We do respect robots.txt production - also scraping browser providers like BrightData enforces that.

I will add a PR to enforce robots.txt before the actual scraping.

andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
The anti-bot patches here (via Patchright) are about preventing the browser from being detected as automated — fixing CDP leaks, removing automation flags, etc. For sites behind Cloudflare or Datadome, that alone usually isn't enough — you'll need residential proxies and proper browser fingerprints on top. The library supports connecting to remote scraping browsers via WebSocket and proxy configuration for those cases.
andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
Yeah that's a good observation. XML's closing tags give the model structural anchors during generation — it knows where it is in the nesting. JSON doesn't have that, so the deeper the nesting the more likely the model loses track of brackets.

We see this especially with arrays of objects where each object has optional nested fields. For complex nested objects, the model can get all items well formatted but one with an invalid field of wrong type. That's why we put effort into the repair/recovery/sanitization layer — validate field-by-field and keep what's valid rather than throwing everything out.

andrew_zhong··on Show HN: Robust LLM extractor for websites in TypeScript
Good point. The anti-bot patches here (via Patchright) are about preventing the browser from being detected as automated — things like CDP leak fixes so Cloudflare doesn't block you mid-session. It's not about bypassing access restrictions.

Our main use case is retail price monitoring — comparing publicly listed product prices across e-commerce sites, which is pretty standard in the industry. But fair point, we should make that clearer in the README.

andrew_zhong··on Show HN: Robust LLM Extractor for Websites in TypeScript
Good point. The anti-bot patches here (via Patchright) are about preventing the browser from being detected as automated — things like CDP leak fixes so Cloudflare doesn't block you mid-session. It's not about bypassing access restrictions.

Our main use case is retail price monitoring — comparing publicly listed product prices across e-commerce sites, which is pretty standard in the industry. But fair point, we should make that clearer in the README.

andrew_zhong··on Show HN: LLM-powered News Hub, e.g "Games, science or open source" on HN
Thank you for the feedback. Our intention is to let users try for 10 days without commitment (no credit card required), so that after 10 days they can choose to subscribe or not.

I see your confusion on pricing. It will be a paid service given the storage and LLM cost. I put "10 day free trial" under the main action button. Hope it can clarify a bit.

andrew_zhong··on Jina Reader: Convert any URL to an LLM-friendly input
Have you used them? They offers it for free and I don't find their website mentioning API limit or whether they support dynamic JS
andrew_zhong··on Show HN: LLM Scraper – turn any webpage into structured data
Great work! I’ve worked on the same problem and used LLM to extract feed into structured data (in my case have to use a more affordable model like GPT3.5 for a Saas app, looking at llama3 now)

Have you thought about automatically extract schema?

andrew_zhong··on Show HN: LLM Scraper – turn any webpage into structured data
I’ve worked on this exact problem when extracting feeds from news websites. Yes calling LLM each time is costly so I use LLM for the first time to extract robust css selectors and the following times just relying on those instead of incurring further LLM cost.
andrew_zhong··on Ask HN: Is there a way to customize the stories on Hacker News?
If you are looking for broader less heuristic based filter, you can try LightFeed (full disclosure, I am the creator of LightFeed)

It filters and summarizes stories using LLM and your prompt on any site including HN!

andrew_zhong··on Ask HN: Where to put AI summary and filter in custom RSS feed
I got reply from someone in Reddit who mentioned that feed readers will just ignore the custom namespaces. SO I think the best option (but hacky) will be to put the summary into the item description HTML...

Hope there are cleaner ways