DEV Community

Lyner Lim
Lyner Lim

Posted on

Tweepy - Twitter Data Scraping in 2025

Note that to select Read and write in App permissions under User authentication settings.

client = tweepy.Client(
    bearer_token=BREARER,
    consumer_key=API_KEY,
    consumer_secret=API_KEY_SECRET,
    access_token=ACCESS_TOKEN,
    access_token_secret=ACCESS_TOKEN_SECRET,
    return_type = dict,
    wait_on_rate_limit = True
)

response = client.search_recent_tweets(
    "artifical intelligence OR machine learning lang:en",
    max_results = 10,
    tweet_fields = ['author_id','created_at','text']
)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)