-
-
Save nicholasserra/14a0a0aabec05b310adcc73aa817f551 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" | |
twitterscraper "github.com/n0madic/twitter-scraper" | |
"os" | |
) | |
func main() { | |
user := "splrawiki" | |
var arr []interface{} | |
scraper := twitterscraper.New() | |
for tweet := range scraper.GetTweets(context.Background(), user, 5000) { | |
if tweet.Error != nil { | |
panic(tweet.Error) | |
} | |
arr = append(arr, tweet) | |
} | |
e, _ := json.Marshal(arr) | |
f, _ := os.Create(user + ".json") | |
defer f.Close() | |
f.Write(e) | |
f.Sync() | |
arrLength := len(arr) | |
fmt.Println("Total:", arrLength) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment