The title pretty much sums in up. I put down what I tried below.

Is there a better twitter API package out there? Or should I just do my requests "manually".



library(rtweet)

# Set up your Twitter API credentials
api_key <- "your_api_key"
api_secret_key <- "your_api_secret_key"
access_token <- "your_access_token"
access_token_secret <- "your_access_token_secret"

# Authenticate with Twitter
token <- create_token(
  app = "your_app_name",
  consumer_key = api_key,
  consumer_secret = api_secret_key,
  access_token = access_token,
  access_secret = access_token_secret
)

# Search for tweets using a specific hashtag
tweets <- search_tweets("#example", n = 10, lang = "en", token = token)

# Print the text of the tweets
for (tweet in tweets$text) {
  print(tweet)
}
0

There are 0 answers