karust / openserp

Get Google, Yandex, Baidu search engine results via API or CLI for free 🎉
MIT License
309 stars 28 forks source link

Most searches crash the docker container #7

Open joshfester opened 2 months ago

joshfester commented 2 months ago

I can get some hello world searches to work, but if I try anything else, I get errors like this, which crash the docker container:

[2024-07-10 16:44:20][DEBUG]    Navigate to: https://www.google.com/search?hl=EN&ie=UTF-8&lr=lang_en&nfpr=1&num=20&oq=alien+labs+cannabis&pws=0&q=alien+labs+cannabis&sourceid=chrome
[2024-07-10 16:44:20][ERROR]    Error preparing the page: eval js error: TypeError: Cannot read properties of undefined (reading 'apply')
    at <anonymous>:1:113 <nil>
[2024-07-10 16:44:25][INFO]     4450000 SERP results
panic: runtime error: slice bounds out of range [4:1]
goroutine 31 [running]:
github.com/karust/openserp/google.(*Google).Search(0xc000132990, {{0xc0002ab3e0, 0x13}, {0xc000013f38, 0x2}, {0x0, 0x0}, {0x0, 0x0}, {0x0, ...}, ...})
    /build/google/search.go:296 +0xeb5
github.com/karust/openserp/core.NewServer.func1(0xc0001e4008)
    /build/core/server.go:50 +0x25d
github.com/gofiber/fiber/v2.(*App).next(0xc000194d88, 0xc0001e4008)
    /go/pkg/mod/github.com/gofiber/fiber/v2@v2.47.0/router.go:144 +0x1b2
github.com/gofiber/fiber/v2.(*App).handler(0xc000194d88, 0x493ecf?)
    /go/pkg/mod/github.com/gofiber/fiber/v2@v2.47.0/router.go:171 +0x78
github.com/valyala/fasthttp.(*Server).serveConn(0xc000112e00, {0x10272c8, 0xc0005b0ed0})
    /go/pkg/mod/github.com/valyala/fasthttp@v1.48.0/server.go:2363 +0xe90
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc00018d4a0, 0xc00005dee0)
    /go/pkg/mod/github.com/valyala/fasthttp@v1.48.0/workerpool.go:224 +0xa4
github.com/valyala/fasthttp.(*workerPool).getCh.func1()
    /go/pkg/mod/github.com/valyala/fasthttp@v1.48.0/workerpool.go:196 +0x32
created by github.com/valyala/fasthttp.(*workerPool).getCh in goroutine 1
    /go/pkg/mod/github.com/valyala/fasthttp@v1.48.0/workerpool.go:195 +0x190
serp exited with code 2
muratkaragoz commented 1 month ago

Change "strings.Join(textSliced[4:]," as "strings.Join(textSliced[:]," at line 296 and then run "go build" at console.

iInvisibilities commented 1 month ago

Same issue here.

baderdean commented 1 month ago

Change "strings.Join(textSliced[4:]," as "strings.Join(textSliced[:]," at line 296 and then run "go build" at console.

Could you do a PR and update the docker image to still use the docker image without any hotfix please?