Giter Club home page Giter Club logo

rae-api's People

Contributors

account0123 avatar cft-chris avatar danlop618 avatar javigaralva avatar lilezek avatar victor141516 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rae-api's Issues

Random Word

Hola, me encanta y me es super útil tu API.

¿Crees que podrías implementar una función que te de una palabra aleatoria o cómo crees que se podría hacer?

Un saludo.

Random word error, problema de regexp.

Buenas, haciendo una gran cantidad de peticiones para obtener una palabra aleatoria me he encontrado con el siguiente error:

 const h = body.match(/<header [^>]*>([^<]+)/)[1]
                                                                               ^

TypeError: Cannot read properties of null (reading '1')
    at IncomingMessage.<anonymous> (lorem\node_modules\rae-api\src\HttpInterface.js:56:51)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Según una pequeña revisión, llegué a la conclusión de que el problema ocurre porque el header incluye una etiqueta de cursiva "< i >" para envolver la palabra a definir, la cual evita que la función regExp encuentre el texto correspondiente y por lo tanto el método .match retorna un valor null.

Personalmente estoy intentando cambiar la función regExp para que permita seleccionar en los casos en que se cumpla esta condición pero tengo nula experiencia utilizando estas expresiones, si logro solucionarlo publicaré el cambio que realicé.

En caso de que tenga relevancia, lo único que estoy haciendo es ejecutar múltiples veces la función getRandomWord. Algunas veces logra ejecutarse 200 veces sin encontrar una palabra que produzca el problema pero en la mayoría de veces ocurre antes de llegar a ese punto. Todo lo que estoy ejecutando es:

const words = [];

async function randomWord() {
  const random = await rae.getRandomWord();
  const rWord = random.getHeader();
  words.push(rWord);
}

async function iterate() {
  for (let i = 0; i < 200; i++) {
    if (i % 10 == 0) {
      console.log(i);
    }
    await randomWord();
  }
  console.log(words);
}

iterate();

Gracias de antemano.

Método fetchWord manejo de errores

Estoy utilizando la api, que es muy útil por cierto :)
Pero tengo un problema con el método fetchWord, si el id es incorrecto no encontré la manera de manejar el error y se cae la app.

Desarrollo en typescript ya probé con try catch ó fetchWord().catch() pero nada

Gracias!!

Provide own Auth token

I noticed that an API key Auth token is hardcoded in Constants.js. Wouldn't it make more sense for us to provide our own?

e.g.

const rae = new RAE({ debug: false, authToken: "Basic FOOBAR" });

[BUG] Words containing italic tags fails when trying to fetch definitions

Recently trying to consume from this API project, we found that searching for words that contain italic tags fails.

So what we're basically trying to do, following the current documentation is to:

rae.fetchWord(response.getRes()[0].getId()))

What throws an error of body.res is not iterable

We try with Pizza and Paparazzi words and get the same result, the only reason we reach that this could be happening is related to the italic tags in the header word when trying to fetch the ID of the word.

Error en búsqueda de palabras cuando hay dos o más voces con idéntica forma

Estoy usando el example GetDefinition.js en la última versión en Node.js v18.15.0, al hacer una búsqueda con una palabra con varias formas (ajo, champán, ...) resulta en un error:

                                        const h = body.match(/<header .+>([^<]+)(<\/i>)?<\/h/)[1]
                                                                                              ^

TypeError: Cannot read properties of null (reading '1')
    at IncomingMessage.<anonymous> (C:\Users\niwlf\OneDrive\Escritorio\Github\letras\node_modules\rae-api\src\HttpInterface.js:60:60)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.