# Hugging Face Scraper | Models, Datasets, Downloads & Tags (`muzafferkadir/huggingface-hub-scraper`) Actor

Scrape Hugging Face Hub models and datasets by keyword or top-by-sort: downloads, likes, tags, pipeline, dates. Public Hub API, no API key.

- **URL**: https://apify.com/muzafferkadir/huggingface-hub-scraper.md
- **Developed by:** [Muzaffer Kadir YILMAZ](https://apify.com/muzafferkadir) (community)
- **Categories:** AI, Developer tools, Open source
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 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.

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 Scraper

Scrape the **Hugging Face Hub** — **models and datasets** — by keyword or top-by-sort, with **downloads, likes, tags, pipeline, library, and dates**. Built on the **public Hub API**: no API key or setup needed.

Search a topic, a model family, or an author and get a clean, structured feed you can export to CSV, Excel, or JSON — great for AI/ML trend research and model monitoring.

### Features

- **Official, public source** — reads the public Hugging Face Hub API.
- **Models and datasets** — pick either resource type and search or list the top items.
- **Rich sorting** — order by downloads, likes, last modified, or created date.
- **Model monitoring** — schedule it on your model family or author and track downloads and likes over time.

### Use cases

- **AI/ML trend research** — track the most-downloaded models or datasets on any topic.
- **Model / author monitoring** — follow a family (e.g. `llama`, `whisper`) and watch its stats.
- **Dataset discovery** — find datasets by keyword with tags and popularity.
- **Datasets** — build structured Hub metadata for analysis or pipelines.

### Input

| Field | Type | Description |
| --- | --- | --- |
| `resourceType` | enum | `models` or `datasets`. |
| `searchQueries` | string\[] | Search terms. Leave empty to list top items by sort. |
| `sortBy` | enum | `downloads`, `likes`, `lastModified`, or `createdAt`. |
| `maxItems` | integer | Max items per query. Default 100. |

#### Example

```json
{
  "resourceType": "models",
  "searchQueries": ["llama", "whisper"],
  "sortBy": "downloads",
  "maxItems": 200
}
```

### Output

```json
{
  "type": "model",
  "id": "meta-llama/Llama-3.2-1B-Instruct",
  "author": "meta-llama",
  "downloads": 9198251,
  "likes": 1562,
  "pipelineTag": "text-generation",
  "libraryName": "transformers",
  "tags": ["transformers", "safetensors", "llama", "text-generation"],
  "createdAt": "2024-09-18T15:12:47.000Z",
  "lastModified": "2024-10-24T15:07:51.000Z",
  "gated": "manual",
  "private": false,
  "url": "https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct",
  "query": "llama",
  "scrapedAt": "2026-08-11T19:00:00.000Z"
}
```

Download the dataset as **JSON, CSV, Excel, or XML**, or pull it via the Apify API.

### Pricing

Pay-per-event: **$0.01 per run start** (per GB of run memory) plus **$0.50 per 1,000 items**. You only pay for items actually returned. See the **Pricing** tab for current rates.

### FAQ

**Do I need an API key?**
No. This Actor uses the public Hugging Face Hub API — no key, no auth.

**How do I get the top models without searching?**
Leave `searchQueries` empty and set `sortBy` (e.g. `downloads`).

**Can I scrape datasets instead of models?**
Yes — set `resourceType` to `datasets`.

**Can I monitor a model family?**
Yes — schedule the Actor with the family name as the query and `sortBy: lastModified`.

### Disclaimer

This is an **unofficial** Actor. It is not affiliated with or endorsed by Hugging Face. It uses the public Hugging Face Hub API and returns publicly available content. You are responsible for how you use the data.

# Actor input Schema

## `resourceType` (type: `string`):

Whether to scrape models or datasets from the Hugging Face Hub.

## `searchQueries` (type: `array`):

Search terms, e.g. "llama" or "whisper". Leave empty to list top items by sort.

## `sortBy` (type: `string`):

Field to order results by, descending (most downloads/likes or most recent first).

## `maxItems` (type: `integer`):

Stop after this many items for each query.

## `proxyConfiguration` (type: `object`):

Optional. Leave empty for most runs.

## Actor input object example

```json
{
  "resourceType": "models",
  "searchQueries": [
    "llama"
  ],
  "sortBy": "downloads",
  "maxItems": 100
}
```

# Actor output Schema

## `results` (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 = {
    "resourceType": "models",
    "searchQueries": [
        "llama"
    ],
    "sortBy": "downloads",
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("muzafferkadir/huggingface-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 = {
    "resourceType": "models",
    "searchQueries": ["llama"],
    "sortBy": "downloads",
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("muzafferkadir/huggingface-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 '{
  "resourceType": "models",
  "searchQueries": [
    "llama"
  ],
  "sortBy": "downloads",
  "maxItems": 100
}' |
apify call muzafferkadir/huggingface-hub-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muzafferkadir/huggingface-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/dC0mugS2Q40Cpg5CQ/builds/tvQaXRDeOB91uKfkK/openapi.json
