d6o/TinderOnline

panic: json: cannot unmarshal number 0.47058823529411764 into Go struct field .selectRate of type int

tanel opened this issue · 8 comments

tanel commented

panic: json: cannot unmarshal number 0.47058823529411764 into Go struct field .selectRate of type int

goroutine 1 [running]:
main.checkError(0x13bd820, 0xc42018a460)
/Users/tanel/src/github.com/disiqueira/tinderonline/tinderonline.go:137 +0x4a
main.main()
/Users/tanel/src/github.com/disiqueira/tinderonline/tinderonline.go:28 +0x15a

panic: json: cannot unmarshal number into Go struct field .fbId of type string

goroutine 1 [running]:
main.checkError(0x13bd820, 0xc42017a500)
/Users/kre/Development/tinderonline/tinderonline.go:137 +0x4a
main.main()
/Users/kre/Development/tinderonline/tinderonline.go:28 +0x15a

d6o commented

Sorry about that, it was an issue in my TinderGo Library. I updated it.
Can you run an update and try it again?

go get -u github.com/disiqueira/tindergo
go get -u github.com/disiqueira/tinderonline

I had a similar problem:
panic: json: invalid use of ,string struct tag, trying to unmarshal "directupload" into int64
Problem was this field: "fbId":"directupload"
I fixed it with this patch:

diff --git a/profile.go b/profile.go
index ecf1799..65ac96a 100644
--- a/profile.go
+++ b/profile.go
@@ -50,7 +50,7 @@ type Profile struct {
                YdistancePercent float64 `json:"ydistance_percent,omitempty"`
                XoffsetPercent   float64 `json:"xoffset_percent,omitempty"`
                FileName         string  `json:"fileName"`
-               FbID             int64   `json:"fbId,string"`
+               FbID             string  `json:"fbId"`
                Extension        string  `json:"extension"`
                ProcessedFiles   []struct {
                        Width  int    `json:"width"`
d6o commented

I removed fbid field until i can figure out how to handle this unstandardized field.

Updating the packages should fix the issue:

go get -u github.com/disiqueira/tindergo
go get -u github.com/disiqueira/tinderonline

I ran the commands and still get a similar error:

panic: json: cannot unmarshal string into Go struct field UserPhoto.main of type bool

goroutine 1 [running]:
main.checkError(0x13bd820, 0xc4202441e0)
	/Users/codyhunsberger/Desktop/tinderonline/tinderonline.go:137 +0x4a
main.main()
	/Users/codyhunsberger/Desktop/tinderonline/tinderonline.go:41 +0x683
exit status 2

I was able to work around it by changing panic(err) in checkError to fmt.Println(err), now it continues and displays the rest of the list.

Tried this out but keep getting an error. After two friends have been printed, i get the following error:

panic: json: cannot unmarshal string into Go value of type bool
goroutine 1 [running]:
panic(0x82fa980, 0x18acc080)
	/usr/lib/go-1.6/src/runtime/panic.go:481 +0x326
main.checkError(0xb6c5d640, 0x18acc080)
	/home/superuser/.go/src/github.com/disiqueira/tinderonline/tinderonline.go:137 +0x44
main.main()
	/home/superuser/.go/src/github.com/disiqueira/tinderonline/tinderonline.go:41 +0x924

Not sure how to go about debugging this. I have run :

go get -u github.com/disiqueira/tindergo
go get -u github.com/disiqueira/tinderonline

yet the issue persists, any ideas?

Same here, i have 2000+ people on facebook.

panic: json: cannot unmarshal string into Go value of type bool

goroutine 1 [running]:
panic(0x82546c0, 0x187a2fa0)
/usr/lib/go-1.7/src/runtime/panic.go:500 +0x331
main.checkError(0x8368a50, 0x187a2fa0)
/home/es/tinderonline/tinderonline.go:137 +0x44
main.main()
/home/es/tinderonline/tinderonline.go:41 +0x7ce


Suggestion what @hunsbct said works great :)

d6o commented

Please see #12