# Hugging Face Hub Scraper (`rainminer/hugging-face-hub-scraper`) Actor

Search Hugging Face and export models, datasets and spaces with downloads, likes, tags, pipeline task, licence and timestamps. Point it at a search term or an author, optionally enrich each row with the model card metadata. No API key, no login.

- **URL**: https://apify.com/rainminer/hugging-face-hub-scraper.md
- **Developed by:** [rainminer](https://apify.com/rainminer) (community)
- **Categories:** AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.74 / 1,000 items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Hugging Face Hub Scraper

Export models, datasets and spaces from Hugging Face with the numbers that
decide what to use: downloads, likes, task, licence and when the item last
changed. Search by term or by author, or list the most downloaded items with no
search term at all.

Hugging Face publishes a public API for its Hub. This Actor turns that into one
dataset row per item, so a spreadsheet, a dashboard or a scheduled run can track
the ecosystem without writing API code.

### What you get

One row per model, dataset or space:

- `kind`: model, dataset or space
- `id` and `author`, plus the public Hub `url`
- `downloads` for the last 30 days and `likes`
- `pipelineTag` (the task, such as text-generation) and `libraryName`
- `license`, read from the model card or the licence tag
- `createdAt` and `lastModified`
- `tags`: every tag on the item
- `gated`, `private` and, when you turn on enrichment, `storageBytes`
- `matchedQuery`, so you know which search term produced the row

A `SUMMARY` record in the key-value store reports the queries used, item and
request counts, and any term that returned nothing.

### Use cases

1. Track which text-to-image models gained downloads this week.
2. Watch a competitor organisation's new releases by passing `author`.
3. Build a shortlist of Apache-2.0 models for a commercial project.
4. Monitor datasets for a domain, such as code or medical text.
5. Feed a model catalogue into an internal AI platform inventory.
6. Find recently created spaces that solve a problem you are scoping.
7. Compare download velocity before and after a model release.
8. Audit which licences your team actually depends on.
9. Watch for gated releases that need an access request.
10. Build a leaderboard of models by likes for a niche task tag.

### Input

| Field | Default | Meaning |
| --- | --- | --- |
| `queries` | required | Search terms. `*` lists top items with no filter |
| `kinds` | `model`, `dataset` | Which Hub objects to collect, plus `space` |
| `author` | empty | Restrict to one namespace, for example `meta-llama` |
| `filter` | empty | Keep only items with this tag, for example `license:apache-2.0` |
| `sort` | `downloads` | `downloads`, `likes`, `lastModified` or `createdAt` |
| `limitPerQuery` | `50` | Items kept per term and per type, up to 1000 |
| `enrich` | `false` | Fetch each item again for licence, gated status and storage size |

### How much it costs

| Event | Price | Charged when |
| --- | --- | --- |
| Item | $0.00099 per item | A model, dataset or space is written to the dataset |
| Enriched item | $0.00099 per item | Only when Enrich is on, once per item fetched again for its card metadata |

A default run on one term with 50 models costs about five cents and returns 50
rows. The Hub API is free to read, so no proxy or platform usage is billed on
top of these events.

### Output example

```json
{
  "kind": "model",
  "id": "meta-llama/Llama-3.1-8B-Instruct",
  "author": "meta-llama",
  "url": "https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct",
  "downloads": 4113897,
  "likes": 9041,
  "pipelineTag": "text-generation",
  "libraryName": "transformers",
  "license": "llama3.1",
  "createdAt": "2024-07-18T08:56:00.000Z",
  "tags": ["transformers", "safetensors", "license:llama3.1"],
  "matchedQuery": "llama"
}
```

### Limits worth knowing before you buy

- `downloads` is the last-30-days figure Hugging Face reports, not an all-time
  total. The all-time number is only available per model page.
- The list endpoint omits licence, gated status and storage size. Turn on
  Enrich to fill them, at one extra event and one extra request per item.
- Search is Hugging Face's own relevance and prefix matching, so a very short
  term returns a very large result set. `limitPerQuery` is what caps it.
- Paging follows the cursor in the `Link` response header. The Hub ignores the
  `offset` query parameter, so a run that asked for 1000 items used to stop at
  about 100 per term and type. Each page is one request, and `limitPerQuery` is
  honoured up to the documented 1000.
- Spaces expose fewer fields than models. Fields a space does not have stay
  null rather than being filled with a guess.
- Private items only appear if you pass credentials, which this Actor does not
  accept. It reads public data only.

### Local development

```bash
yarn install
yarn test
yarn start
```

Tests run against payload shapes recorded from the live API on 2026-11-19 and
need no network access.

# Actor input Schema

## `queries` (type: `array`):

One or more search terms, for example "llama", "text-to-image" or "whisper". Use \* on its own to list the most downloaded items with no search filter.

## `kinds` (type: `array`):

Which Hub objects to collect. Models, datasets and spaces all come from the same public API.

## `author` (type: `string`):

Optional. Restrict to one namespace, for example meta-llama or google. Leave empty for all authors.

## `filter` (type: `string`):

Optional. Keep only items carrying this tag, for example text-generation, license:apache-2.0 or region:us.

## `sort` (type: `string`):

How to rank items before taking the top results for each search term.

## `limitPerQuery` (type: `integer`):

How many items to keep for each term and each type. 50 keeps a first run cheap.

## `enrich` (type: `boolean`):

Fetch each item again for its card metadata: licence, gated status, storage size and full tag list. Costs one extra event per item and roughly doubles run time.

## Actor input object example

```json
{
  "queries": [
    "text-to-image"
  ],
  "kinds": [
    "model",
    "dataset"
  ],
  "sort": "downloads",
  "limitPerQuery": 50,
  "enrich": false
}
```

# Actor output Schema

## `items` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "queries": [
        "text-to-image"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("rainminer/hugging-face-hub-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "queries": ["text-to-image"] }

# Run the Actor and wait for it to finish
run = client.actor("rainminer/hugging-face-hub-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "queries": [
    "text-to-image"
  ]
}' |
apify call rainminer/hugging-face-hub-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rainminer/hugging-face-hub-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/0J0SzP6y9ybgpj8ew/builds/k9rmYmgKQisxDznf3/openapi.json
