masasron / g-trends

A simple Node JS client for Google Trends.
MIT License
25 stars 7 forks source link

past7Days not working #1

Closed bitcoinvsalts closed 4 years ago

bitcoinvsalts commented 4 years ago

error:

(node:89737) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token u in JSON at position 0

code:

const { ExploreTrendRequest,SearchProviders } = require('g-trends')

const explorer = new ExploreTrendRequest()

explorer.past7Days()
    .addKeyword('bitcoin')
    .download()
    .then( csv => {
        console.log(csv)
    })
masasron commented 4 years ago

Hi @jsappme thank you for opening this issue.

Fixed at 0.0.7. (Google changed the "past7Days" value from "today 7-d" to "now 7-d".)

 PASS  test/explore-trend-request.test.js (8.664s)
  ✓ test .compare() (920ms)
  ✓ pastHour (875ms)
  ✓ pastFourHours (914ms)
  ✓ pastDay (886ms)
  ✓ past7Days (862ms)
  ✓ past30Days (769ms)
  ✓ past90Days (743ms)
  ✓ past12Months (757ms)
  ✓ past5Years (751ms)
  ✓ from2004ToPresent (741ms)