# Weather Scraper – Forecast & History for Any City (`biddata/weather-scraper`) Actor

Daily weather forecast and history for any city worldwide from the free Open-Meteo APIs. No API key, no browser: city name or coordinates in, one row per day out with temperatures, precipitation and a readable weather description.

- **URL**: https://apify.com/biddata/weather-scraper.md
- **Developed by:** [QIQI](https://apify.com/biddata) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 result rows

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

## Weather Scraper – Forecast & History for Any City

**Daily weather forecast and history for any city — free, key-free, no browser, with a readable weather description in every row.**

Open-Meteo is a free, open weather API that aggregates national meteorological services into one clean JSON interface. It needs no API key, no sign-up and no browser, and it covers locations worldwide.

This Actor wraps the three official Open-Meteo endpoints — geocoding, forecast and historical archive — and returns one flat row per day with high/low/average temperature, precipitation and a human-readable weather description.

### Why this Actor

| | Typical scrapers | This Actor |
|---|---|---|
| Data source | HTML weather pages, often JS-rendered | Official Open-Meteo APIs (forecast + archive) |
| API key | Usually required | None — completely free and anonymous |
| Browser / scraping stack | Headless browser, proxies, CAPTCHA handling | None — plain HTTP JSON, standard library only |
| Output | Raw numbers, coded conditions | One flat row per day, with a readable weather description |
| Coverage | Limited to scraped pages | Any city or coordinates worldwide |

### What you get

One dataset item per day.

| Field | Type | Description |
|---|---|---|
| `city` | string | Resolved city name (from geocoding) or the coordinates string when coordinates were passed directly. |
| `latitude` | number | Location latitude at full precision, in decimal degrees. |
| `longitude` | number | Location longitude at full precision, in decimal degrees. |
| `country` | string | Country of the resolved location. Empty when coordinates were passed directly. |
| `date` | string | The day this record describes, YYYY-MM-DD (local time of the location). |
| `mode` | string | Which API produced the row: forecast or history. |
| `temperature_max` | number | Daily high temperature in degrees Celsius. |
| `temperature_min` | number | Daily low temperature in degrees Celsius. |
| `temperature_avg` | number | Daily mean temperature in degrees Celsius, averaged from the hourly data; falls back to the mean of max and min when hourly data is unavailable. |
| `precipitation` | number | Total precipitation for the day in millimetres. |
| `weather_desc` | string | Readable description of the day's weather (Clear sky, Rain, Snow, Thunderstorm, ...) mapped from the WMO weather code. |

- **`latitude`** -- Passed to and returned from Open-Meteo at full precision — never rounded.
- **`temperature_avg`** -- Averaged from the hourly temperature series; when hourly data is missing it falls back to the midpoint of the daily max and min.
- **`weather_desc`** -- Mapped from the WMO weather code into plain English (e.g. 0 -> Clear sky, 63 -> Moderate rain, 73 -> Moderate snow), so no downstream decoding is needed.

### Input

| Parameter | Type | Default | Description |
|---|---|---|---|
| `city` | string | *(empty)* | **Required.** City name, e.g. "Beijing" or "New York", resolved to coordinates through Open-Meteo geocoding. You may also pass coordinates directly as "lat,lon", e.g. "39.9042,116.4074". |
| `mode` | string (enum) | `forecast` | forecast returns upcoming days; history returns past daily weather from the Open-Meteo archive. |
| `forecastDays` | integer | `7` | Number of upcoming days to return, from today onward. Only used when mode is forecast. |
| `startDate` | string | *(empty)* | First day of the historical range, YYYY-MM-DD. Only used when mode is history. Defaults to 7 days ending today. |
| `endDate` | string | *(empty)* | Last day of the historical range, YYYY-MM-DD. Only used when mode is history. Defaults to today. |

#### A note on `city`

A city name is resolved through Open-Meteo geocoding. For full control you can skip geocoding entirely and pass coordinates as "lat,lon" — for example "52.52,13.405" for Berlin.

#### A note on `mode`

forecast pulls upcoming days from the forecast API; history pulls finished days from the archive API. The two modes never mix in one run.

#### A note on `startDate`

Dates must be YYYY-MM-DD. In history mode, if you omit both dates the Actor returns the last 7 days up to today.

### Usage examples

**1. 7-day forecast for Beijing**

```json
{
  "city": "Beijing",
  "mode": "forecast",
  "forecastDays": 7
}
```

**2. Last week of history for New York**

```json
{
  "city": "New York",
  "mode": "history"
}
```

Schedule a daily forecast run for a city to track upcoming conditions, or a weekly history run to build a temperature/precipitation time series. De-duplicate on `date` to keep an ever-growing weather table.

### Data notes

- Temperatures are in degrees Celsius and precipitation in millimetres, as returned by Open-Meteo.
- The forecast endpoint covers up to 16 days ahead; `forecastDays` is clamped to that range.
- The archive endpoint has a slight reporting lag, so the most recent 1-2 days may not appear in history mode yet — use forecast mode for today and the near future.
- Coordinates are never rounded: the exact values Open-Meteo resolves or accepts are passed through to the API and returned in `latitude` / `longitude`.

### Pricing

This Actor uses pay-per-event pricing. You only pay for what you actually get.

| Event | Price | When it is charged |
|---|---|---|
| Actor start | $0.002 | Once per run |
| Result row | $0.002 per row | For every row saved to the dataset |

That works out to **$2 per 1,000 rows**. A typical run returning 50 rows costs about **$0.10** in total.

No subscription is required. You can cap your spend with the max cost per run setting in Apify Console, and an empty or invalid input charges only the start event.

### FAQ

**Do I need an API key?**

No. Open-Meteo's geocoding, forecast and archive APIs are free, public and anonymous. There is no key to obtain, store or rotate.

**Is this data reliable enough for real use?**

Open-Meteo combines models and observations from national weather services. It is intended for informational and planning use; for safety-critical decisions (aviation, outdoor events in severe weather) always confirm with an official meteorological authority.

**Why does history mode not include today?**

The historical archive is published with a small lag, typically 1-2 days, because observations need to be quality-checked. Today and the coming days belong to forecast mode.

### Related Actors

More data tools from the same publisher:

- [App Store Reviews Scraper](https://apify.com/biddata/app-reviews-scraper) - App Store and Steam user reviews with ratings, versions and dates.
- [EU Tenders Scraper](https://apify.com/biddata/ted-tenders-scraper) - EU public procurement notices from the official TED API.
- [ClinicalTrials.gov Scraper](https://apify.com/biddata/clinicaltrials-scraper) - Clinical trial records with phase, status and sponsor.
- [Federal Register Scraper](https://apify.com/biddata/federal-register-scraper) - US Federal Register documents, rules and notices.
- [arXiv Scraper](https://apify.com/biddata/arxiv-scraper) - arXiv papers with authors, abstracts and PDF links.
- [Hacker News Scraper](https://apify.com/biddata/hackernews-scraper) - Hacker News stories by keyword, top ranking or newest.

### Disclaimer

All data is retrieved in real time from **Open-Meteo**, which redistributes data from national meteorological services via its public APIs. This Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by Open-Meteo or any weather service.

Weather data is provided for informational purposes only and may be delayed, incomplete or incorrect. Do not use it for life-safety, navigation or safety-critical decisions without verification from an official meteorological authority.

# Actor input Schema

## `city` (type: `string`):

City name, e.g. "Beijing" or "New York", resolved to coordinates through Open-Meteo geocoding. You may also pass coordinates directly as "lat,lon", e.g. "39.9042,116.4074".

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

forecast returns upcoming days; history returns past daily weather from the Open-Meteo archive.

## `forecastDays` (type: `integer`):

Number of upcoming days to return, from today onward. Only used when mode is forecast.

## `startDate` (type: `string`):

First day of the historical range, YYYY-MM-DD. Only used when mode is history. Defaults to 7 days ending today.

## `endDate` (type: `string`):

Last day of the historical range, YYYY-MM-DD. Only used when mode is history. Defaults to today.

## Actor input object example

```json
{
  "city": "Beijing",
  "mode": "forecast",
  "forecastDays": 7,
  "startDate": "",
  "endDate": ""
}
```

# Actor output Schema

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

All collected records in the default dataset, one row per record.

# 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 = {
    "city": "Beijing",
    "mode": "forecast",
    "forecastDays": 7,
    "startDate": "",
    "endDate": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("biddata/weather-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 = {
    "city": "Beijing",
    "mode": "forecast",
    "forecastDays": 7,
    "startDate": "",
    "endDate": "",
}

# Run the Actor and wait for it to finish
run = client.actor("biddata/weather-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 '{
  "city": "Beijing",
  "mode": "forecast",
  "forecastDays": 7,
  "startDate": "",
  "endDate": ""
}' |
apify call biddata/weather-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,biddata/weather-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/yDxU9KpQXEmW0XBug/builds/GV95r67wsHLWEqAGh/openapi.json
