n0madic / google-play-scraper

Golang scraper to get data from Google Play Store
GNU Lesser General Public License v3.0
78 stars 20 forks source link

Fatal error while getting category #16

Closed emreoktem closed 1 year ago

emreoktem commented 1 year ago

@n0madic Hi,

I'd created another issue and you'd closed it but there's still a fatal crash error as I mentioned in my comment.

Here's the example code with fatal crash:

clusters, err := category.New(store.ArtAndDesign, store.AgeNineUp, category.Options{ Country: "us", Language: "us", Number: 100, })

n0madic commented 1 year ago

I also can’t find anything in this category, that’s why the error is because the list of clusters is empty

n0madic commented 1 year ago

it looks like only the store.Game category works at the moment... Google has greatly simplified the web version of the store

emreoktem commented 1 year ago

@n0madic Is it at least possible to get an empty result instead of having a fatal crash?

n0madic commented 1 year ago

after my fix, it should be so in theory

emreoktem commented 1 year ago

@n0madic Btw, game category is also getting a crash

image
n0madic commented 1 year ago

can not reproduce... try this code with the latest version of the library

package main

import (
    "fmt"

    "github.com/n0madic/google-play-scraper/pkg/category"
    "github.com/n0madic/google-play-scraper/pkg/store"
)

func main() {
    clusters, err := category.New(store.Game, store.AgeNineUp, category.Options{
        Country:  "us",
        Language: "us",
        Number:   100,
    })
    if err != nil {
        panic(err)
    }

    for clusterName := range clusters {
        fmt.Println("Cluster:", clusterName)
        err = clusters[clusterName].Run()
        if err != nil {
            panic(err)
        }
        for _, app := range clusters[clusterName].Results {
            fmt.Println(app.Title, app.URL)
        }
    }
}