twitter-scraper
twitter-scraper copied to clipboard
panic: response status 404 Not Found: {"errors":[{"message":"Sorry, that page does not exist","code":34}]}
I'm getting this error when try to run my code:
panic: response status 404 Not Found: {"errors":[{"message":"Sorry, that page does not exist","code":34}]}
goroutine 1 [running]: main.main() /root/ws/go/teste.go:19 +0x4b8 exit status 2
It was working but stoped at some point. Here is my code:
package main
import (
"context"
"fmt"
"time"
twitterscraper "github.com/n0madic/twitter-scraper"
)
func main() {
scraper := twitterscraper.New().WithDelay(4)
scraper.WithClientTimeout(time.Second * 20)
scraper.SetSearchMode(twitterscraper.SearchLatest)
scraper.Login("Username", "Password")
for tweet := range scraper.SearchTweets(context.Background(), "Twitter", 5) {
if tweet.Error != nil {
panic(tweet.Error)
}
fmt.Println(tweet.Username)
fmt.Println(tweet.Text)
fmt.Println(tweet.Likes)
fmt.Println(tweet.Replies)
fmt.Println("----------------")
}
}
I tried to change the SearchTweets
method to to GetTweets
but go this error:
panic: response status 429 Too Many Requests:
goroutine 1 [running]: main.main() /root/ws/go/teste.go:19 +0x4b8 exit status 2
Don't know if I'm doing something wrong, or Twitter has broken this Search Mode, because it was working until 2 or 3 months ago.