Skip to content

Commit

Permalink
collecting err in twitter calls into Tweet struct, err will be in idx 0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdutchak committed Aug 1, 2024
1 parent 0b5831d commit c2b7524
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/scrapers/twitter/tweets.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func ScrapeTweetsForSentiment(query string, count int, model string) (string, st
if err != nil {
return "", "", err
}
return prompt, sentiment, nil
return prompt, sentiment, tweets[0].Error
}

// ScrapeTweetsByQuery performs a search on Twitter for tweets matching the specified query.
Expand Down Expand Up @@ -181,7 +181,7 @@ func ScrapeTweetsByTrends() ([]*TweetResult, error) {
trendResults = append(trendResults, trendResult)
}

return trendResults, nil
return trendResults, trendResults[0].Error
}

// ScrapeTweetsProfile scrapes the profile and tweets of a specific Twitter user.
Expand All @@ -198,7 +198,6 @@ func ScrapeTweetsProfile(username string) (twitterscraper.Profile, error) {

profile, err := scraper.GetProfile(username)
if err != nil {
logrus.Printf("Error fetching profile: %v", err)
return twitterscraper.Profile{}, err
}

Expand Down

0 comments on commit c2b7524

Please sign in to comment.