Closed pablodevv closed 9 months ago
consegue colar o codigo para podermos analizar melhor?
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".
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
});
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.
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
[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' }