# Japan Diet Proceedings Search (Kokkai) (`vespa-zzz/kokkai-speech-search`) Actor

Search public Japanese National Diet proceedings via the National Diet Library API.

- **URL**: https://apify.com/vespa-zzz/kokkai-speech-search.md
- **Developed by:** [Vespa ZZZ](https://apify.com/vespa-zzz) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 results

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

## Japan Diet Proceedings Search (Kokkai)

Search public Japanese National Diet proceedings through the National Diet Library (NDL) search API. The Actor writes one dataset item per matching speech or meeting, with links back to the original proceedings. No API key is required. [NDL API documentation](https://kokkai.ndl.go.jp/api.html)

| Mode | Dataset item |
| --- | --- |
| `speech` (default) | One matching speech, including its text and meeting metadata. |
| `meeting_list` | One matching meeting with links to matching speeches when available. |
| `meeting` | One matching meeting with the text of all speeches in that meeting. |

The `meeting` mode returns up to 10 meetings per request. With `maxResults: 1000` and that many matches, expect about 100 requests and five minutes or more at the default request interval.

### Output fields in speech mode

Each item in `speech` mode has the following fields. Missing values are written as `null`.

| Field | Description |
| --- | --- |
| `speechId` | NDL speech identifier. |
| `issueId` | NDL meeting record identifier. |
| `session` | Number of the Diet session. |
| `nameOfHouse` | House or joint body that held the meeting. |
| `nameOfMeeting` | Name of the plenary, committee, or other meeting. |
| `issue` | Issue number of the meeting record, such as `第1号`. |
| `date` | Meeting date in `YYYY-MM-DD` format. |
| `speechOrder` | Numeric position of the speech in the meeting record. |
| `speaker` | Speaker name as recorded in the proceedings. |
| `speakerYomi` | Japanese reading of the speaker name. |
| `speakerGroup` | Speaker's parliamentary group as recorded in the proceedings. |
| `speakerPosition` | Speaker's title or position as recorded in the proceedings. |
| `speakerRole` | Role in the meeting, such as witness. |
| `speech` | Speech text. |
| `startPage` | Page on which the speech begins. |
| `speechURL` | URL of the speech in the NDL proceedings. |
| `meetingURL` | URL of the full meeting transcript. |
| `pdfURL` | URL of the meeting record PDF, when available. |

### Input examples

Include at least one search condition, such as `any`, `speaker`, `nameOfMeeting`, or `from`. Use spaces between keywords to require every term. Use spaces in `speaker` or `nameOfMeeting` to match any term. Dates use `YYYY-MM-DD`. With a single session bound, the API searches that session only. [NDL search parameters](https://kokkai.ndl.go.jp/api.html)

Find up to five speeches mentioning generative AI from January 2025 onwards.

```json
{
  "any": "生成AI",
  "from": "2025-01-01",
  "maxResults": 5
}
```

Find House of Representatives budget committee meetings in a date range.

```json
{
  "mode": "meeting_list",
  "nameOfHouse": "衆議院",
  "nameOfMeeting": "予算委員会",
  "from": "2025-01-01",
  "until": "2025-03-31",
  "maxResults": 20
}
```

### Example dataset item

This abbreviated speech item uses illustrative values. In the meeting modes, `speechRecord` contains an array of speech records. The Actor uses `speechId` and `issueId` for identifiers and numbers for `session` and `speechOrder`.

```json
{
  "speechId": "121705261X00120250124_001",
  "issueId": "121705261X00120250124",
  "session": 217,
  "nameOfHouse": "衆議院",
  "nameOfMeeting": "本会議",
  "date": "2025-01-24",
  "speaker": "発言者名",
  "speechOrder": 1,
  "speech": "生成AIの利用について議論します。",
  "speechURL": "https://kokkai.ndl.go.jp/txt/121705261X00120250124/1"
}
```

### Use cases

- Schedule daily monitoring for a bill name such as `子ども・子育て支援法` or a policy keyword such as `生成AI`. Review new matches and use `speechURL` to read each mention in context.
- Follow a committee's proceedings over a session. For example, use `meeting_list` and `nameOfMeeting: "予算委員会"` to build a timeline of Budget Committee meetings, then open each `meetingURL` to read the full proceedings.
- Verify a quotation for a news article by searching for its wording and meeting date, then link to the matching `speechURL`.
- Build a retrieval-augmented generation (RAG) corpus. Export `speech` records for a defined topic and date range, and retain `date`, `nameOfMeeting`, and `speechURL` with each text chunk so answers can cite the original proceedings.

#### Policy monitoring with a daily keyword search

Create an Actor task with this input and schedule it to run daily. This example tracks Diet speeches mentioning generative AI.

```json
{
  "mode": "speech",
  "any": "生成AI",
  "onlyNew": true,
  "stateKey": "policy-generative-ai",
  "maxResults": 100
}
```

On the first run for a `stateKey`, the Actor writes up to `maxResults` of the newest matches and marks the successfully written items as seen. Later runs skip items already saved under that key and can stop at a page made up entirely of seen items, skipping all older matches beyond that page. If the first run reaches the cap partway through a page, older matches left on that page can still appear on later runs. To collect historical matches, run a regular search with `onlyNew: false` before enabling monitoring.

`maxResults` caps new items per run. The `kokkai-speech-search-state` key-value store keeps up to 20,000 successfully saved IDs per key, using `speechId` for speeches and `issueId` for either meeting mode. A failed push can be retried on the next run if the search still returns the record.

When the pay-per-event spending limit is reached, the run stops with a warning. The next monitoring run continues past the earlier cutoff and retries remaining records that still match the search.

Reuse the same key for the same search and give each different search its own key. Run one task at a time per key.

### Request pacing and reuse

The Actor sends requests sequentially. `requestIntervalSecs` defaults to `3` seconds, and retries can take longer. Keep searches focused and reuse saved datasets to reduce repeat requests. [NDL API terms of use](https://kokkai.ndl.go.jp/api.html)

Follow the NDL website content terms. Copyright in individual speeches generally belongs to the speakers. The NDL holds copyright in the database and in speeches by NDL staff. Japan's Copyright Act allows certain uses of public political speeches under Article 40 and certain information analysis under Article 30-4, subject to each provision's conditions. Users are responsible for confirming whether their reuse requires permission. [NDL website content terms](https://www.ndl.go.jp/sitepolicy/terms) · [NDL proceedings API terms](https://kokkai.ndl.go.jp/api.html) · [Japan's Copyright Act](https://laws.e-gov.go.jp/law/345AC0000000048)

### Run locally

Use Node.js 22 and the Apify CLI. Save an input example as UTF-8 in `input.json` in this directory and run the following commands.

```sh
npm install
npm test
apify run --purge --input-file ./input.json
```

The local default dataset is stored in `storage/datasets/default/`.

### 日本語

国立国会図書館の公開 API で国会会議録を検索し、発言や会議ごとに原文へのリンク付きで保存します。上の1つ目の例は、2025年1月1日以降の「生成AI」を含む発言を最大5件取得します。政策動向の把握、報道の資料調査、RAG や AI エージェントの参照データ作成に使えます。発言を再利用するときは、利用規約と著作権法の適用条件をご確認ください。 [国会会議録検索 API 仕様・利用条件](https://kokkai.ndl.go.jp/api.html)

#### 政策モニタリング: キーワードで毎日スケジュール実行

上の政策モニタリング例を Actor タスクの入力に設定し、毎日実行するようスケジュールします。`onlyNew: true` の初回は、新しい順に最大 `maxResults` 件を出力し、出力に成功した分を既読にします。次回以降は同じ `stateKey` の既読分を除き、全件が既読のページに達して打ち切ると、それより古い一致は取得しません。初回にページの途中で上限に達した場合、そのページに残った古い一致が次回以降に出力されることがあります。過去分も必要なら、監視を始める前に通常モード（`onlyNew: false`）で取得してください。キーワードやモードの異なるタスクには別のキーを指定します。

# Actor input Schema

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

Speech returns individual matching speeches with text. Meeting list returns matching meetings with links to matching speeches when available. Full meeting returns matching meetings with the text of all speeches in each meeting.

## `any` (type: `string`):

Search for words in the proceedings. Separate words with spaces to require all words (AND). For example, 生成AI means generative AI.

## `speaker` (type: `string`):

Search for a speaker by name. Separate terms with spaces to match any of them (OR).

## `nameOfHouse` (type: `string`):

Limit the search to the House of Representatives, House of Councillors, or joint proceedings.

## `nameOfMeeting` (type: `string`):

Search by plenary or committee name. Separate terms with spaces to match any of them (OR).

## `speakerGroup` (type: `string`):

Search for part of the official name of the speaker's parliamentary group.

## `speakerPosition` (type: `string`):

Search for part of the speaker's title or position as recorded in the proceedings.

## `speakerRole` (type: `string`):

Limit the search to witnesses, invited experts, or public hearing speakers.

## `from` (type: `string`):

Include meetings on or after this date (YYYY-MM-DD).

## `until` (type: `string`):

Include meetings on or before this date (YYYY-MM-DD).

## `sessionFrom` (type: `integer`):

Start of the inclusive session range. If only one bound is set, search only that session.

## `sessionTo` (type: `integer`):

End of the inclusive session range. If only one bound is set, search only that session.

## `searchRange` (type: `string`):

Search the opening, main proceedings, or both. Applies when keywords are provided. The API searches both sections by default.

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

Maximum number of speeches or meetings to write to the dataset.

## `requestIntervalSecs` (type: `number`):

Seconds to wait after an API response. Retries may wait longer.

## `onlyNew` (type: `boolean`):

The first run saves up to maxResults of the newest matches and marks them as seen. Later runs skip seen items and can stop at an all-seen page, skipping older matches beyond it. Older matches left on a partially processed page may still appear later. To collect historical matches, first run with onlyNew set to false.

## `stateKey` (type: `string`):

Use a separate key for each monitored search. Use 1 to 50 letters, digits, hyphens, or underscores.

## Actor input object example

```json
{
  "mode": "speech",
  "any": "生成AI",
  "nameOfMeeting": "予算委員会",
  "from": "2025-01-01",
  "until": "2025-12-31",
  "sessionFrom": 217,
  "sessionTo": 219,
  "maxResults": 5,
  "requestIntervalSecs": 3,
  "onlyNew": false,
  "stateKey": "default"
}
```

# Actor output Schema

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

No description

## `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 = {
    "any": "生成AI",
    "from": "2026-01-01"
};

// Run the Actor and wait for it to finish
const run = await client.actor("vespa-zzz/kokkai-speech-search").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 = {
    "any": "生成AI",
    "from": "2026-01-01",
}

# Run the Actor and wait for it to finish
run = client.actor("vespa-zzz/kokkai-speech-search").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 '{
  "any": "生成AI",
  "from": "2026-01-01"
}' |
apify call vespa-zzz/kokkai-speech-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,vespa-zzz/kokkai-speech-search"
        }
    }
}
```

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/9EAwe2vam46ZLVvec/builds/quAFTyIztdimKV5Mn/openapi.json
