Skip to content

Commit

Permalink
skip
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Jul 23, 2024
1 parent 219c88c commit 2ad2cb2
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions handlers/scraper/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,7 @@ func (i *InstaData) ScrapeData() error {
videoBlocked := strings.Contains(utils.B2S(body), "WatchOnInstagram")
// Scrape from GraphQL API only if video is blocked or embed data is empty
if videoBlocked || len(body) == 0 {
gqlValue, err := scrapeFromGQL(i.PostID)
if err != nil {
slog.Error("Failed to scrape data from scrapeFromGQL", "postID", i.PostID, "err", err)
}
gqlValue, _ := scrapeFromGQL(i.PostID)
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 Expand Up @@ -446,8 +443,6 @@ func scrapeFromGQL(postID string) ([]byte, error) {
if err == nil && len(body) > 0 {
return body, nil
}
} else if err != nil {
slog.Error("Failed to scrape data from GraphQL API", "postID", postID, "err", err)
}
return nil, ErrNotFound
}

0 comments on commit 2ad2cb2

Please sign in to comment.