Hugging Face Scraper: Model and Dataset Metadata
Live-tested hugging face scraper guide: typed model and dataset records from the free Hub API, plus cursors and rate limits. Ran October 2026.

On this page
Hugging Face’s browse page reports 3,194,674 models as of 2026-10-29, and a shelf of paid scrapers exists to pull that metadata out of HTML. The odd part is that the site serves the same numbers as free JSON, no account and no key required. I ran a hugging face scraper against both doors the same day from a home connection and the HTML lost: zero blocks, zero browser renders, zero dollars, and none of the structure.
All commands below use Magpie, a local CLI scraper (free, AGPL/commercial dual license) with a dedicated zero-LLM vertical for Hugging Face. Every number in this piece comes from those runs.
The rules are one line long
huggingface.co/robots.txt is the shortest one I have seen on a site this size:
User-agent: *
Allow: /
Sitemap: https://huggingface.co/sitemap.xml
Everything is open to crawlers, and the sitemap index lists 7 maps: static pages, docs, blog, models, datasets, spaces, and papers. No Crawl-delay, no banned paths. What HF does instead of robots games is publish documented rate limits, which is more useful. Requests fall into three buckets, counted per IP (or account) over fixed 5-minute windows:
| Bucket | Anonymous (per IP) | Free account | What counts |
|---|---|---|---|
| Hub API | 500 | 1,000 | /api/* calls: records, search, listings |
| Resolvers | 3,000 | 5,000 | File downloads (/resolve/ URLs, the ones transformers & co. hammer) |
| Pages | 100 | 200 | Everything served as a web page |
Blow a bucket and you get a 429 with standardized RateLimit headers attached, including seconds until reset. Note the trap for traditional scrapers: the Pages bucket is 100 requests per 5 minutes, one page every 3 seconds if you sustain it. The API bucket is five times larger. That asymmetry alone should send you to the API, and everything below stays there.
What a hugging face scraper should grab instead of HTML
Scrape a model page the traditional way and you get prose. magpie scrape "https://huggingface.co/google-bert/bert-base-uncased" returned about 1,350 cleaned words: the model card, navigation, avatar links. What it does not return is any structured data. I grepped the raw HTML: zero JSON-LD blocks, nothing for a structured_data sidecar to hold. Compare that with Goodreads, where every book page ships a complete schema.org Book block. Hugging Face puts nothing typed in the page. If your scraper reads HTML, it reads the README and invents the rest.
The typed record lives one request away, in the Hub API. Magpie’s huggingface vertical knows the way:
$ magpie scrape "https://huggingface.co/google-bert/bert-base-uncased" \
--vertical huggingface --out bert.json
$ jq .record bert.json
{
"downloads": 29422017,
"id": "google-bert/bert-base-uncased",
"kind": "model",
"likes": 3059,
"pipeline_tag": "fill-mask",
"tags": ["transformers", "pytorch", "safetensors", "bert",
"fill-mask", "en", "dataset:bookcorpus", "dataset:wikipedia",
"arxiv:1810.04805", "license:apache-2.0", "..."]
}
(Abridged; the full tag list ran to 20 entries.) Six fields, exact integers, one request, no browser and no LLM. The tags array is the sleeper field: HF packs machine-readable prefixes in there that cover half of what people build spreadsheets for. Pull them out with jq:
$ jq -r '.record.tags[] | select(startswith("license:"))' bert.json
license:apache-2.0
$ jq -r '.record.tags[] | select(startswith("arxiv:"))' bert.json
arxiv:1810.04805
License, training datasets, and the source paper, all from the same record. pipeline_tag gives you the task the model serves, which is how you build a “all fill-mask models with more than 10M downloads” list without reading a single page.
Datasets, renames, and the tags that do the work
Dataset URLs return the same record shape, minus pipeline_tag:
$ magpie scrape "https://huggingface.co/datasets/fka/awesome-chatgpt-prompts" \
--vertical huggingface
{"kind":"dataset","id":"fka/prompts.chat","likes":9919,
"downloads":27747,"tags":["task_categories:question-answering",
"task_categories:text-generation","license:cc0-1.0",
"size_categories:1K<n<10K","format:csv","modality:text","..."]}
Look at the id in that record and compare it with the URL I requested. I asked for fka/awesome-chatgpt-prompts; the record and the resolved page both say fka/prompts.chat. The dataset was renamed at some point, and both the API and the site followed the redirect silently. Internalize this before you build any pipeline: Hugging Face URLs churn, but the API resolves old names to current ones. Save the id from the record, not the string you typed. Prepend datasets/ to any repo path and the vertical switches to the dataset API on its own.
The dataset tags carry more structure than the model ones: task_categories, license, size_categories, format, modality. For a dataset inventory, those five prefixes plus downloads are basically the whole schema.
Bulk pulls: listing endpoints, cursors, and full=true
One record at a time is for enrichment. For discovery and leaderboards, the Hub API has listing endpoints, and they answer plain GETs with sort and limit parameters. Magpie passes JSON endpoints straight through to disk:
$ magpie scrape "https://huggingface.co/api/models?sort=downloads&direction=-1&limit=3" \
--page-format raw --out top.json
$ jq -r '.[] | .id + " " + (.downloads|tostring)' top.json
sentence-transformers/all-MiniLM-L6-v2 190086325
cross-encoder/ms-marco-MiniLM-L6-v2 70288427
BAAI/bge-small-en-v1.5 52591445
No cleaning, no gate, just the array as HF serves it. The same works for /api/datasets (the current champion there is huggingface/documentation-images at 5.2M — HF’s own repo of tutorial images). Pagination is cursor-based: each listing response carries a Link header with rel="next" pointing at the next cursor. Follow that header in a loop and you can walk the whole 3.2M-model catalog in order. The loop mechanics are the same as any cursor API; I cover the general patterns in how to scrape multiple pages. For the spreadsheet people, one jq flag turns any listing into CSV:
$ jq -r '.[] | [.id, .downloads] | @csv' top.json
"sentence-transformers/all-MiniLM-L6-v2",190086325
The single-record endpoint also enriches. Append ?full=true and one call adds cardData (the YAML front matter of the model card, including license and metrics), gated status, siblings (the file list), safetensors parameter counts, usedStorage, and createdAt/lastModified timestamps. That turns the vertical’s six fields into a full inventory record while still being one API-bucket request.
One door worth skipping: the /models browse page itself. It static-fetches fine (511 cleaned words, first rows server-rendered), but the numbers arrive abbreviated as “22.7M” instead of integers. The API hands you 22,700,000-something exact. Use it.
Gated models, 401s, and what the vertical refuses
meta-llama/Llama-3.3-70B-Instruct sits behind Meta’s license gate: you must agree to terms before downloading weights. The metadata is not gated. The vertical returned its record anonymously, no token: 390,338 downloads, 3,173 likes, pipeline_tag: text-generation, license:llama3.3, and a base_model:meta-llama/Llama-3.1-70B tag. Gating restricts file access, never the catalog. So yes, gated models scrape fine, as long as by “scrape” you mean metadata and not weights (weights are a license matter, not a scraping one).
Two failure modes to expect. A repo that does not exist, or is private, comes back as HTTP 401, not 404: Hugging Face declines to reveal existence to anonymous callers, so treat a 401 from the API as “missing or private” in your error handling. And the vertical matches only model and dataset URLs. Point it at a Space and it refuses before fetching:
$ magpie scrape "https://huggingface.co/spaces/openai/openai-realtime-agents" \
--vertical huggingface
Error: scrape: vertical "huggingface": vertical extractor does not handle URL for https://huggingface.co/spaces/openai/openai-realtime-agents
Spaces are Gradio apps, not catalog entries. They are a different scrape, and this page does not pretend otherwise.
How hard can you push it
My whole test session ran about 15 requests, sequential with 1–2 seconds between them, and never saw a 429 or a challenge of any kind. Budget math for bulk jobs: each vertical scrape is one API-bucket request, so the anonymous budget of 500 per 5 minutes supports a sustained one-record-per-2-seconds pace (150 per window) with headroom. Registering a free account and passing a token raises every bucket: API and Pages double, to 1,000 and 200, and Resolvers goes from 3,000 to 5,000. The HF docs also note that their official huggingface_hub Python library (1.2.0+) parses the RateLimit header and sleeps exactly until reset on a 429, which is a polite pattern worth copying whatever tool you drive. None of this needs proxies, unblockers, or the services that the search results will offer you. This is the politest large site on the internet.
When the API is the whole job
Here is the honest summary most “hugging face scraper” pages will not give you: for this site, the scraping and the API are the same activity, and the API is better. If your job is heavy pulls, the official huggingface_hub library wraps listing, pagination, and retry logic for free. Magpie earns its place when you want the typed record next to the page markdown in one command, when you are driving scrapes from a shell script or an agent, or when Hugging Face is one stop in a larger job. For the ML pipeline specifically, pair this page with the arXiv scraper for the papers (HF tags models with their arxiv: IDs, and HF hosts its own paper pages and sitemap) and the GitHub scraper for the code. More sites, same treatment, in the scrapers for popular websites hub.
FAQ
Is scraping Hugging Face allowed?
Yes. robots.txt allows everything (User-agent: * / Allow: /), and the only throttle is a documented, published rate limit. HF sells higher limits rather than hiding the data. Terms-of-service questions deserve real answers though; see is web scraping legal and do not take my word for commercial use.
Do I need an API key or token? Not for public metadata. Anonymous requests get 500 API calls per 5 minutes per IP. A free account token raises that to 1,000 and is the docs’ own number-one fix for rate-limit problems.
Can you scrape gated models like Llama? Their metadata, yes: downloads, likes, license, tags, and pipeline all come back without a token. The weights themselves are gated by license acceptance, which is an agreement you sign, not a wall you climb.
How do I get all models with more than X downloads?
Use the listing endpoint: /api/models?sort=downloads&direction=-1&limit=100, then follow the Link: rel="next" cursor header until the numbers drop below your threshold. The vertical enriches each survivor in a second call.
Why does the API return 401 for a model that does not exist? Hugging Face does not confirm the existence of private or missing repos to anonymous callers, so both cases collapse into 401. Treat it as “not there or not yours” and move on.


