# Meteociel Historical Scraper (`valentin-b117/meteociel-historical-scraper`) Actor

Get the historical weather for a specific city and date

- **URL**: https://apify.com/valentin-b117/meteociel-historical-scraper.md
- **Developed by:** [Valentin B117](https://apify.com/valentin-b117) (community)
- **Categories:** Automation, Developer tools
- **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 and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## MeteoCiel Historical Scraper

Scrape **hourly historical weather observations** from [meteociel.fr](https://www.meteociel.fr) for any station and date range. Each row in the output is one hour of recorded data: temperature, humidity, pressure, wind, rainfall, and weather condition.

### What does it scrape?

MeteoCiel publishes hourly observation tables for thousands of WMO and ICAO weather stations worldwide. This Actor fetches those pages day by day and turns them into structured JSON rows, one per hour.

Supported station types:
- French and European WMO official stations (13-column table layout)
- ICAO airport stations (11-column reduced layout)
- Personal and private network stations

### Why use this Actor?

- **Historical weather for any location** — back-fill climate data, validate models, or enrich datasets with weather context
- **Structured output** — clean JSON ready for analysis, no HTML parsing on your side
- **No API key needed** — data comes directly from the public MeteoCiel pages
- **Flexible station lookup** — provide a station code directly, or just type a city name and the Actor resolves it automatically

Typical use cases: correlating sales or energy consumption with weather, training ML models, building climate dashboards, or archiving observations for a specific location.

### How to use it

1. Go to the **Input** tab in Apify Console
2. Enter a **city name** (e.g. `Paris`) or a **station code** (e.g. `7156`)
3. Set **Start date** and **End date** in `YYYY-MM-DD` format
4. Click **Start** — the Actor scrapes one page per day and writes hourly rows to the dataset

### Input

| Field | Type | Required | Description |
|---|---|---|---|
| `stationCode` | string | no | Meteociel numeric station code (e.g. `7156` for Paris-Montsouris). Auto-resolved from `cityName` if omitted. |
| `cityName` | string | no | City or station name used to look up the station (e.g. `Lyon`, `Praha`). Also used as a label in the output. At least one of `stationCode` or `cityName` is required. |
| `dateFrom` | string | **yes** | First day to scrape — `YYYY-MM-DD` |
| `dateTo` | string | **yes** | Last day to scrape — `YYYY-MM-DD` |
| `delayMs` | number | no | Milliseconds to wait between requests (default: `2000`) |
| `maxRetries` | number | no | Max retries per failed request (default: `3`) |

Example input:

```json
{
  "cityName": "Paris",
  "dateFrom": "2024-01-01",
  "dateTo": "2024-01-31"
}
````

### Output

One JSON object per hourly observation, pushed to the default dataset. You can download it as JSON, CSV, Excel, or XML from the Apify Console.

Example row:

```json
{
  "city": "Paris",
  "stationCode": "7156",
  "date": "2024-01-15",
  "hour": "12:00",
  "temperature_c": 8.2,
  "humidity_pct": 76,
  "pressure_hpa": 1012.4,
  "wind_speed_kmh": 15,
  "wind_direction": "SO",
  "rainfall_mm": 0,
  "weather_condition": "Couvert"
}
```

### Data fields

| Field | Format | Description |
|---|---|---|
| `city` | string | City or station name as provided in the input |
| `stationCode` | string | Meteociel numeric station identifier |
| `date` | `YYYY-MM-DD` | Observation date |
| `hour` | `HH:MM` | Observation hour (local time) |
| `temperature_c` | number | Temperature in °C |
| `humidity_pct` | number | Relative humidity in % |
| `pressure_hpa` | number | Atmospheric pressure in hPa |
| `wind_speed_kmh` | number | Average wind speed in km/h |
| `wind_direction` | string | Wind direction code (e.g. `N`, `SSO`, `NNE`) |
| `rainfall_mm` | number | Rainfall in mm (`0` when none recorded) |
| `weather_condition` | string | null | Observed weather condition in French (full-layout stations only) |

### Cost and performance

Each day of data is one HTTP request. A one-year scrape for one station is 365 requests, typically completing in 15–20 minutes with the default 2-second delay between requests.

This Actor uses usage-based pricing:

| Event | Price |
|---|---|
| Result (`apify-default-dataset-item`) | $0.50 / 1,000 items |
| Actor start (`apify-actor-start`) | $0.00001 |

A one-year scrape produces ~8,760 hourly rows (~$4.38) plus a one-time start fee.

### Finding a station code

If you know the city name, just set `cityName` — the Actor queries the MeteoCiel station search API automatically and picks the best match (WMO official stations preferred over ICAO, then private networks).

To find a code manually, browse to a station page on [meteociel.fr](https://www.meteociel.fr) and note the `code2=` parameter in the URL.

### Legal notice

This Actor scrapes publicly available pages on meteociel.fr for personal and research use. Always respect the site's Terms of Service and do not overload the server. The default delay of 2 seconds between requests is intentional. The authors are not affiliated with MeteoCiel.

# Actor input Schema

## `stationCode` (type: `string`):

Meteociel numeric station code (e.g. 7156 for Paris-Montsouris). If omitted, the code is resolved automatically from cityName.

## `cityName` (type: `string`):

City or station name used to look up the station code when stationCode is not provided (e.g. "Lyon", "Bordeaux"). Also used as a label in the output.

## `dateFrom` (type: `string`):

First day to scrape, in YYYY-MM-DD format.

## `dateTo` (type: `string`):

Last day to scrape, in YYYY-MM-DD format.

## `delayMs` (type: `number`):

Delay in milliseconds between individual page requests to avoid overwhelming the server. Adjust as needed based on the target site's responsiveness and your scraping needs.

## `maxRetries` (type: `number`):

Maximum number of retry attempts for failed requests. Set to 0 to disable retries.

## Actor input object example

```json
{
  "stationCode": "7156",
  "cityName": "Paris",
  "dateFrom": "2024-01-01",
  "dateTo": "2024-01-05",
  "delayMs": 1000,
  "maxRetries": 3
}
```

# Actor output Schema

## `observations` (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 = {
    "stationCode": "7156",
    "cityName": "Paris",
    "dateFrom": "2024-01-01",
    "dateTo": "2024-01-05"
};

// Run the Actor and wait for it to finish
const run = await client.actor("valentin-b117/meteociel-historical-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 = {
    "stationCode": "7156",
    "cityName": "Paris",
    "dateFrom": "2024-01-01",
    "dateTo": "2024-01-05",
}

# Run the Actor and wait for it to finish
run = client.actor("valentin-b117/meteociel-historical-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 '{
  "stationCode": "7156",
  "cityName": "Paris",
  "dateFrom": "2024-01-01",
  "dateTo": "2024-01-05"
}' |
apify call valentin-b117/meteociel-historical-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Meteociel Historical Scraper",
        "description": "Get the historical weather for a specific city and date",
        "version": "0.1",
        "x-build-id": "i4umMnYbbAbHcEORR"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/valentin-b117~meteociel-historical-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-valentin-b117-meteociel-historical-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/valentin-b117~meteociel-historical-scraper/runs": {
            "post": {
                "operationId": "runs-sync-valentin-b117-meteociel-historical-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/valentin-b117~meteociel-historical-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-valentin-b117-meteociel-historical-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "dateFrom",
                    "dateTo"
                ],
                "properties": {
                    "stationCode": {
                        "title": "Station code",
                        "type": "string",
                        "description": "Meteociel numeric station code (e.g. 7156 for Paris-Montsouris). If omitted, the code is resolved automatically from cityName."
                    },
                    "cityName": {
                        "title": "City / station name",
                        "type": "string",
                        "description": "City or station name used to look up the station code when stationCode is not provided (e.g. \"Lyon\", \"Bordeaux\"). Also used as a label in the output."
                    },
                    "dateFrom": {
                        "title": "Start date",
                        "type": "string",
                        "description": "First day to scrape, in YYYY-MM-DD format."
                    },
                    "dateTo": {
                        "title": "End date",
                        "type": "string",
                        "description": "Last day to scrape, in YYYY-MM-DD format."
                    },
                    "delayMs": {
                        "title": "Delay between requests (ms)",
                        "type": "number",
                        "description": "Delay in milliseconds between individual page requests to avoid overwhelming the server. Adjust as needed based on the target site's responsiveness and your scraping needs.",
                        "default": 1000
                    },
                    "maxRetries": {
                        "title": "Max retries",
                        "type": "number",
                        "description": "Maximum number of retry attempts for failed requests. Set to 0 to disable retries.",
                        "default": 3
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
