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

json: cannot unmarshal array into Go struct field SearchResult.clear_client_cache of type bool #66

Open
Pdaret opened this issue Jan 28, 2024 · 2 comments

Comments

@Pdaret
Copy link

Pdaret commented Jan 28, 2024

When'm using this code snippet for visiting the user profile i give this error:

profile, err := insta.VisitProfile(acc) if err != nil { log.Fatal(err) }

help me please

@bencebansaghi
Copy link

Same issue for me.

@bencebansaghi
Copy link

After a bit of digging the problem seems to be ClearClientCache field in the search.go file is declared as a bool, but the JSON response from Instagram's API contains an empty array for this field. To resolve this, I modified the struct declaration as follows:

// Original line commented out for reference
// ClearClientCache bool `json:"clear_client_cache"`
ClearClientCache []interface{} `json:"clear_client_cache"`

This change seems to fix the unmarshaling issue. However, I’m unsure if this modification might cause problems elsewhere in the future. If anyone is more familiar with the goinsta library or has insights into why this error occurred, your input would be greatly appreciated.

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

No branches or pull requests

2 participants