# practical 2 twitter social media data access : !pip install tweepy ##Import Libraries & Set Bearer Token import tweepy #Replace this with your actual Bearer Token from Twitter Developer Portal BEARER_TOKEN = "AAAAAAAAAAAAAAAAAAAAAH0R3AEAAAAAX2tfpLbHZqhjBLHDvTN1s%2Bx3qkw%3DPIezSv6QkW4iEnHVR9kt1CaFj5bM4RbTGgHFV3W6cwmWjnUF1H" #Initialize Tweepy Client client = tweepy.Client(bearer_token=BEARER_TOKEN) ##Define the Fetch Function (same as original) def fetch_tweets(keyword, max_results=10): response = client.search_recent_tweets( query=keyword, max_results=max_results, tweet_fields=['created_at', 'text', 'author_id', 'lang', 'public_metrics'] ) tweets = response.data if tweets is None: print("No tweets found for the given keyword.") return for idx, tweet in enumerate(tweets, start=1): print(f"\nTweet {idx}:") print(f"Time : {tweet.created_at}") print(f"Tweet ID : {tweet.id}") print(f"Author ID: {tweet.author_id}") print(f"Language : {tweet.lang}") print(f"Text : {tweet.text}") print(f"Likes : {tweet.public_metrics['like_count']}") print(f"Retweets : {tweet.public_metrics['retweet_count']}") print("-" * 50) keyword = input("Enter keyword to search tweets: ") fetch_tweets(keyword)