# Hong Kong Jobs & Salary Scraper (`jobsapi/hongkong-jobs-search-scraper`) Actor

Extract public Hong Kong government vacancies with search, single, and multiple modes plus rich official detail fields and local-only quality metadata.

- **URL**: https://apify.com/jobsapi/hongkong-jobs-search-scraper.md
- **Developed by:** [Jobs API](https://apify.com/jobsapi) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 hongkong job records

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## Hong Kong Jobs Search Scraper

This Actor reads public Hong Kong Government Vacancies Advertising & Enquiry System pages. Search mode parses the official public vacancy list and, by default, enriches each result from its official `JVE_003.action` detail page. Single and multiple modes accept public numeric vacancy IDs or official detail URLs.

### Vacancy records

Job rows keep source-published vacancy facts separate from execution metadata. Depending on what the listing and detail page expose, useful fields include the job ID, title, department, salary text and parsed HKD amount/period, entry requirements, posting/advertising/closing dates, civil-service category, employment type, and the detail URL. Enriched detail records preserve the named sections separately: `note`, `duties`, `termsOfAppointment`, `fringeBenefits`, and `generalNotes`; `descriptionSections` retains section labels with their text, while `description` and `descriptionHtml` provide combined representations. Application instructions, filtered apply/online links, contact address, the published `departmentWebsite`, and enquiry telephone are retained when published. Commented-out source markup (for example a disabled duplicate department link) is excluded from all extracted text.

Public attachments are represented by `attachments` entries (`title` and `url`) and the convenience list `attachmentUrls`. `applicationLinks` is reserved for links identified as application or online-application routes; it is not a dump of every link on the detail page. Missing source facts are omitted rather than filled with guesses.

Chrome spot checks of the official detail pages confirmed source-specific content: vacancy `45204` (Contract Senior Doctor) exposes HKD 139,825/month plus gratuity, requirements, duties, appointment terms, benefits, application details, and contact information; vacancy `50151` (Medical and Health Officer) exposes an HKD 79,410–134,920/month range, registration/language requirements, duties and appointment notes, plus a published PDF attachment. These examples document the fields visible on those pages, not a promise that every vacancy contains every field.

The Dataset contains only `recordType: "hongkong-government-job"` records that have a successful detail receipt, a readable detail description, and more than 20 distinct meaningful source facts. Listing-only, incomplete, diagnostic, dummy, and fixture items are withheld. Diagnostics, request receipts, and run summaries are kept in the key-value store, never as Dataset rows. A confirmed source denial or security challenge stops requests and discards buffered vacancy rows.

Run summaries separate Apify platform `status` (`SUCCEEDED` or `FAILED`) from extraction `resultStatus` (`COMPLETE`, `LIMITED`, `SKIPPED`, `DEFERRED`, `NO_DATA`, or `FAILED`). Stored-row counts include only Dataset writes whose awaited calls succeeded. Ambiguous empty listings, parse misses, and network or tool failures are `DEFERRED`; `SKIPPED` requires source denial evidence. `NO_DATA` requires a successful official response with an explicit empty-results signal. This Actor currently has no affirmative empty-results detector, so an unrecognized empty response remains `DEFERRED`.

`fieldCoverage`, `nonEmptyTopLevelFields`, and the required/optional percentages describe emitted keys and presence checks. They are not counts of distinct source facts: aliases such as `academicRequirement`/`entryRequirements` or `duties`/`responsibilities`, and request/provenance metadata, must not be counted as extra content. The dataset table prioritizes job-specific fields; the schema separately describes the execution and receipt fields emitted by the current Actor.

### Inputs

- `mode`: `search` (default), `single`, or `multiple`.
- `sourceUrl`: optional official public vacancy page; defaults to the English vacancy listing.
- `jobIds` / `jobId` or `jobUrls` / `jobUrl` / `urls`: public numeric IDs or official detail URLs for single/multiple mode.
- `keyword`: optional case-insensitive listing filter over title, department, and entry requirements.
- `jobType`: `all` (default), `civil_service`, or `non_civil_service`.
- `maxItems`: maximum number of results, from 1 to 100 (default 25).
- `includeDetails`: fetch details in search mode (default `true`). When disabled, listing rows are withheld because they do not meet the complete-record Dataset contract.
- `timeoutSecs` and `requestDelayMs`: bounded per-request timeout and polite request spacing.

Only official public HTTPS government pages on the Actor's allowlist are accepted. A failed or incomplete detail extraction is recorded in the key-value summary and that candidate is withheld; if other complete records were stored, the extraction result is `LIMITED`. An explicit source block or challenge stops the run and discards all buffered job rows.

### Local verification

```bash
npm install
npm test
npm run lint
apify validate-schema
apify run --purge --input-file INPUT.json
apify run --purge --input-file INPUT-single.json
apify run --purge --input-file INPUT-multiple.json
npm run validate
```

These commands describe local verification. No Cloud push or Cloud run is claimed by this documentation.

# Actor input Schema

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

Search public vacancies, fetch one public vacancy, or fetch several public vacancies.

## `sourceUrl` (type: `string`):

Optional official public Hong Kong government vacancy page on csboa.csb.gov.hk or csb.gov.hk. The default is the public English vacancy listing. The Actor rejects other hosts and non-HTTPS URLs.

## `jobIds` (type: `array`):

Numeric public Hong Kong government vacancy IDs for single or multiple mode.

## `jobId` (type: `string`):

Numeric public Hong Kong government vacancy ID.

## `jobUrls` (type: `array`):

Official public vacancy detail URLs for single or multiple mode.

## `jobUrl` (type: `string`):

Public official vacancy detail URL.

## `urls` (type: `array`):

Compatibility alias for jobUrls in single or multiple mode.

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

Optional case-insensitive filter over public title, department, and entry requirements.

## `jobType` (type: `string`):

Optional public vacancy category filter.

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

Maximum normalized public vacancy rows to emit.

## `includeDetails` (type: `boolean`):

Fetch official public vacancy details for duties, requirements, terms, benefits, and application fields. Enabled by default so search mode returns enriched records.

## `timeoutSecs` (type: `integer`):

Maximum time allowed for each public request. Retries, request headers, and concurrency are fixed by the Actor.

## `requestDelayMs` (type: `integer`):

Small polite delay before each public request.

## Actor input object example

```json
{
  "mode": "search",
  "sourceUrl": "https://csboa1.csb.gov.hk/csboa/joa/JVE_001.action",
  "jobType": "all",
  "maxItems": 25,
  "includeDetails": true,
  "timeoutSecs": 30,
  "requestDelayMs": 75
}
```

# Actor output Schema

## `dataset` (type: `string`):

Default dataset contains only complete, detail-verified job records. Diagnostics and run outcomes are stored in the key-value summary.

## `runSummary` (type: `string`):

OUTPUT_SUMMARY: record counts, request receipts, run status, and timing for this execution.

## `runHealth` (type: `string`):

RUN_HEALTH: run summary plus the Actor's direct-source access-policy statement.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("jobsapi/hongkong-jobs-search-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("jobsapi/hongkong-jobs-search-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 '{}' |
apify call jobsapi/hongkong-jobs-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jobsapi/hongkong-jobs-search-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/2z2OD94PFcU67TQga/builds/RhWEaZgeffeijjgEp/openapi.json
