Skip to content
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

quotationHistory.test.js failed #13

Open
jcsilva opened this issue Aug 2, 2021 · 1 comment
Open

quotationHistory.test.js failed #13

jcsilva opened this issue Aug 2, 2021 · 1 comment

Comments

@jcsilva
Copy link

jcsilva commented Aug 2, 2021

Hi,

I tried to run the tests/quotationHistory.test.js, but I got this error:

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)

   5 | async function scrapQuotationHistory (share) {
   6 |   const response = await getPage(endpoints.quotationHistory, share)
>  7 |   const data = JSON.parse(response.serialize().replace(/<.+>/g, ''))
     |                     ^
   8 |   return data.map(item => {
   9 |     return {
  10 |       date: new Date(item[0]).toISOString().slice(0, 10),

  at scrapQuotationHistory (lib/scrappers/quotationHistory/index.js:7:21)
  at Object.getQuotationHistory (lib/scrappers/quotationHistory/index.js:17:16)
  at Object.<anonymous> (tests/quotationHistory.test.js:6:28)

I tried to investigate a bit and it seems the server is always responding nothing. Maybe you have already faced this issue and could, please, indicate how to solve this issue.

@edudossa
Copy link

I also had the same issue and it turns out that the endpoint for quotationHistory is returning a blank page. I don't know if the website has changed the way of having historical quotes, or if the link has changed.
in utils.js
const endpoints = { details: 'https://fundamentus.com.br/detalhes.php?papel=', quotationHistory: 'https://fundamentus.com.br/amline/cot_hist.php?papel=', earningsHistory: 'https://www.fundamentus.com.br/proventos.php?tipo=1&papel=' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants