博文

目前显示的是 十一月, 2026的博文

Why Your Image Crawler Collects Blur Placeholders (and Misses the Images Hiding in CSS)

图片
You run a crawl across a product gallery, get 2,000 files, and open the folder. A third of them are 40-pixel smears. Another chunk are solid rectangles. And yet the page you crawled clearly had a full-bleed hero image that never showed up in the results at all. Both halves of that outcome come from the same mistake: treating "an image element with a URL" as "the image." Modern pages separate the *presentation* of an image from the *asset* behind it, and they keep a second layer of images entirely outside <img> tags. If your collector only walks the DOM for src attributes, it samples the placeholder layer and misses the CSS layer. Three things that look like images but are not 1. Inline LQIP data URIs. A low-quality image placeholder is a real image, just a deliberately terrible one — often 20×20 pixels encoded as a base64 JPEG of 40 to 300 characters. It is inlined so it paints before any network request resolves. The src attribute is a complete, valid image. ...

Why Image Scrapers Silently Fail: CORS, Tainted Canvases, and Blob URLs

图片
 You write a small script that walks a page, grabs every img, fetches the src, and writes the bytes to disk. It works on nine sites out of ten. On the tenth you get a folder full of 0-byte files, or thirty SecurityError: The operation is insecure lines in the console, or images that appear in the DOM but 404 the moment you try to download them. Almost nobody debugs this correctly, because all three failures look the same from the outside — "the download didn't work" — while they come from three completely different layers. Here is how I learned to tell them apart, and why each one breaks. Failure one: the bytes never leave the server The first layer is plain HTTP. A request for https://cdn.example.com/hero.jpg returns 403 Forbidden when it arrives without a Referer header, because the host runs hotlink protection and only serves images to pages it recognises. Browser-tab requests always carry a referrer, so the image looks perfectly fine in the page — and a script that tr...

Alt Text Is a Label: Turning HTML Metadata into a Searchable Image Library

图片
 Alt Text Is a Label: Turning HTML Metadata into a Searchable Image Library You have 2,000 images and no labels. Tagging them by hand is a week of work; an auto-tagger that guesses "product photo" for everything is worse than nothing. Meanwhile the page you downloaded them from already carried the answer — in alt, in title, in JSON-LD, in the filename — and your collector threw all of it away. This post is about harvesting those free labels, ranking them by how much you can trust them, and turning them into a real retrieval layer. WHERE LABELS ACTUALLY LIVE Every image on the web sits inside markup that describes it, often several times over: - img alt — the accessible description. Not always present, not always useful, but frequently precise: "Nike Air Zoom Pegasus 40, white/orange, side view". - title and aria-label — parallel descriptions, sometimes the only one. - figure > figcaption — editorial captions, often the richest prose. - JSON-LD blocks — schema.org...