ahmdrz / goinsta

Unofficial Instagram API written in Golang
MIT License
895 stars 247 forks source link

comment count does not match comment slice #148

Closed tcurdt closed 5 years ago

tcurdt commented 6 years ago

I am using version 2.3 and I see that with this code

item.Comments.Sync()

logger.Printf("post[%d]: id=%s comments=%d\n", postsCur, item.ID, item.CommentCount)

for item.Comments.Next() {
  for _, comment := range item.Comments.Items {
    logger.Printf(" comment: id=%d user=%s text=%s\n", comment.ID, comment.User.Username, comment.Text)
  }
}

the CommentCount does not always match the Comments.Items. I see e.g. CommentCount=7 but the Comments.Items is empty.

dgrr commented 6 years ago

Right now I am very busy. I think I could fix goinsta errors and update to newer version in a few weeks. We accept pull requests.

Thanks.

tcurdt commented 6 years ago

From looking at the source code it seems like CommentCount is just de-serialized from json. And that number seems to be correct. So I guess some of the Comments.Items are missing. Which probably means (I am guessing) that they are probably available under a different path inside the json response.