Diccionario de la Real Academia de la Lengua Española RAE (PPR) avatar
Diccionario de la Real Academia de la Lengua Española RAE (PPR)

Pricing

$5.00 / 1,000 results

Go to Store
Diccionario de la Real Academia de la Lengua Española RAE (PPR)

Diccionario de la Real Academia de la Lengua Española RAE (PPR)

Developed by

Marquiños

Maintained by Community

Accede a definiciones oficiales del español directamente en formato JSON. Obtén significados, categorías gramaticales y usos de cualquier palabra. Ideal para aplicaciones educativas, correctores y análisis lingüístico.

0.0 (0)

Pricing

$5.00 / 1,000 results

0

Monthly users

1

Runs succeeded

>99%

Last modified

16 days ago

.actor/Dockerfile

1# Specify the base Docker image. You can read more about
2# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
3# You can also use any other image from Docker Hub.
4FROM apify/actor-node:20 AS builder
5
6# Check preinstalled packages
7RUN npm ls crawlee apify puppeteer playwright
8
9# Copy just package.json and package-lock.json
10# to speed up the build using Docker layer cache.
11COPY package*.json ./
12
13# Install all dependencies. Don't audit to speed up the installation.
14RUN npm install --include=dev --audit=false
15
16# Next, copy the source files using the user set
17# in the base image.
18COPY . ./
19
20# Install all dependencies and build the project.
21# Don't audit to speed up the installation.
22RUN npm run build
23
24# Create final image
25FROM apify/actor-node:20
26
27# Check preinstalled packages
28RUN npm ls crawlee apify puppeteer playwright
29
30# Copy just package.json and package-lock.json
31# to speed up the build using Docker layer cache.
32COPY package*.json ./
33
34# Install NPM packages, skip optional and development dependencies to
35# keep the image small. Avoid logging too much and print the dependency
36# tree for debugging
37RUN npm --quiet set progress=false \
38    && npm install --omit=dev --omit=optional \
39    && echo "Installed NPM packages:" \
40    && (npm list --omit=dev --all || true) \
41    && echo "Node.js version:" \
42    && node --version \
43    && echo "NPM version:" \
44    && npm --version \
45    && rm -r ~/.npm
46
47# Copy built JS files from builder image
48COPY --from=builder /usr/src/app/dist ./dist
49
50# Next, copy the remaining files and directories with the source code.
51# Since we do this after NPM install, quick build will be really fast
52# for most source file changes.
53COPY . ./
54
55# Create and run as a non-root user.
56RUN adduser -h /home/apify -D apify && \
57    chown -R apify:apify ./
58USER apify
59
60# Run the image.
61CMD npm run start:prod --silent

.actor/actor.json

1{
2    "actorSpecification": 1,
3    "name": "rae-api-actor",
4    "title": "Scrape Real Academia española (RAE DLE) dictionary",
5    "description": "Scrape data from single page with provided URL.",
6    "version": "0.1.0",
7    "meta": {
8        "templateId": "ts-start"
9    },
10    "input": "./input_schema.json",
11    "dockerfile": "./Dockerfile",
12    "storages": {
13        "dataset": {
14            "actorSpecification": 1,
15            "views": {
16                "overview": {
17                    "title": "Overview",
18                    "transformation": {
19                        "fields": [
20                            "word",
21                            "meanings",
22                            "conjugations"
23                        ]
24                    },
25                    "display": {
26                        "component": "table",
27                        "properties": {
28                            "word": {
29                                "label": "Word",
30                                "format": "text"
31                            },
32                            "meanings": {
33                                "label": "Meanings",
34                                "format": "object" 
35                            },
36                            "conjugations": {
37                                "label": "Conjugations",
38                                "format": "object"
39                            }
40                        }
41                    }
42                },
43                "details": {
44                    "title": "Details",
45                    "transformation": {
46                        "fields": [
47                            "word",
48                            "meanings",
49                            "conjugations"
50                        ]
51                    },
52                    "display": {
53                        "component": "grid",
54                        "properties": {
55                            "word": {
56                                "label": "Word",
57                                "format": "text"
58                            },
59                            "meanings": {
60                                "label": "Meanings",
61                                "format": "object"
62                            },
63                            "conjugations": {
64                                "label": "Conjugations",
65                                "format": "object"
66                            }
67                        }
68                    }
69                }
70            }
71        }
72    }
73}

.actor/input_schema.json

1{
2    "title": "Consultar palabra en la RAE",
3    "type": "object",
4    "schemaVersion": 1,
5    "properties": {
6        "word": {
7            "title": "Palabra a consultar",
8            "type": "string",
9            "description": "Palabra en español para buscar en el diccionario de la RAE",
10            "editor": "textfield",
11            "prefill": "hola"
12        }
13    },
14    "required": ["word"]
15}

src/main.ts

