Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jonathanweinberg/692b3b80bb80c1a3ca34f56653605439 to your computer and use it in GitHub Desktop.
Save jonathanweinberg/692b3b80bb80c1a3ca34f56653605439 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