Antrikshy / node-google-search-trends

Node.js module to fetch localized Google trending searches
MIT License
17 stars 3 forks source link

error calling the search trends #2

Open eveahe opened 5 years ago

eveahe commented 5 years ago

I used your package in a project about six or eight months ago (thank you!) but I noticed that as of the last month or so, it stopped running and it seems like the issue is with the trends script. I wonder if google's search trends page design changed in some way?

Let me know if you have any insights as to what might be the issue. I am getting the below error.

events.js:165

      throw er; // Unhandled 'error' event

      ^

TypeError: Cannot read property 'channel' of undefined

    at /rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/node-google-search-trends/1.1.0/node_modules/node-google-search-trends/trends.js:13:33

    at /rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/node-google-search-trends/1.1.0/node_modules/node-google-search-trends/trends.js:44:9

    at Parser.<anonymous> (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/xml2js/0.4.19/node_modules/xml2js/lib/parser.js:303:18)

    at Parser.emit (events.js:180:13)

    at SAXParser.onclosetag (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/xml2js/0.4.19/node_modules/xml2js/lib/parser.js:261:26)

    at emit (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/sax/1.2.4/node_modules/sax/lib/sax.js:624:35)

    at emitNode (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/sax/1.2.4/node_modules/sax/lib/sax.js:629:5)

    at closeTag (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/sax/1.2.4/node_modules/sax/lib/sax.js:889:7)

    at SAXParser.write (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/sax/1.2.4/node_modules/sax/lib/sax.js:1436:13)

    at Parser.exports.Parser.Parser.parseString (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/xml2js/0.4.19/node_modules/xml2js/lib/parser.js:322:31)

Emitted 'error' event at:

    at Parser.exports.Parser.Parser.parseString (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/xml2js/0.4.19/node_modules/xml2js/lib/parser.js:326:16)

    at Parser.parseString (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/xml2js/0.4.19/node_modules/xml2js/lib/parser.js:5:59)

    at exports.parseString (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/xml2js/0.4.19/node_modules/xml2js/lib/parser.js:354:19)

    at IncomingMessage.<anonymous> (/rbd/pnpm-volume/268826f4-8f13-42a9-a527-f6f7bb49d2d5/node_modules/.registry.npmjs.org/node-google-search-trends/1.1.0/node_modules/node-google-search-trends/trends.js:43:7)

    at IncomingMessage.emit (events.js:185:15)

    at endReadableNT (_stream_readable.js:1106:12)

    at process._tickCallback (internal/process/next_tick.js:178:19)
Antrikshy commented 5 years ago

Wow, I'm glad to hear this package is actually used by other people!

I originally built this as an internal library to support Quibbler.co. The site has been running ever since, but has broken down a couple times so far because of Google changing their response format. I can guarantee it's the same thing again. This time the site went down, I decided I wanted to be lazy and ended up removing the use of this library from it and let it remain broken.

But now that you bring it up, I'll try to not be lazy this weekend and look into what has changed this time around and fix it. The code shouldn't be too complex, so if you can get it making requests locally, and want to take a stab at fixing it, I'd appreciate a PR!

eveahe commented 5 years ago

Sure, definitely. I'm away this weekend but I'll give it a go next week, if you haven't already been able to fix it 👍