facundoolano / aso

Tools for app store optimization on iTunes and Google Play
MIT License
720 stars 144 forks source link

Stopped returning results all of a sudden #3

Closed bnvinay92 closed 7 years ago

bnvinay92 commented 7 years ago

Just me?

facundoolano commented 7 years ago

Works for me:

> const gplay = require('./index').gplay;
undefined
> gplay.scores('panda').then(console.log);
Promise { <pending> }
> gplay.scores('panda').then(console.log).catch(consol{ difficulty:
   { titleMatches: { exact: 10, broad: 0, partial: 0, none: 0, score: 10 },
     competitors: { count: 54, score: 9.1 },
     installs: { avg: 3050000, score: 10 },
     rating: { avg: 4.090000000000001, score: 8.180000000000001 },
     age: { avgDaysSinceUpdated: 53.7, score: 9.03 },
     score: 9.51 },
  traffic:
   { suggest: { length: 3, index: 3, score: 8.7 },
     ranked: { count: 7, avgRank: 61.714285714285715, score: 6.83 },
     installs: { avg: 3050000, score: 10 },
     length: { length: 5, score: 8.5 },
     score: 8.47 } }

Can you show what fails for you exactly?

bnvinay92 commented 7 years ago

I have:

const gplay = require('aso').gplay;
const itunes = require('aso').itunes;

gplay.scores('nyuyu').then(console.log());

Console never prints anything. I've waited 20 minutes.

facundoolano commented 7 years ago

Remember you should pass a reference to the log function, not call it. Also, when you see no results like this you can include a .catch clause to print any errors. In this case:

> const gplay = require('./index').gplay;
undefined
> gplay.scores('nyuyu').then(console.log).catch((err)=> console.log(err.stack))
Promise { <pending> }
> Error: Invalid category MAPS_AND_NAVIGATION
    at Error (native)
    at validate (/Users/facundo/dev/gp-keywords/node_modules/google-play-scraper/lib/list.js:26:11)
    at /Users/facundo/dev/gp-keywords/node_modules/google-play-scraper/lib/list.js:13:5
    at list (/Users/facundo/dev/gp-keywords/node_modules/google-play-scraper/lib/list.js:11:10)
    at /Users/facundo/dev/gp-keywords/node_modules/memoizee/lib/configure-map.js:42:41
    at /Users/facundo/dev/gp-keywords/node_modules/google-play-scraper/lib/utils/memoize.js:14:14
    at /Users/facundo/dev/gp-keywords/lib/stores/gplay.js:20:41
    at Array.map (native)
    at getRankedApps (/Users/facundo/dev/gp-keywords/lib/scores/traffic.js:35:32)
    at /Users/facundo/dev/gp-keywords/lib/scores/traffic.js:80:7

Seems like a bug with that category in google play. I'll look into it.

bnvinay92 commented 7 years ago

Thanks! Also, when I try

aso.suggest({
    strategy: aso.CATEGORY,
    appId: 'in.mettletech.virtualhairstyle',
    num: 5
})
    .then(console.log)
    .catch(console.error);

I get a

Error: Error requesting Google Play:read ECONNRESET
    at Error (native)
    at /Users/Vinay/WebstormProjects/seo/node_modules/google-play-scraper/lib/utils/request.js:35:13
    at process._tickCallback (internal/process/next_tick.js:103:7)

Or similarly when I do:

aso.suggest({
    strategy: aso.CATEGORY,
    appId: 'in.mettletech.virtualhairstyle',
    num: 5
})
    .then(console.log)
    .catch(function (err) {
        console.log(err.stack)
    });

I get:

Error: Error requesting Google Play:socket hang up
    at Error (native)
    at /Users/Vinay/WebstormProjects/seo/node_modules/google-play-scraper/lib/utils/request.js:35:13
    at process._tickCallback (internal/process/next_tick.js:103:7)
facundoolano commented 7 years ago

Tried your second example and got results:

> aso.suggest({
...     strategy: aso.CATEGORY,
...     appId: 'in.mettletech.virtualhairstyle',
...     num: 5
... }).then(console.log).catch(console.log)
Promise { <pending> }
> [ 'app', 'tv', 'free', 'watch', 'access' ]

Do you always see that error? Is very likely that Google would start rejecting your requests if you hit it too often from the same location.

facundoolano commented 7 years ago

Fixed the original issue (Error: Invalid category MAPS_AND_NAVIGATION), the categories were outdated in google-play-scraper. It should work on the new version of this module.