Skip to content

Commit

Permalink
Use embed data if gql scrape is failed for any reason
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Jul 23, 2024
1 parent 96d173e commit 2611273
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions handlers/scraper/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,8 @@ func (i *InstaData) ScrapeData() error {
gqlValue, err := scrapeFromGQL(i.PostID)
if err != nil {
slog.Error("Failed to scrape data from scrapeFromGQL", "postID", i.PostID, "err", err)
return err
}
if !strings.Contains(utils.B2S(gqlValue), "require_login") {
if gqlValue != nil && !strings.Contains(utils.B2S(gqlValue), "require_login") {
gqlData = gjson.Parse(utils.B2S(gqlValue)).Get("data")
slog.Info("Data parsed from GraphQL API", "postID", i.PostID)
}
Expand Down

0 comments on commit 2611273

Please sign in to comment.