Skip to content

Commit

Permalink
rm
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Jul 23, 2024
1 parent 377bf0f commit 845a8ec
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions handlers/scraper/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,13 @@ func (i *InstaData) ScrapeData() error {
}

var body []byte
for retries := 0; retries < 3; retries++ {
res, err := client.Do(req)
if res != nil && res.StatusCode == 200 {
defer res.Body.Close()
body, err = io.ReadAll(res.Body)
if err == nil && len(body) > 0 {
break
}
}
res, err := client.Do(req)
if err != nil {
slog.Error("Failed to scrape data from scrapeFromEmbedHTML", "postID", i.PostID, "err", err)
}
if res != nil && res.StatusCode == 200 {
defer res.Body.Close()
body, err = io.ReadAll(res.Body)
}

var embedData gjson.Result
Expand Down

0 comments on commit 845a8ec

Please sign in to comment.