Skip to content

Instantly share code, notes, and snippets.

@stefanschmidt
Created November 26, 2022 17:02
Show Gist options
  • Save stefanschmidt/468fddc61329a6987f75e250e1d4ae24 to your computer and use it in GitHub Desktop.
Save stefanschmidt/468fddc61329a6987f75e250e1d4ae24 to your computer and use it in GitHub Desktop.
Download all tweets of a user without requiring an API key
// To my knowledge the only solution available that:
// - does not require an API key with "elevated access" (most other solutions need this, requires an application)
// - does not require an API key with "essential access" (requires a valid cell phone number to enable)
// - does not require any type of API key
// - isn't outdated or otherwise broken
//
// Can (probably) download up to 3200 tweets
//
// brew install go
// go run download_all_tweets.go
package main
import (
"context"
"fmt"
twitterscraper "github.com/n0madic/twitter-scraper"
)
func main() {
scraper := twitterscraper.New()
for tweet := range scraper.GetTweets(context.Background(), "foobar", 3200) {
if tweet.Error != nil {
panic(tweet.Error)
}
fmt.Println(tweet.Text)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment