filipedeschamps / video-maker

Projeto open source para fazer vídeos automatizados
MIT License
2.43k stars 629 forks source link

Erro ao pesquisar termo #336

Closed pablodevv closed 9 months ago

pablodevv commented 3 years ago

Type a Wikipedia search term: programming

[1] Who is [2] What is [3] The history of [0] CANCEL

Choose one option [1, 2, 3, 0]: 2

[text-robot] Starting... [text-robot] Fetching content from Wikipedia node:internal/process/promises:245 triggerUncaughtException(err, true / fromPromise /); ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason ""Program" may refer to: Program management Time management planning Programming (music) Radio programming Synthesizer programmer Broadcast programming Program music Synthesizer patch LP Underground Eleven B-movie Computer program Computer programming Programming language Game programming Mathematical programming Programmer Programmer (hardware) Program (machine) Research program Software engineer Media Programme of the European Union Program (German non-profit) Application software Deprogramming Dramatic programming Neuro-linguistic programming Twelve-step program The Program (disambiguation)".] { code: 'ERR_UNHANDLED_REJECTION' }

gogaoliveira commented 3 years ago

consegue colar o codigo para podermos analizar melhor?

erickmp07 commented 3 years ago

O algoritmo do WikipediaParser está com problemas. Algo foi alterado que fez com que ele ficasse com problemas ao pesquisar termos longos, por exemplo: "Software engineer". Para continuar o desenvolvimento ou testes, recomendo utilizar termos mais curtos, como por exemplo: "GitHub".

rzfzr commented 3 years ago

Eu acabei com a quota free do algorithmia, então migrei pro modulo wikijs, notei que o termo de busca dele tem que ser mais similar ao titulo da pagina mesmo, de resto funciona legal, traz imagens e mais, coisa que n cheguei ver se o algorithimia faz. npm install wikijs

const wiki = require('wikijs').default;

 async function fetchContentFromWikipedia(content) {
    console.log('> [text-robot] Fetching content from Wikipedia with', content)
    let page = wiki({
      apiUrl: 'https://pt.wikipedia.org/w/api.php'
    }).page(content.searchTerm)
    await page
      .then(page => page.rawContent())
      .then((rawContent) => {
        content.sourceContentOriginal = rawContent;
      })
    await page
      .then(page => page.url())
      .then((url) => {
        content.url = url
      });
matbrgz commented 9 months ago

Conseguiu resolver? Espero que tenha conseguido. Estou fechando os issues relacionados a erro para entender quais erros ainda existem, quais já foram resolvidos, caso necessário posso abrir novamente.