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

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

Total users

1

Monthly users

1

Runs succeeded

>99%

Last modified

a month ago

.actor/Dockerfile

# Specify the base Docker image. You can read more about
# the available images at https://docs.apify.com/sdk/js/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:20 AS builder
# Check preinstalled packages
RUN npm ls crawlee apify puppeteer playwright
# Copy just package.json and package-lock.json
# to speed up the build using Docker layer cache.
COPY package*.json ./
# Install all dependencies. Don't audit to speed up the installation.
RUN npm install --include=dev --audit=false
# Next, copy the source files using the user set
# in the base image.
COPY . ./
# Install all dependencies and build the project.
# Don't audit to speed up the installation.
RUN npm run build
# Create final image
FROM apify/actor-node:20
# Check preinstalled packages
RUN npm ls crawlee apify puppeteer playwright
# Copy just package.json and package-lock.json
# to speed up the build using Docker layer cache.
COPY package*.json ./
# Install NPM packages, skip optional and development dependencies to
# keep the image small. Avoid logging too much and print the dependency
# tree for debugging
RUN npm --quiet set progress=false \
&& npm install --omit=dev --omit=optional \
&& echo "Installed NPM packages:" \
&& (npm list --omit=dev --all || true) \
&& echo "Node.js version:" \
&& node --version \
&& echo "NPM version:" \
&& npm --version \
&& rm -r ~/.npm
# Copy built JS files from builder image
COPY --from=builder /usr/src/app/dist ./dist
# Next, copy the remaining files and directories with the source code.
# Since we do this after NPM install, quick build will be really fast
# for most source file changes.
COPY . ./
# Create and run as a non-root user.
RUN adduser -h /home/apify -D apify && \
chown -R apify:apify ./
USER apify
# Run the image.
CMD npm run start:prod --silent

.actor/actor.json

{
"actorSpecification": 1,
"name": "rae-api-actor",
"title": "Scrape Real Academia española (RAE DLE) dictionary",
"description": "Scrape data from single page with provided URL.",
"version": "0.1.0",
"meta": {
"templateId": "ts-start"
},
"input": "./input_schema.json",
"dockerfile": "./Dockerfile",
"storages": {
"dataset": {
"actorSpecification": 1,
"views": {
"overview": {
"title": "Overview",
"transformation": {
"fields": [
"word",
"meanings",
"conjugations"
]
},
"display": {
"component": "table",
"properties": {
"word": {
"label": "Word",
"format": "text"
},
"meanings": {
"label": "Meanings",
"format": "object"
},
"conjugations": {
"label": "Conjugations",
"format": "object"
}
}
}
},
"details": {
"title": "Details",
"transformation": {
"fields": [
"word",
"meanings",
"conjugations"
]
},
"display": {
"component": "grid",
"properties": {
"word": {
"label": "Word",
"format": "text"
},
"meanings": {
"label": "Meanings",
"format": "object"
},
"conjugations": {
"label": "Conjugations",
"format": "object"
}
}
}
}
}
}
}
}

.actor/input_schema.json

{
"title": "Consultar palabra en la RAE",
"type": "object",
"schemaVersion": 1,
"properties": {
"word": {
"title": "Palabra a consultar",
"type": "string",
"description": "Palabra en español para buscar en el diccionario de la RAE",
"editor": "textfield",
"prefill": "hola"
}
},
"required": ["word"]
}

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

# configurations
.idea
.vscode
# crawlee and apify storage folders
apify_storage
crawlee_storage
storage
# installed files
node_modules
# git folder
.git
# dist folder
dist

.editorconfig

root = true
[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

.eslintrc

{
"root": true,
"env": {
"browser": true,
"es2020": true,
"node": true
},
"extends": [
"@apify/eslint-config-ts"
],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": 2020
},
"ignorePatterns": [
"node_modules",
"dist",
"**/*.d.ts"
]
}

.gitignore

# This file tells Git which files shouldn't be added to source control
.idea
.vscode
storage
apify_storage
crawlee_storage
node_modules
dist
tsconfig.tsbuildinfo
storage/*
!storage/key_value_stores
storage/key_value_stores/*
!storage/key_value_stores/default
storage/key_value_stores/default/*
!storage/key_value_stores/default/INPUT.json

package.json

{
"name": "ts-start",
"version": "0.0.1",
"type": "module",
"description": "This is an example of an Apify actor.",
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
"apify": "^3.2.6",
"axios": "^1.5.0",
"cheerio": "^1.0.0-rc.12"
},
"devDependencies": {
"@apify/eslint-config-ts": "^0.3.0",
"@apify/tsconfig": "^0.1.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.50.0",
"tsx": "^4.6.2",
"typescript": "^5.3.3"
},
"scripts": {
"start": "npm run start:dev",
"start:prod": "node dist/main.js",
"start:dev": "tsx src/main.ts",
"build": "tsc",
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
},
"author": "It's not you it's me",
"license": "ISC"
}

tsconfig.json

{
"extends": "@apify/tsconfig",
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "ES2022",
"outDir": "dist",
"noUnusedLocals": false,
"skipLibCheck": true,
"lib": ["DOM"]
},
"include": [
"./src/**/*"
]
}