Comments (5)
Consegui reproduzir seu erro aqui. Tem relação com o uso do async await.
Você está tentando trabalhar dados que ainda não chegaram do servidor.async function robot(content) { await fetchContentFromWikipedia(content) ... async function fetchContentFromWikipedia(content) { ...
Eu tentei mexer no async/await de varias formas e o erro persiste.
Neste momento do code o @filipedeschamps conseguiu baixar do wikipedia com letra verde e tal. Meu caso fica esse erro :(Meu "text.js" está assim:
const algorithmia = require('algorithmia') //importando o modulo deles pro bot const algorithmiaApiKey = require('../credentials/algorithmia.json').apiKey async function robot(content){ await BuscaWikipedia(content) //LimparConteudo(content) //QuebrarSentencas(content) async function BuscaWikipedia(content) { const algorithmiaAutenticada = algorithmia(algorithmiaApiKey) const wikipediaAlgorithm = algorithmiaAutenticada.algo('web/WikipediaParser/0.1.2') //link no site deles. Aba node JS const wikipediaResponde = await wikipediaAlgorithm.pipe(content.serarchTerm) const wikipediaContent = wikipediaResponde.get() console.log(wikipediaContent) } } module.exports = robot
:::
Meu "index.js" está assim:const readline = require('readline-sync') const robots = { text: require('./robots/text.js') } function start() { const content = {} content.searchTerm = askAndReturnSearchTerm() content.prefix = askAndReturnPrefix() robots.text(content) function askAndReturnSearchTerm() { return readline.question('Digite um termo de pesquisa da Wikipedia: ') } function askAndReturnPrefix() { const prefixes = ['Quem e', 'O que e', 'A historia de'] const selectedPrefixIndex = readline.keyInSelect(prefixes, 'Escolha uma alternativa: ') const selectedPrefixText = prefixes[selectedPrefixIndex] return selectedPrefixText } console.log(content) } start()
:::
CONSEGUI!
o ERRO ERA QUE EU ESCREVI "searchTerm" errado na linha de comando.
"const wikipediaResponde = await wikipediaAlgorithm.pipe(content.serarchTerm)"
Isso que da programar sem parar. Não queria dormir com erro no code mas agora de manhã ja acordei revendo isso.
Obrigado pelo ajuda a todos aí!
from video-maker.
Consegui reproduzir seu erro aqui. Tem relação com o uso do async await.
Você está tentando trabalhar dados que ainda não chegaram do servidor.
async function robot(content) {
await fetchContentFromWikipedia(content)
...
async function fetchContentFromWikipedia(content) {
...
from video-maker.
@MatheusDeAquino também estou com esse problema, @hugocalheira sabe como resolver?
from video-maker.
Consegui reproduzir seu erro aqui. Tem relação com o uso do async await.
Você está tentando trabalhar dados que ainda não chegaram do servidor.async function robot(content) { await fetchContentFromWikipedia(content) ... async function fetchContentFromWikipedia(content) { ...
Eu tentei mexer no async/await de varias formas e o erro persiste.
Neste momento do code o @filipedeschamps conseguiu baixar do wikipedia com letra verde e tal. Meu caso fica esse erro :(
Meu "text.js" está assim:
const algorithmia = require('algorithmia') //importando o modulo deles pro bot
const algorithmiaApiKey = require('../credentials/algorithmia.json').apiKey
async function robot(content){
await BuscaWikipedia(content)
//LimparConteudo(content)
//QuebrarSentencas(content)
async function BuscaWikipedia(content) {
const algorithmiaAutenticada = algorithmia(algorithmiaApiKey)
const wikipediaAlgorithm = algorithmiaAutenticada.algo('web/WikipediaParser/0.1.2') //link no site deles. Aba node JS
const wikipediaResponde = await wikipediaAlgorithm.pipe(content.serarchTerm)
const wikipediaContent = wikipediaResponde.get()
console.log(wikipediaContent)
}
}
module.exports = robot
:::
Meu "index.js" está assim:
const readline = require('readline-sync')
const robots = {
text: require('./robots/text.js')
}
function start() {
const content = {}
content.searchTerm = askAndReturnSearchTerm()
content.prefix = askAndReturnPrefix()
robots.text(content)
function askAndReturnSearchTerm() {
return readline.question('Digite um termo de pesquisa da Wikipedia: ')
}
function askAndReturnPrefix() {
const prefixes = ['Quem e', 'O que e', 'A historia de']
const selectedPrefixIndex = readline.keyInSelect(prefixes, 'Escolha uma alternativa: ')
const selectedPrefixText = prefixes[selectedPrefixIndex]
return selectedPrefixText
}
console.log(content)
}
start()
:::
from video-maker.
Erro resolvido, fechando a issue.
from video-maker.
Related Issues (20)
- Aumentar o numero de sentenças HOT 4
- README.md com imagens quebradas
- Seleção do idioma PT retorna texto diferente do esperado HOT 2
- Erro das configurações do template ao executar aerender.exe HOT 3
- English document/description for this awesome project
- erro Choose one option [1, 2, 3, 0]: 3 HOT 2
- Robô que cria vídeos no Youtube HOT 3
- Não estou conseguindo colocar para rodar HOT 20
- Boa noite Devs! Alguem pode me ajudar com essa issue? ja quebrei minha cabeça e não consigo, meu Deus! HOT 8
- Algorithmia parou HOT 2
- Wikipedia Parser morreu HOT 3
- ALGUEM PODE ME AJUDAR? HOT 4
- Alguém pode me ajudar, sobre Vue.js HOT 1
- Qual o discord desse repositório? HOT 3
- Error promise 279 err unhandled rejection HOT 1
- Pessoal como resolvo isso? Tem algum código para o arquivo index.js? HOT 2
- Alguém pode me Ajudar? HOT 4
- Modelo arquivo after-efects-script HOT 1
- oque fazer quando Api: Algorithmia nao esta desponivel em seu pais? HOT 2
- A API do Algorithmia é paga agora, existe alguma opção ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from video-maker.