Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

453 error #2

Open
poojatambe08 opened this issue Aug 6, 2023 · 1 comment
Open

453 error #2

poojatambe08 opened this issue Aug 6, 2023 · 1 comment

Comments

@poojatambe08
Copy link

Getting below error

453 - You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product

@awasumina
Copy link

Getting below error

453 - You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product

use it this way

# Twitter API keys
bearer_token = "YOUR_BEARER_TOKEN"

client = tweepy.Client(bearer_token=bearer_token)

# Fetch tweets using the v2 API
user_id = client.get_user(username='justinbieber').data.id
tweets = client.get_users_tweets(user_id, max_results=100, tweet_fields=["created_at", "public_metrics", "text"])

tweets_data = []
for tweet in tweets.data:
    tweets_data.append({
        "created_at": tweet.created_at,
        "text": tweet.text,
        "retweet_count": tweet.public_metrics["retweet_count"],
        "like_count": tweet.public_metrics["like_count"],
    })

df = pd.DataFrame(tweets_data)
df.to_csv("refined_tweets_v2.csv", index=False)
print("Tweets saved successfully!")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants