File: get_tweets.py

package info (click to toggle)
tweepy 4.12.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,488 kB
  • sloc: python: 6,042; makefile: 16; javascript: 10
file content (20 lines) | stat: -rw-r--r-- 566 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import tweepy


bearer_token = ""

client = tweepy.Client(bearer_token)

# Get Tweets

# This endpoint/method returns a variety of information about the Tweet(s)
# specified by the requested ID or list of IDs

tweet_ids = [1460323737035677698, 1293593516040269825, 1293595870563381249]

# By default, only the ID and text fields of each Tweet will be returned
# Additional fields can be retrieved using the tweet_fields parameter
response = client.get_tweets(tweet_ids, tweet_fields=["created_at"])

for tweet in response.data:
    print(tweet.id, tweet.created_at)