# Lotería Nacional España 🎰 - Sorteos y Premios (`tikitakaclaw/loteria-nacional-espana`) Actor

Spanish lottery results: Lotería Nacional (weekly), Lotería Navidad (December), El Niño (January). Extract premios by category, números sorteados, fechas. Daily-updated from combinacionganadora.com.

- **URL**: https://apify.com/tikitakaclaw/loteria-nacional-espana.md
- **Developed by:** [TikitakaClaw Pikipiki](https://apify.com/tikitakaclaw) (community)
- **Categories:** Automation, Developer tools, Other
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 record scrapeds

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?

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

## Lotería Nacional España 🎰

> Actor #10 de TikitakaClaw. Resultados de **Lotería Nacional, Lotería de Navidad y El Niño**.

Scrapea los resultados oficiales de las 3 loterías principales de España desde `combinacionganadora.com` (aggregator que publica datos actualizados de Loterías y Apuestas del Estado).

***

### Datos que extrae

Por cada sorteo:

| Campo | Tipo | Ejemplo |
|---|---|---|
| `tipoLoteria` | enum | `nacional`, `navidad`, `nino` |
| `tipoLoteriaNombre` | string | `Lotería Nacional`, `Lotería de Navidad`, `El Niño` |
| `fechaSorteo` | ISO date | `2026-07-04` |
| `diaSemana` | string | `Jueves`, `Sábado` |
| `titulo` | string | `Lotería Nacional Sábado 4 de julio de 2026` |
| `premios` | list | `[{categoria, premioTexto, premioEuros}, ...]` |
| `totalPremios` | int | 11, 14, 17 |
| `numerosSorteados` | list | `['28980', '35414', ...]` |
| `primerPremio` | float | `30000.0`, `400000.0`, `20000000.0` |
| `urlDetalle` | URL | Link a página del sorteo |

***

### Input

| Campo | Tipo | Default | Descripción |
|---|---|---|---|
| `tipoLoteria` | enum | `"nacional"` | `nacional` (ordinarios), `navidad` (diciembre), `nino` (enero), `all` |
| `maxResults` | int (1-50) | `10` | Número de sorteos a devolver |
| `proxyConfiguration` | object | deshabilitado | Proxy Apify RESIDENTIAL opcional |

***

### Output

**N sorteos** + 1 item summary.

#### Ejemplo: Lotería Navidad 22 dic 2025

```json
{
  "tipoLoteria": "navidad",
  "tipoLoteriaNombre": "Lotería de Navidad",
  "fechaSorteo": "2025-12-22",
  "diaSemana": null,
  "titulo": "Lotería de Navidad del 22 de diciembre de 2025",
  "premios": [
    {"categoria": "Primer premio", "premioTexto": "400.000,00 €", "premioEuros": 400000.0},
    {"categoria": "Segundo premio", "premioTexto": "125.000,00 €", "premioEuros": 125000.0},
    {"categoria": "Tercer premio", "premioTexto": "50.000,00 €", "premioEuros": 50000.0},
    {"categoria": "Cuarto premio", "premioTexto": "20.000,00 €", "premioEuros": 20000.0},
    {"categoria": "Quinto premio", "premioTexto": "6.000,00 €", "premioEuros": 6000.0}
  ],
  "totalPremios": 17,
  "numerosSorteados": [...],
  "primerPremio": 400000.0,
  "urlDetalle": "https://www.combinacionganadora.com/loteria-navidad/resultados/2025-12-22/"
}
```

***

### Pricing (PPE)

| Evento | Precio sugerido | Justificación |
|---|---|---|
| `sorteo` | **$0.0005** | Por cada sorteo devuelto |
| `summary` | **$0.0001** | Metadata auxiliar |

**Ejemplos:**

- 5 sorteos Lotería Nacional = **$0.0025** por run
- 1 sorteo Navidad + 1 Niño (run anual) = **$0.001** por run

***

### Casos de uso

1. **Apps de lotería** — Mostrar resultados actualizados a usuarios
2. **Newsletters** — "Resultados Lotería Nacional del 4 de julio de 2026"
3. **Bots de Discord/Telegram** — Anuncian automáticamente cada sorteo
4. **Estadísticas** — Análisis histórico de frecuencias, reintegros
5. **Verificadores de décimos** — "¿Me ha tocado?" — necesitan datos scrapeados

***

### Stack técnico

- **Python 3.11-slim-trixie**
- **impit** (TLS impersonation Chrome) — bypasses bot detection
- **BeautifulSoup4 + lxml** para parsing HTML
- **httpx** (fallback si impit no disponible)
- **Combinacionganadora.com** como aggregator
- **Compute:** ~0.0015 CU por run = $0.00005 USD

***

### Mantenimiento

El portal `combinacionganadora.com` actualiza los resultados **inmediatamente después de cada sorteo**:

- Lotería Nacional: jueves + sábado ~21:00 CET
- Lotería Navidad: 22 diciembre ~09:00 CET
- El Niño: 6 enero ~12:00 CET

***

### Console

- **Apify Console:** https://console.apify.com/actors/zi1lDpdJ68ob5txy2
- **PPE setup:** https://console.apify.com/actors/zi1lDpdJ68ob5txy2/monetization
- **Publicación:** https://console.apify.com/actors/zi1lDpdJ68ob5txy2/publication

# Actor input Schema

## `tipoLoteria` (type: `string`):

Which lottery to scrape. Nacional has results every 2-4 days. Navidad (December) and El Niño (January) are once-yearly.

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

Most recent N sorteos. National usually 4-8 per month. Navidad/El Niño = 1 per year.

## `proxyConfiguration` (type: `object`):

If combinacionganadora.com blocks AWS us-east-1, enable Apify RESIDENTIAL proxy. Usually not needed but available as fallback.

## Actor input object example

```json
{
  "tipoLoteria": "nacional",
  "maxResults": 10,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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("tikitakaclaw/loteria-nacional-espana").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("tikitakaclaw/loteria-nacional-espana").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 tikitakaclaw/loteria-nacional-espana --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tikitakaclaw/loteria-nacional-espana"
        }
    }
}
```

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/zi1lDpdJ68ob5txy2/builds/5D4QHbiFXImqKufz3/openapi.json