1// Axios - Promise based HTTP client for the browser and node.js
2import axios from 'axios';
3
4// Apify SDK - toolkit for building Apify Actors
5import { Actor } from 'apify';
6
7// Inicializar el Actor
8await Actor.init();
9
10interface Input {
11    word: string;
12}
13
14// Obtener la palabra de entrada
15const input = await Actor.getInput<Input>();
16if (!input) throw new Error("Input is missing!");
17const { word } = input;
18
19// Validar que se haya proporcionado una palabra
20if (!word || word.trim() === '') {
21    throw new Error("Debe proporcionar una palabra para consultar");
22}
23
24try {
25    // Construir la URL de la API de la RAE con la palabra proporcionada
26    const apiUrl = `https://rae-api.com/api/words/${encodeURIComponent(word.trim())}`;
27    
28    // Realizar la petición a la API
29    const response = await axios.get(apiUrl);
30    
31    // Verificar que la petición fue exitosa
32    if (response.status !== 200) {
33        throw new Error(`Error al consultar la API: ${response.status} ${response.statusText}`);
34    }
35    
36    // Guardar los datos en el Dataset
37    await Actor.pushData(response.data);
38    
39    console.log(`Datos para la palabra "${word}" obtenidos y guardados correctamente.`);
40    
41} catch (error) {
42    // Manejar errores específicos
43    if (axios.isAxiosError(error)) {
44        if (error.response?.status === 404) {
45            console.error(`La palabra "${word}" no se encontró en el diccionario de la RAE.`);
46        } else {
47            console.error(`Error al realizar la petición: ${error.message}`);
48        }
49    } else {
50        console.error(`Error inesperado: ${error instanceof Error ? error.message : String(error)}`);
51    }
52    
53    // Registrar el error para que sea visible en los logs de Apify
54    throw error;
55}
56
57// Finalizar la ejecución del Actor
58await Actor.exit();

.dockerignore

1# configurations
2.idea
3.vscode
4
5# crawlee and apify storage folders
6apify_storage
7crawlee_storage
8storage
9
10# installed files
11node_modules
12
13# git folder
14.git
15
16# dist folder
17dist

.editorconfig

1root = true
2
3[*]
4indent_style = space
5indent_size = 4
6charset = utf-8
7trim_trailing_whitespace = true
8insert_final_newline = true
9end_of_line = lf

.eslintrc

1{
2    "root": true,
3    "env": {
4        "browser": true,
5        "es2020": true,
6        "node": true
7    },
8    "extends": [
9        "@apify/eslint-config-ts"
10    ],
11    "parserOptions": {
12        "project": "./tsconfig.json",
13        "ecmaVersion": 2020
14    },
15    "ignorePatterns": [
16        "node_modules",
17        "dist",
18        "**/*.d.ts"
19    ]
20}

.gitignore

1# This file tells Git which files shouldn't be added to source control
2
3.idea
4.vscode
5storage
6apify_storage
7crawlee_storage
8node_modules
9dist
10tsconfig.tsbuildinfo
11storage/*
12!storage/key_value_stores
13storage/key_value_stores/*
14!storage/key_value_stores/default
15storage/key_value_stores/default/*
16!storage/key_value_stores/default/INPUT.json

package.json

1{
2    "name": "ts-start",
3    "version": "0.0.1",
4    "type": "module",
5    "description": "This is an example of an Apify actor.",
6    "engines": {
7        "node": ">=18.0.0"
8    },
9    "dependencies": {
10        "apify": "^3.2.6",
11        "axios": "^1.5.0",
12        "cheerio": "^1.0.0-rc.12"
13    },
14    "devDependencies": {
15        "@apify/eslint-config-ts": "^0.3.0",
16        "@apify/tsconfig": "^0.1.0",
17        "@typescript-eslint/eslint-plugin": "^7.18.0",
18        "@typescript-eslint/parser": "^7.18.0",
19        "eslint": "^8.50.0",
20        "tsx": "^4.6.2",
21        "typescript": "^5.3.3"
22    },
23    "scripts": {
24        "start": "npm run start:dev",
25        "start:prod": "node dist/main.js",
26        "start:dev": "tsx src/main.ts",
27        "build": "tsc",
28        "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
29    },
30    "author": "It's not you it's me",
31    "license": "ISC"
32}

tsconfig.json

1{
2    "extends": "@apify/tsconfig",
3    "compilerOptions": {
4        "module": "NodeNext",
5        "moduleResolution": "NodeNext",
6        "target": "ES2022",
7        "outDir": "dist",
8        "noUnusedLocals": false,
9        "skipLibCheck": true,
10        "lib": ["DOM"]
11    },
12    "include": [
13        "./src/**/*"
14    ]
15}

Pricing

Pricing model

Pay per result 

This Actor is paid per result. You are not charged for the Apify platform usage, but only a fixed price for each dataset of 1,000 items in the Actor outputs.

Price per 1,000 items

$5.00