# Hugging Face Models, Datasets & Spaces Scraper | 2Space (`2space/huggingface-models-datasets-scraper`) Actor

Fast Hugging Face Hub scraper for open-source AI models, datasets, and Spaces. Scrapes downloads, likes, pipeline tasks, GGUF/safetensors tags, licenses, authors, and last-modified timestamps.

- **URL**: https://apify.com/2space/huggingface-models-datasets-scraper.md
- **Developed by:** [2Space Group](https://apify.com/2space) (community)
- **Categories:** AI, Developer tools, MCP servers
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 hugging face items scraped

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/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 Models, Datasets & Spaces Scraper | 2Space

> **Built by 2Space** · High-speed, zero-browser **Hugging Face scraper**, **Hugging Face Models API**, **Hugging Face Datasets scraper**, and **Hugging Face Spaces metadata** extractor engineered for AI agents, MCP clients, ML research teams, and model discovery pipelines.

[![Apify Actor](https://img.shields.io/badge/Apify-huggingface--models--datasets--scraper-00C853?style=flat-square)](https://apify.com/2space/huggingface-models-datasets-scraper)
[![MCP Ready](https://img.shields.io/badge/MCP-Ready-2563EB?style=flat-square)](https://mcp.apify.com?tools=2space/huggingface-models-datasets-scraper)
[![Zero Browser](https://img.shields.io/badge/Runtime-Pure%20HTTP%20%2B%20JSON-7C3AED?style=flat-square)](https://apify.com/2space/huggingface-models-datasets-scraper)

Looking for a fast **Hugging Face scraper** to index open-weight models, training datasets, and interactive Spaces? This **Hugging Face Models, Datasets & Spaces scraper** queries the official Hugging Face Hub JSON endpoints over direct HTTP to extract structured **AI model discovery** data—including downloads, likes, licenses, pipeline tags, framework libraries, gating status, and repository timestamps—without headless browser overhead or external LLM API keys.

***

### Key Capabilities & Use Cases

- **AI Model Discovery & Benchmarking:** Track trending open-weight models (`qwen`, `llama`, `deepseek`, `mistral`, `flux`) sorted by downloads, likes, or recent updates.
- **Dataset Sourcing for Training & Evals:** Collect Hugging Face Datasets metadata with license filtering, download counts, and gating flags for RAG, fine-tuning, and evaluation pipelines.
- **Spaces & Demo Tracking:** Discover Gradio, Streamlit, Docker, and Static Spaces alongside their SDKs, community likes, and MCP server tags.
- **Flat, Agent-Ready Schema:** Every output item uses consistent root scalar fields (`repoType`, `repoId`, `author`, `pipelineTag`, `libraryName`, `downloads`, `likes`, `license`, `isGated`, `tags`, `createdAt`, `lastModified`, `url`, `extractedAt`) ready for spreadsheets, SQL warehouses, vector databases, and AI agents.
- **Balanced Multi-Type Extraction:** Interleaves results across requested repository types (`models`, `datasets`, `spaces`) and deduplicates by `repoType:repoId` so combined runs return balanced coverage within `maxItems`.
- **Empty `{}` Input Ready:** Works immediately with zero configuration—running `{}` searches `"qwen"` across `["models", "datasets"]` sorted by `"downloads"` (`maxItems: 10`, `maxCostUsd: 0.25`).

***

### Input Parameters

| Field | Type | Default | Description |
|---|---|---|---|
| `repoTypes` | `string[]` | `["models", "datasets"]` | Repository types to scrape: `"models"`, `"datasets"`, and/or `"spaces"`. |
| `searchQuery` | `string` | `"qwen"` | Search term sent to the Hugging Face Hub API. Leave blank to list top repositories by sort order. |
| `sortBy` | `string` | `"downloads"` | Sort order: `"downloads"`, `"likes"`, or `"lastModified"`. Spaces automatically fall back to `"likes"` when `"downloads"` is chosen. |
| `maxItems` | `integer` | `10` | Maximum number of deduplicated repositories to push and charge (`1`–`10000`). |
| `maxCostUsd` | `number` | `0.25` | Pre-charge Pay-Per-Event spending safety cap in USD. |

***

### Example JSON Output

Each dataset item contains flat metadata fields:

```json
{
  "repoType": "model",
  "repoId": "Qwen/Qwen3-4B-Instruct-2507",
  "author": "Qwen",
  "pipelineTag": "text-generation",
  "libraryName": "transformers",
  "downloads": 16901693,
  "likes": 1055,
  "license": "apache-2.0",
  "isGated": false,
  "tags": [
    "transformers",
    "safetensors",
    "qwen3",
    "text-generation",
    "license:apache-2.0"
  ],
  "createdAt": "2025-08-05T10:58:03.000Z",
  "lastModified": "2026-10-28T03:06:22.000Z",
  "url": "https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507",
  "extractedAt": "2026-12-03T03:45:00.000Z"
}
```

A detailed run summary is also written to the default Key-Value Store under `RUN_DIAGNOSTICS`, recording endpoint status codes, fetched counts, deduplication totals, and cost-limit flags.

***

### 1-Prompt MCP Setup & AI Agent Integration

Connect `2space/huggingface-models-datasets-scraper` to Claude Desktop, Cursor, ChatGPT, or any MCP-compatible client using the Apify MCP endpoint:

```text
https://mcp.apify.com?tools=2space/huggingface-models-datasets-scraper
```

Or add it to your `mcpServers` JSON configuration:

```json
{
  "mcpServers": {
    "apify-huggingface-scraper": {
      "url": "https://mcp.apify.com?tools=2space/huggingface-models-datasets-scraper",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
```

**1-Prompt Example:**

> *"Use `2space/huggingface-models-datasets-scraper` to find the top 10 most downloaded `qwen` models and datasets on Hugging Face with their licenses, download counts, and pipeline tags."*

#### Direct REST API (n8n, Make, Zapier, Custom Scripts)

```text
POST https://api.apify.com/v2/acts/2space~huggingface-models-datasets-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN
```

***

### Pricing & No Data, No Charge Guarantee

- **Primary Event:** `hf-item-scraped` (`count: 1` per validated pushed repository).
- **No Data, No Charge:** `Actor.charge()` is invoked strictly **after** `Actor.pushData()` succeeds for a validated item. Failed or empty queries never incur item charges.
- **Spending Controls:** Both `maxItems` and `maxCostUsd` are enforced prior to pushing/charging, and Apify's `eventChargeLimitReached` stops execution gracefully once your spending limit is reached.

***

### Support & Links

- **Actor Page:** [2space/huggingface-models-datasets-scraper](https://apify.com/2space/huggingface-models-datasets-scraper)
- **Issues & Feedback:** Report edge cases on the [Issues tab](https://apify.com/2space/huggingface-models-datasets-scraper/issues) with your `RUN_DIAGNOSTICS` Key-Value Store record.

# Actor input Schema

## `repoTypes` (type: `array`):

Hugging Face Hub repository types to extract: models, datasets, and/or spaces.

## `searchQuery` (type: `string`):

Search term passed to the Hugging Face Hub API (e.g., 'qwen', 'llama', 'embedding', 'flux'). Leave blank to list top repositories by sort order.

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

Sort order for Hugging Face Hub results. Note: Spaces do not track downloads, so Spaces queries automatically fall back to likes when 'downloads' is selected.

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

Hard cap on the maximum number of deduplicated Hugging Face repositories to push and charge.

## `maxCostUsd` (type: `number`):

Pre-charge spending safety cap in USD for Pay-Per-Event billing.

## Actor input object example

```json
{
  "repoTypes": [
    "models",
    "datasets"
  ],
  "searchQuery": "qwen",
  "sortBy": "downloads",
  "maxItems": 10,
  "maxCostUsd": 0.25
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset items containing extracted Hugging Face repositories with flat metadata fields.

# 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 = {
    "repoTypes": [
        "models",
        "datasets"
    ],
    "searchQuery": "qwen",
    "sortBy": "downloads",
    "maxItems": 10,
    "maxCostUsd": 0.25
};

// Run the Actor and wait for it to finish
const run = await client.actor("2space/huggingface-models-datasets-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 = {
    "repoTypes": [
        "models",
        "datasets",
    ],
    "searchQuery": "qwen",
    "sortBy": "downloads",
    "maxItems": 10,
    "maxCostUsd": 0.25,
}

# Run the Actor and wait for it to finish
run = client.actor("2space/huggingface-models-datasets-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 '{
  "repoTypes": [
    "models",
    "datasets"
  ],
  "searchQuery": "qwen",
  "sortBy": "downloads",
  "maxItems": 10,
  "maxCostUsd": 0.25
}' |
apify call 2space/huggingface-models-datasets-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,2space/huggingface-models-datasets-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/fwskQfJqEHR1yNbOm/builds/zgH5TyxVXQjpT2Whh/openapi.json
