# Hugging Face Dataset Monitor (Hub Metadata JSON) (`steadfetch/huggingface-dataset-extractor`) Actor

Return public Hugging Face dataset metadata from the official Hub API as structured JSON: dataset id, author, last modified date, downloads, likes, license, gated/disabled flags and tags. Metadata only, no dataset card text or files, validated against a published schema.

- **URL**: https://apify.com/steadfetch/huggingface-dataset-extractor.md
- **Developed by:** [Steadfetch](https://apify.com/steadfetch) (community)
- **Categories:** Business, Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 dataset delivereds

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 Dataset Metadata Scraper (Hub Downloads and Likes)

Extract public Hugging Face dataset metadata from the official Hub API: dataset id, author, last-modified date, downloads, likes, license, gated/disabled flags and structured tags as JSON. One dataset per result, schema-validated, with no dataset card text and no dataset files.

### What it does

Query the official Hugging Face Hub datasets API (`https://huggingface.co/api/datasets`), the public JSON endpoint behind the Hub catalogue, and get one dataset item per dataset. Filter by keyword, author or library, sort by last modification, downloads or likes, and collect up to 5,000 datasets per run.

The source is a documented public API, not a scraped web page: plain HTTP, no browser, no login, no CAPTCHA and no proxy. The Actor reads only metadata; it never downloads dataset files and never reads the dataset card body.

**Input:** `keyword`, `author`, `library`, `sort` (`lastModified`, `downloads` or `likes`; default `lastModified`) and `maxResults` (default 100, maximum 5,000), plus `mode` and `strictSchema`.

**Output:** one dataset item with `dataset_id`, `author`, `last_modified`, `downloads`, `likes`, `license`, `gated`, `disabled`, `tags` and `source_url`, plus the common `url`, `title` and `scrapedAt` envelope. Format: JSON dataset.

`mode=search` (default) emits every match up to `maxResults`. `mode=monitor` emits only datasets that are new or whose `last_modified` moved forward since the previous monitor run, deduplicated by `dataset_id`; the state is kept in the run's key-value store.

#### Why the output carries no card text

A Hugging Face dataset card can contain a person's email, Telegram or X handle in its free-text description. The API response exposes `description` and `cardData`, but this Actor never maps them: only the structured metadata fields above can reach the dataset. Any tag that looks like a personal contact is dropped as well. See the FAQ and the automated GDPR tests.

### Example output

Real sample read from the Hub API on 2026-10-20 and produced by the committed fixture (`datasocial/tiktok-5.6B-videos`):

```json
{
    "url": "https://huggingface.co/datasets/datasocial/tiktok-5.6B-videos",
    "title": "datasocial/tiktok-5.6B-videos",
    "scrapedAt": "2026-10-20T12:00:00.000Z",
    "dataset_id": "datasocial/tiktok-5.6B-videos",
    "author": "datasocial",
    "last_modified": "2026-10-07",
    "downloads": 25678,
    "likes": 377,
    "license": "cc-by-nc-4.0",
    "gated": false,
    "disabled": false,
    "tags": [
        "license:cc-by-nc-4.0",
        "size_categories:1B<n<10B",
        "format:parquet",
        "modality:tabular",
        "modality:text",
        "library:datasets",
        "library:dask",
        "library:polars",
        "library:mlcroissant",
        "region:us",
        "tiktok",
        "social-media",
        "short-video",
        "creators"
    ],
    "source_url": "https://huggingface.co/datasets/datasocial/tiktok-5.6B-videos"
}
```

### Pricing

Pay-per-event pricing (`.actor/pay_per_event.json`, referenced from `actor.json` as `payPerEvent`):

| Event | Charged when | Price |
| --- | --- | --- |
| `apify-actor-start` | a run starts (synthetic, automatic) | 0.00005 USD per run (Apify-recommended default; includes 5 seconds of free compute) |
| `apify-default-dataset-item` | a validated dataset is saved to the dataset (synthetic, automatic) | 0.003 USD per result = **3.00 USD per 1,000 results** |

There is no custom per-item event and no `Actor.charge()` call: the platform already charges `apify-default-dataset-item` per pushed item, so another event would bill users twice. Malformed records, empty searches and repeated datasets in monitor mode are never pushed, therefore never charged.

The price sits inside the direct-competitor band reported for this niche (0.60-32 USD per 1,000) and inside Steadfetch's 1-10 USD band.

**Measured cost per 1,000 results** (no browser, no proxy, public API): a 1,000-record page measured 0.96 MB and 0.2-0.4 s against the live API on 2026-10-20. At 256 MB and Apify's USD 0.20 per GB-hour compute rate that is about **USD 0.00002 per 1,000 results**; a conservative budget including run overhead and retries is **USD 0.01 per 1,000 results**. Gross margin at 3.00 USD per 1,000 is above 99%. The first paid platform run will replace this estimate with the billed figure.

### FAQ

**Do I need a Hugging Face account or API key?**
No. The Hub datasets API used here is public and unauthenticated. There is no token input and no secret to configure.

**Does it need a browser?**
No. The Hub returns structured JSON; plain HTTP is roughly 10x cheaper and faster than a browser-based Actor.

**Does it download the datasets?**
No. Only metadata is read. Dataset files and the dataset card body are never fetched.

**Does it return personal data?**
No. `description` and `cardData` are never mapped, and tags that look like personal contacts are dropped. The automated tests feed a record with an email, a Telegram handle and an X handle and assert that none of them appears in the output.

**What is monitor mode?**
`mode=monitor` keeps state between runs in the key-value store and emits only datasets that are new or have a newer `last_modified` date, deduplicated by `dataset_id`. It is most complete with the default `sort=lastModified`. Re-running it without changes emits and charges nothing.

**How do I find datasets from one organisation?**
Set `author` to the Hugging Face user or organisation name, for example `datasocial`.

**When am I charged?**
Once per run start (`apify-actor-start`) and once per valid dataset saved (`apify-default-dataset-item`). Errors, empty results and duplicates are not charged per result.

**Is the output schema stable?**
Yes. Required fields in `.actor/dataset_schema.json` never change; new fields are added additively and the item schema allows extra properties.

### Maintenance

**Maintenance status:** tested daily. The Actor is registered in the Steadfetch daily catalog QA workflow with the minimal input `{"keyword":"medical","maxResults":10}`; the label `Tested daily. Last verified: {YYYY-MM-DD}.` is published only after the first successful scheduled run is logged.

The source is the versioned public Hub API. Committed fixtures and schema tests catch response changes in CI, and any break in the daily run is reported as an issue in the Steadfetch Actors repository.

### Keywords

hugging face datasets, dataset metadata, dataset search, dataset catalogue, machine learning datasets, downloads, likes, license, JSON dataset, ML data

### Input reference

Search mode:

```json
{
    "keyword": "medical",
    "maxResults": 100,
    "sort": "lastModified"
}
```

Monitor mode:

```json
{
    "mode": "monitor",
    "author": "datasocial",
    "maxResults": 100,
    "sort": "lastModified"
}
```

| Field | Type | Description |
| --- | --- | --- |
| `mode` | `search` or `monitor` | Default `search`. `monitor` emits only new or updated datasets since the previous run. |
| `keyword` | string | Optional Hub search term. |
| `author` | string | Optional Hugging Face user or organisation. |
| `library` | string | Optional Hub library filter, for example `datasets`, `pandas`, `polars` or `dask`. |
| `sort` | `lastModified`, `downloads` or `likes` | Default `lastModified`; highest/newest first. |
| `maxResults` | integer | Default 100, maximum 5,000. |
| `strictSchema` | boolean | Default `true`; fail the run on schema violations. |

### Development

```bash
npm install
npm test                # lint + typecheck + offline Vitest suites (no credit)
npm run publish:check   # Steadfetch publish gate
npm run build && npm run verify:build   # production entrypoint guard
npm run schemas:validate
RUN_LIVE_TESTS=1 npm test               # also runs the live Hub API tests (no credit)
```

The default test suite runs against committed fixtures and never touches the external network or Apify. Live tests are skipped unless `RUN_LIVE_TESTS=1`; they validate real Hub responses against the same output schema. For a credit-free end-to-end run, point the Actor at a loopback server serving `test/fixtures/datasets-response.json` and run `apify run --input ...`.

Project structure:

```
.actor/actor.json          Actor definition (payPerEvent, dataset schema, output schema)
.actor/input_schema.json   INPUT options (mode, keyword, author, library, sort, maxResults)
.actor/dataset_schema.json Item JSON Schema (fields) + table view for the Store
.actor/pay_per_event.json  PPE pricing (two synthetic platform events)
src/fetch.ts               Hub API client: filters, cursor pagination, retry/backoff
src/extract.ts             Pure metadata mapping, GDPR tag scrubbing and monitor dedupe
src/main.ts                Entry point: fetch, extract, monitor filter, validate, push
src/validate-output.ts     Ajv validator shared by the run and the tests
test/                      Offline fixtures, Vitest suites and optional live API tests
```

# Actor input Schema

## `mode` (type: `string`):

search: emit every matching dataset up to maxResults. monitor: emit only datasets that are new or have a newer last_modified than the previous monitor run, deduplicated by dataset_id.

## `keyword` (type: `string`):

Optional search term applied to the dataset id and card metadata by the Hub API. For example: medical, finance, multilingual.

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

Optional Hugging Face user or organisation name to restrict results to (for example datasocial).

## `library` (type: `string`):

Optional Hub library filter, for example datasets, pandas, polars or dask.

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

Order in which the Hub API returns results (newest/highest first). Monitor mode is most complete with lastModified.

## `maxResults` (type: `integer`):

Maximum number of datasets to save to the dataset.

## `strictSchema` (type: `boolean`):

Fail the run when an item does not match the OUTPUT schema. Keep enabled: Steadfetch never publishes Actors without output-schema validation.

## Actor input object example

```json
{
  "mode": "search",
  "keyword": "medical",
  "author": "datasocial",
  "library": "datasets",
  "sort": "lastModified",
  "maxResults": 100,
  "strictSchema": true
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items validated against the item schema in dataset_schema.json (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 = {
    "mode": "search",
    "keyword": "medical",
    "maxResults": 10,
    "strictSchema": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadfetch/huggingface-dataset-extractor").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 = {
    "mode": "search",
    "keyword": "medical",
    "maxResults": 10,
    "strictSchema": True,
}

# Run the Actor and wait for it to finish
run = client.actor("steadfetch/huggingface-dataset-extractor").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 '{
  "mode": "search",
  "keyword": "medical",
  "maxResults": 10,
  "strictSchema": true
}' |
apify call steadfetch/huggingface-dataset-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,steadfetch/huggingface-dataset-extractor"
        }
    }
}
```

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/IfpzFeRKpcA4Opwo0/builds/5xXaMKKFmnOyGRCeu/openapi.json
