diff --git a/CHANGELOG.txt b/CHANGELOG.txt index dd336fd..622011d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -341,3 +341,8 @@ v0.6.15 - BUGFIX: `webserver` subcommand now respects the `--session` flag - More types of scraping errors now show toasts in the UI: rate limiting, expired session - New `--delay` flag added to introduce a delay in paginated scrapes + +v0.6.16 +------- + +- Add notifications diff --git a/cmd/twitter/main.go b/cmd/twitter/main.go index a9a0fc9..ec963e8 100644 --- a/cmd/twitter/main.go +++ b/cmd/twitter/main.go @@ -315,7 +315,7 @@ func fetch_tweet_only(tweet_identifier string) { } tweet, err := api.GetTweet(tweet_id) - if is_scrape_failure(err) { + if is_scrape_failure(err) || errors.Is(err, scraper.ErrRateLimited) { die(fmt.Sprintf("Error fetching tweet: %s", err.Error()), false, -1) } log.Debug(tweet) diff --git a/doc/TODO.txt b/doc/TODO.txt index 650522e..de6bf26 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -27,7 +27,6 @@ TODO twitter-spaces TODO authenticated-requests - media tab - quote-tweets -- notifications TODO post-tweets - post tweets diff --git a/pkg/scraper/api_request_utils.go b/pkg/scraper/api_request_utils.go index 3e7ba9c..2561425 100644 --- a/pkg/scraper/api_request_utils.go +++ b/pkg/scraper/api_request_utils.go @@ -256,6 +256,7 @@ func (api *API) do_http(remote_url string, cursor string, result interface{}) er if resp.StatusCode == 429 { // "Too many requests" => rate limited + log.Warn("HTTP 429") reset_at := TimestampFromUnix(int64(int_or_panic(resp.Header.Get("X-Rate-Limit-Reset")))) return fmt.Errorf("%w (resets at %d, which is in %s)", ErrRateLimited, reset_at.Unix(), time.Until(reset_at.Time).String()) }