Skip to content

Commit

Permalink
Fix decompression
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Jul 15, 2024
1 parent 33ae615 commit b9b548a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion handlers/scraper/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func (i *InstaData) ScrapeData() error {
var gqlData gjson.Result

client := http.Client{Timeout: timeout}
defer client.CloseIdleConnections()

// Scrape from remote scraper if available
if len(RemoteScraperAddr) > 0 {
Expand All @@ -131,7 +132,6 @@ func (i *InstaData) ScrapeData() error {
if err != nil {
return err
}
req.Header.Set("Accept-Encoding", "gzip, deflate, br")
if res, err := client.Do(req); err == nil {
defer res.Body.Close()
iDataGunzip, err := io.ReadAll(res.Body)
Expand Down Expand Up @@ -269,6 +269,7 @@ func (i *InstaData) ScrapeData() error {
if len(username) == 0 {
return ErrNotFound
}
log.Info().Str("postID", i.PostID).Msg("Data scraped from embedHTML")
return nil
}

Expand Down

0 comments on commit b9b548a

Please sign in to comment.