facundoolano / google-play-scraper

Node.js scraper to get data from Google Play
MIT License
2.34k stars 631 forks source link

The collection topselling_free is invalid for the given category, top apps or new apps #488

Closed cac-dean closed 2 years ago

cac-dean commented 3 years ago

Description:

sometimes , i will get "The collection topselling_free is invalid for the given category, top apps or new apps" error, but sometimes is be fine.

Example code:

const gplay = require('google-play-scraper');
const fs = require('fs');
const categorys = [gplay.category.APPLICATION, gplay.category.BUSINESS, gplay.category.LIFESTYLE, gplay.category.SOCIAL];

categorys.forEach(category => {
    if(fs.existsSync(category + '.json')){
        fs.unlinkSync(category + '.json');
    }

    gplay.list({
        country: 'tw',
        lang: 'zh-tw',
        category: category,
        num: 500
      })
      .then(
        apps => {

            if(apps && apps.length > 0){
                let data = JSON.stringify(apps);

                if(data.length > 0){
                    fs.writeFileSync(category + '.json', data);
                }
            }
        },
        error => {
            console.log(error);
        }
    ).catch(
        error => {
            console.log(error);
        }
    );
});

Error message:

Error: The collection topselling_free is invalid for the given category, top apps or new apps
    at getParsedCluster (/Users/n/node_modules/google-play-scraper/lib/utils/parseCategoryApps.js:51:11)
    at parseCategoryApps (/Users/n/node_modules/google-play-scraper/lib/utils/parseCategoryApps.js:71:22)
    at /Users/n/node_modules/google-play-scraper/lib/list.js:29:29
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
99zikke commented 2 years ago

@cac-dean Hi, I have the same problem. Have you fixed it now?

andrew-curry commented 2 years ago

i have the same question,anyone has any ideas?

Panda2Chan commented 2 years ago

same where

DorAmram commented 2 years ago

Same question

YakobovLior commented 2 years ago

I'm also facing this issue. Is there any way to list the 500 top free applications (without mentioning category)?

Thanks in advance

facundoolano commented 2 years ago

can you check if this still happens with the latest version?

facundoolano commented 2 years ago

closing as duplicate of #549