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

[BUG] When run app() multiple times, categories list in output is wrong. #179

Open
GuanHenan opened this issue May 26, 2023 · 3 comments
Open
Assignees
Labels

Comments

@GuanHenan
Copy link

GuanHenan commented May 26, 2023

I find a bug in constants/element.py, line 42

def extract_categories(s, categories=None):
if categories == None:
categories = []

if s == None or len(s) == 0:
return categories
if len(s) >= 4 and type(s[0]) is str:
categories.append({"name": s[0], "id": s[2]})
else:
for sub in s:
extract_categories(sub, categories)
return categories

The problem is using list as the default parameter. It does not work as expected. It's recommended to use None as the default value and initialize the list inside the function if it's None.

@GuanHenan
Copy link
Author

Modify the function extract_categories in google_play_scraper/constants/element.py as following:

def extract_categories(s, categories=None):
    if categories == None:
        categories = []
    if s == None or len(s) == 0:
        return categories

    if len(s) >= 4 and type(s[0]) is str:
        categories.append({"name": s[0], "id": s[2]})
    else:
        for sub in s:
            extract_categories(sub, categories)

    return categories

@JoMingyu
Copy link
Owner

Oops. I'll fix it in the next release.

@puntu
Copy link

puntu commented Apr 8, 2024

@JoMingyu when I run the app multiple times, I can not fetch more than a few hundreds of reviews even though millions of reviews are available. It is happening for popular apps like Google meet. My research work is not progressing. I am a doctoral scholar. Please take care..

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

No branches or pull requests

3 participants