# Canadian Parliament Scraper - Bills, MPs & Votes (`ninhothedev/canada-parliament-scraper`) Actor

$0.5/1K 🔥 Canadian Parliament scraper! Bills, votes & MPs with statuses, sponsors and tallies. No key. JSON, CSV, Excel or API in seconds. Power civic tech & policy monitoring ⚡

- **URL**: https://apify.com/ninhothedev/canada-parliament-scraper.md
- **Developed by:** [ninhothedev](https://apify.com/ninhothedev) (community)
- **Categories:** News, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Canadian Parliament Bills & MPs Scraper

Scrape **Canadian federal Parliament data** — bills, Members of Parliament and House of Commons votes — straight from [openparliament.ca](https://openparliament.ca), the open-data mirror of Canada's LEGISinfo and Hansard records. **No API key, no login, no cookies.**

Pick a mode, optionally pin a parliamentary session (e.g. `45-1`), and get one clean row per bill, MP or vote, ready for JSON, CSV, Excel or a direct API pull into your own database.

***

### What you get

#### Mode: `bills`

Every federal bill (Commons `C-` and Senate `S-` bills) with its legislative status:

| Field | Example |
|---|---|
| `bill_number` | `C-3` |
| `session` | `45-1` |
| `legisinfo_id` | `13546143` |
| `name` | `An Act to amend the Citizenship Act (2025)` |
| `name_fr` | `Loi modifiant la Loi sur la citoyenneté (2025)` |
| `short_title` | `Citizenship Act amendment` |
| `status` | `Law (royal assent given)` |
| `home_chamber` | `House` |
| `introduced` | `2025-06-05` |
| `is_law` | `true` |
| `is_private_member_bill` | `false` |
| `sponsor_url` / `sponsor_name` | `https://openparliament.ca/politicians/lena-metlege-diab/` / `Lena Metlege Diab` |
| `text_url`, `vote_count`, `url` | full bill text, number of recorded votes, public page |

#### Mode: `politicians`

Current MPs with `name`, `given_name`, `family_name`, `party`, `riding`, `province`, `gender`, `image_url` and `url`.

#### Mode: `votes`

Recorded divisions in the House of Commons with `vote_number`, `date`, `description`, `result`, `yea_total`, `nay_total`, `paired_total`, `total_votes` (yea + nay), a `passed` boolean and the linked `bill_url`.

Every record also carries `type`, `source` (`openparliament`) and `scraped_at`.

***

### Input

```json
{
  "mode": "bills",
  "session": "45-1",
  "maxItems": 200
}
```

| Input | Type | Default | Notes |
|---|---|---|---|
| `mode` | select | `bills` | `bills`, `politicians` or `votes` |
| `session` | string | *(empty)* | `parliament-session`, e.g. `45-1`, `44-1`. Empty = all sessions |
| `maxItems` | integer | `200` | 1 – 2000 records |

***

### Pricing

Runs on the **512 MB** memory setting and is pure JSON API traffic — no browser, no proxy required. Expect roughly **$0.5 per 1,000 records** in Apify platform usage. Votes are the cheapest mode (one request per 100 records); bills and MPs add one detail request per record to fill in status, sponsor, gender and name parts.

***

### Use cases

- **Civic tech** — power a "what is Parliament doing" dashboard, bot or newsletter with live bill statuses.
- **Policy monitoring** — watch a session for bills reaching royal assent, second reading or committee.
- **Lobbying research** — map sponsors, private member bills and vote margins by party and riding.
- **Journalism** — pull vote splits (yea/nay/paired) for a story in seconds instead of scraping Hansard PDFs.
- **Academic & data science** — build historical legislative datasets going back decades.

***

### Notes on the data source

openparliament.ca offers a **free, key-less API** but asks every automated client to identify itself with a **contact User-Agent**. This actor always sends `apify-actor/1.0 (daniello@biwo-bauwelt.com)` and throttles requests (~0.3 s between calls) so the volunteer-run service is never hammered. Data originates from the Parliament of Canada (LEGISinfo, House of Commons Hansard) and is republished by openparliament.ca; check their terms before commercial redistribution.

The API returns **bilingual language dictionaries** (`{"en": ..., "fr": ...}`) for titles, statuses and vote descriptions. This actor flattens them to plain English strings (with `name_fr` kept for bills), so you never see a raw `{'en': ...}` blob in your dataset.

***

### Related actors

- [Federal Register Scraper](https://apify.com/ninhothedev/federal-register-scraper) — US federal rules and notices
- [USAspending Scraper](https://apify.com/ninhothedev/usaspending-scraper) — US federal award and contract data
- [EU Open Data Scraper](https://apify.com/ninhothedev/eu-opendata-scraper) — EU institutional open datasets
- [UK Police Scraper](https://apify.com/ninhothedev/uk-police-scraper) — UK street-level crime and policing data

***

### Local development

```bash
pip install -r requirements.txt
python -m src.main
python tests/test_mapping.py   # offline, no third-party deps
```

**Keywords:** Canadian Parliament scraper, openparliament.ca API, Canada bills scraper, Canadian MP data, House of Commons votes, LEGISinfo scraper, Canadian legislation API, parliament open data, civic tech Canada, policy monitoring Canada.

# Actor input Schema

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

Which Canadian Parliament dataset to collect. 'bills' returns federal bills with number, title, status, sponsor and chamber. 'politicians' returns Members of Parliament with party, riding and province. 'votes' returns House of Commons votes with yea/nay/paired totals and the outcome.

## `session` (type: `string`):

Optional session filter in the format 'parliament-session', for example '45-1' for the 1st session of the 45th Parliament or '44-1'. Leave empty to scrape across all sessions. Applies to bills and votes; the MP list always returns the current sitting members.

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

Maximum number of records to push to the dataset. The scraper paginates the openparliament.ca API until this number is reached. Bills and MPs also fetch one detail request per record, so lower values finish noticeably faster.

## Actor input object example

```json
{
  "mode": "bills",
  "session": "45-1",
  "maxItems": 200
}
```

# 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("ninhothedev/canada-parliament-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("ninhothedev/canada-parliament-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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 ninhothedev/canada-parliament-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=ninhothedev/canada-parliament-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/MGwoz3PhJfCO5cobX/builds/mha9v4Rdbm2Rjqvel/openapi.json
