-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usa o google trends para exibir uma lista de palavras para o searchterm #6
base: master
Are you sure you want to change the base?
Conversation
danielschmitz
commented
Feb 26, 2019
Ideia massa, mano!!! |
index.js
Outdated
async function getGoogleTrends () { | ||
const parser = new Parser(); | ||
const trends = await parser.parseURL(TREND_URL); | ||
return trends.items.map(i => i.title) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielschmitz , o que acha de fazer a seguinte mudança?
destructuring binding
//return trends.items.map(i => i.title)
return trends.items.map(({title}) => title);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
top ! Vou mudar no meu fork, mas como esse PR nao vai ser aprovado até que o @filipedeschamps termine os videos, melhor deixar aqui assim
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielschmitz sem problemas. Fico feliz por contribuir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eu não faria isso. Destructuring "custa" bem mais que acesso a propriedade.
Mas vai do quanto se quer se gastar com CPU.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Em suma, bonitinho mas ordinário. IMHO, pelo menos para 1 prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leodutra Entendi
dica do @gkal19
Show de bola |
Genial, mano! |
ah garoto, aí sim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
como vc fez pra fazer o robo identificar cada trend? tipo vc entrou no codigo fonte da pagina google trends e procurou no codigo?
@ninjaboladao ele acessou o RSS feed |
@ninjaoboladao Ele entrou na url que está na constante TREND_URL. Para buscar os trends criou a função getGoogleTrends(), dentro dela ele criou um parser queque ele criou um parser, que basicamente te dá acesso aos elementos do site, e pediu os items dele, com esses items pegou e criou uma lista com a função map. async function getGoogleTrends () {
const parser = new Parser()
const trends = await parser.parseURL(TREND_URL)
return trends.items.map(({title}) => title)
} |
Excelente ideia! |
Já fiz meu merge. Obrigado. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isto é para actualizar no "input.js" certo?
Não me está a dar certo depois de escolher o que eu quero do Google trends. O que posso fazer? Abraço!