# Ofgem Consultation Deadline Scraper (`vixendata/ofgem-consultation-deadline-scraper`) Actor

Export public Ofgem consultation deadlines, source statuses, topics and document links from supplied URLs and the recent consultation page.

- **URL**: https://apify.com/vixendata/ofgem-consultation-deadline-scraper.md
- **Developed by:** [Vixendata](https://apify.com/vixendata) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 recognized consultation/publication/alert metadata records

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

## Ofgem Consultation Deadline Scraper

Export consultation closing dates and official statuses from Ofgem into an Apify dataset for regulatory calendars, supplier compliance teams and energy-policy monitoring. Get structured metadata with auditable source links instead of manually copying dates.

**Coverage:** supplied public consultation URLs, optionally supplemented by the recent links visible on https://www.ofgem.gov.uk/consultations. This version does **not** crawl the full archive, execute the JavaScript archive listing, or search Ofgem. It is a snapshot exporter, not a persistent change monitor. Schedule runs and compare exported rows in your own workflow if needed.

### Quick start

Use the default input to discover recent consultations. For a reproducible example:

```json
{
  "consultationUrls": [
    "https://www.ofgem.gov.uk/consultation/heat-network-regulation-authorisation-application-arrangements"
  ],
  "discoverRecent": false,
  "maxItems": 10,
  "status": "all",
  "publishedSince": "2026-10-01"
}
```

The example source was checked on 5 October 2026. It had publication date `2026-10-05`, closing date `2026-11-02`, source status `Open`, topic `Heat networks`, and four attached publication document links. Source content can change.

### Input

- `consultationUrls`: up to 50 exact public HTTPS `www.ofgem.gov.uk/consultation/slug` URLs. Credentials, other hosts, ports, queries, fragments and arbitrary paths are rejected. Explicit URLs have priority.
- `discoverRecent`: defaults to `true`; reads only the recent main-page HTML links. Turn off for explicit URL-only runs.
- `maxItems`: 1–50 matching records, default 10. A maximum of 50 detail URLs are checked even when filters exclude many records.
- `status`: `all` (default), `open` or `closed`. Uses the label printed by Ofgem, case-insensitively. It does not calculate status from the deadline.
- `publishedSince`: optional inclusive `YYYY-MM-DD` filter. Records without parseable publication dates are excluded when this is set.

### Output

One row per successfully parsed, matching consultation:

- `title`, `publicationType`
- `publishedDate`, `closingDate`: ISO dates or null. These are dates only; no deadline time/time zone is inferred.
- `publishedDateRaw`, `closingDateRaw`: source text, retained for audit and unusual dates
- `status`: source label or null
- `topics`: visible source topics
- `sector`: visible sector label, or null when absent. Topics are not silently substituted for sectors.
- `documentUrls`: links marked by Ofgem as attached publication documents; inline references are not included. Documents are never downloaded.
- `sourceUrl`, `retrievedAt` (UTC), `warnings`, `attribution`

Missing closing dates stay null. No deadlines, obligations or statuses are invented. This feed is informational and does not provide legal or regulatory advice.

Download dataset output as JSON, CSV or Excel through Apify. The default key-value store also contains `RUN_SUMMARY` with request counts, records, errors and the coverage limitation. Errors mark the run failed/incomplete; already exported rows are retained, so inspect the summary before relying on a partial dataset. An empty, error-free result can mean the chosen filters excluded the checked subset, not that Ofgem has no consultations.

### Access, load and limits

Only public pages on the fixed Ofgem host are requested. The actor checks `/robots.txt` before pages and fails closed if unavailable, malformed or disallowing access. Requests are sequential with a two-second minimum gap, bounded response sizes and timeouts, and at most 52 total requests (robots, recent listing, 50 details). It does not follow redirects, retry denials, use login, download attachments, accept proxy input, solve challenges or use evasion. HTTP 401, 403 or 429 stops the entire source immediately. The runtime's normal networking transport is used.

A more restrictive crawl delay stops page requests. Changed HTML, unavailable pages and source access limits can prevent completion. Bulk historical coverage and automatic cross-run deadline/status change detection are not included.

### Attribution and reuse

Contains public sector information from Ofgem licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/). See [Ofgem copyright and reuse terms](https://www.ofgem.gov.uk/c-ofgem-2026). Third-party material is excluded from that licence; document URLs are supplied for reference, without copying their contents. Preserve attribution and source links when redistributing eligible metadata, and check rights before reusing linked materials.

### Local development

Python 3.12:

```sh
pip install -r requirements.txt
python main.py
```

This uses Apify SDK local storage outside the platform. Supply `INPUT.json` in the default local key-value store, or use the Apify console input form after uploading/building the actor. No account secrets or external integration configuration are needed by the scraper itself.

# Actor input Schema

## `consultationUrls` (type: `array`):

Up to 50 public HTTPS www.ofgem.gov.uk/consultation/slug URLs. Explicit URLs run before recent discovery; only this exact host and path are fetched.

## `discoverRecent` (type: `boolean`):

Read links visible on the main /consultations HTML page. This is a recent subset, not the full archive or search results.

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

Stop after this many matching records, from 1 to 50. At most 50 detail URLs are checked regardless of filters.

## `status` (type: `string`):

Match the status printed by Ofgem. Open/closed are not inferred from dates. Unknown or absent statuses match only all.

## `publishedSince` (type: `string`):

Optional inclusive YYYY-MM-DD publication-date filter. Missing or unparseable dates do not match. Leave empty for no date filter.

## Actor input object example

```json
{
  "consultationUrls": [],
  "discoverRecent": true,
  "maxItems": 10,
  "status": "all",
  "publishedSince": ""
}
```

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

// Run the Actor and wait for it to finish
const run = await client.actor("vixendata/ofgem-consultation-deadline-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("vixendata/ofgem-consultation-deadline-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 vixendata/ofgem-consultation-deadline-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,vixendata/ofgem-consultation-deadline-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/ppCPjcD8NUUyBS2FY/builds/wtMgKVWUTWa8bKhmC/openapi.json
