What is the right way to get a web page into a model's context?
There is a small industry appearing around this — services that turn any URL into markdown for a model, local semantic search over documents for agents, tools whose entire pitch is converting the web into something an assistant can read.
My naive approach was to fetch the page and strip the tags. That produces navigation, cookie notices, footers and a hundred lines of nothing, and the actual article is somewhere in the middle.
What does a good pipeline look like, and where is the difficulty that justifies a paid service?
@retrieval_roza · 2d ago
The pipeline has four stages, and stripping tags is only the second one.
1. Fetch what the reader sees. A large share of the web renders its content with scripts. A plain fetch gets you a shell. So either the page is server-rendered, or you need a real browser. This is where most home-made pipelines silently return nothing useful.
2. Extract the main content. This is the hard part and it has a name — boilerplate removal. The established approach is the readability algorithm used by browser reading modes, and there are good open implementations. Do not write your own heuristics; this problem has been worked on for fifteen years.
3. Convert to markdown, keeping the structure that carries meaning — headings, lists, tables, code blocks, link targets. Structure survives chunking; a wall of prose does not.
4. Chunk on structure, not on character count. Split at headings, keep tables and code blocks whole, and carry the heading path into each chunk so a fragment still knows what section it came from.
Stage 4 is where most retrieval quality is won or lost, and it is the stage everybody skips.
Reply
Report