# Hong Kong Open Data 香港政府数据 data.gov.hk Scraper (`parseforge/data-gov-hk-hong-kong-scraper`) Actor

Scrapes dataset metadata from the Hong Kong Open Data portal (data.gov.hk). Returns one row per dataset with title, description, provider, and category. Supports keyword search or fetching by dataset ID.

- **URL**: https://apify.com/parseforge/data-gov-hk-hong-kong-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Business
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $13.00 / 1,000 result 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

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)](https://apify.com/parseforge?fpr=vmoqkp)

### Hong Kong Open Data Scraper

**Scrape Hong Kong Open Data datasets from the official data.gov.hk portal, up to a million per run.** Every dataset comes with its title, description, provider, category, and metadata. No login or API key. Export to CSV, JSON, Excel, or XML.

Hong Kong's open data portal holds thousands of public datasets, but browsing it manually is slow and the official API needs registration. This Actor reads the public catalog directly, filtered by keyword or dataset ID, and returns each match in one fixed schema.

| Who uses it | What they scrape Hong Kong Open Data for |
|---|---|
| Data journalists | Which government datasets are newly published or updated |
| Market researchers | What public data exists on a specific topic like transport or weather |
| App developers | Finding dataset IDs and metadata to integrate into their applications |
| Policy analysts | Tracking which departments release data on a given issue |

### What it does

This Actor collects Hong Kong Open Data datasets by catalog search or direct dataset ID, and returns each one as a flat row.

- 🔍 **Keyword search:** filter the catalog by any substring, case-insensitive, like 'weather' or 'traffic'.
- 📋 **Full catalog walk:** leave the search empty to collect every dataset, up to one million per run.
- 🎯 **Single dataset fetch:** get one record by its slug, e.g. aahk-team1-flight-info.
- 📦 **Fixed schema:** every row has the same fields, so you can merge runs without cleaning.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with Hong Kong Open Data data

**📊 Monitor new data releases.**

A data journalist runs the Actor weekly with an empty search to list all datasets, then checks the publication dates to spot new releases.

**🚌 Find transport datasets.**

A mobility startup searches for 'bus' or 'ferry' to get dataset IDs and metadata, then downloads the actual files from the portal.

**🌦️ Track weather data sources.**

A climate researcher searches for 'rainfall' or 'temperature' to compile a list of available datasets for a study.

**🏛️ Audit government transparency.**

A policy analyst walks the full catalog to see which departments publish data and how often it is updated.

### Why choose this scraper

|  | What you get |
|---|---|
| **No API key** | Reads the public portal directly, no registration or OAuth |
| **Up to 1M rows** | Collect the entire catalog in one run |
| **Flat output** | One row per dataset, ready for CSV or database import |
| **Two modes** | Browse with search or fetch a known ID |

### How it compares

This Actor focuses on Hong Kong government open data, while the competitors below scrape different sources like Google Maps or Instagram.

| Feature | ParseForge | Google Maps Scraper | Instagram Scraper | Instagram Reel Scraper |
|---|---|---|---|---|
| Scrapes Hong Kong government open data | Yes | Not listed | Not listed | Not listed |
| Keyword search within catalog | Yes | Not listed | Not listed | Not listed |
| Fetch single dataset by ID | Yes | Not listed | Not listed | Not listed |
| No API key required | Yes | Not listed | Not listed | Not listed |
| Export to CSV, JSON, Excel, XML | Yes | Yes | Yes | Yes |

### Configure the run

Drive the Actor from a keyword search or a single dataset ID, and set a maximum number of datasets to collect per run. The Input tab lists every parameter.

A first run with the defaults:

```json
{
  "maxItems": 10,
  "mode": "catalog",
  "searchQuery": "weather"
}
```

A larger pull:

```json
{
  "maxItems": 200,
  "mode": "catalog",
  "searchQuery": "weather"
}
```

### Pricing

Pay-per-result: **$0.01733 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $1.73 |
| 1,000 results | $17.33 |
| 10,000 results | $173.30 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [Hong Kong Open Data Scraper](https://apify.com/parseforge/data-gov-hk-hong-kong-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to Hong Kong Open Data through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/data-gov-hk-hong-kong-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check your searchQuery. It is a substring match, so try a shorter or more general term. Also ensure mode is set to catalog.

**Why does dataset mode return nothing?**

Make sure the datasetId is correct. You can find valid IDs by running catalog mode with a keyword.

**The run stops before collecting all datasets.**

Increase maxItems. The default is 10, but you can set it up to 1,000,000.

**Can I get the actual data files?**

This Actor only collects metadata. Use the download URLs in the output to fetch the files separately.

**The output has missing fields for some datasets.**

Not all datasets have every metadata field. The portal may omit some fields for certain entries.

### FAQ

| Question | Answer |
|---|---|
| Do I need an API key or registration? | No. The Actor reads the public data.gov.hk catalog pages directly, so no key or login is required. |
| What is the difference between catalog mode and dataset mode? | Catalog mode walks the full list of datasets, optionally filtered by a keyword. Dataset mode fetches one specific dataset by its ID slug. |
| How do I find a dataset ID? | You can run catalog mode with a keyword to see matching datasets and their IDs, or copy the slug from the dataset's URL on data.gov.hk. |
| Can I scrape the entire catalog? | Yes. Set mode to catalog, leave searchQuery empty, and set maxItems to a high number like 1000000. |
| What data does each dataset row include? | Each row includes the dataset's title, description, provider, category, and other metadata fields as returned by the portal. |
| Does this Actor download the actual data files? | No, it collects metadata about datasets. To get the actual files, use the download URLs provided in the metadata. |
| Can I schedule this Actor to run regularly? | Yes, you can schedule it on the Apify platform to run daily, weekly, or at any interval. |
| What export formats are supported? | You can export the results to CSV, JSON, Excel, or XML from the Apify dataset. |
| Is there a limit on how many datasets I can collect? | You can set maxItems up to 1,000,000 per run. The actual number depends on the catalog size. |
| Does the search support Chinese characters? | Yes, the search is case-insensitive and matches substrings, so you can search in English or Chinese. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Hong Kong Government. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

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

How many datasets to collect per run.

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

Choose how to source datasets.

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

Substring matched against dataset slugs in catalog mode (case-insensitive). Leave empty to walk the entire catalog.

## `datasetId` (type: `string`):

Dataset slug to fetch (e.g. aahk-team1-flight-info, ckf-team1-chuen-kee-ferry-service-fare).

## Actor input object example

```json
{
  "maxItems": 10,
  "mode": "catalog",
  "searchQuery": "weather"
}
```

# Actor output Schema

## `overview` (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 = {
    "maxItems": 10,
    "mode": "catalog",
    "searchQuery": "weather"
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/data-gov-hk-hong-kong-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 = {
    "maxItems": 10,
    "mode": "catalog",
    "searchQuery": "weather",
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/data-gov-hk-hong-kong-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 '{
  "maxItems": 10,
  "mode": "catalog",
  "searchQuery": "weather"
}' |
apify call parseforge/data-gov-hk-hong-kong-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/data-gov-hk-hong-kong-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/ektXXKULvReyc99ip/builds/A20UbtZcQ00kx61qX/openapi.json
