Twitter API Data Collection -- 3
Budget: $8 – $15 USD
We have a good code but dosen't collect more than a 100 tweets, if u have an alternative code its ok.
import tweepy consumer_key= "" consumer_key_secret= "" access_token= "v6" access_token_secret= "" twitter_auth = tweepy.OAuthHandler(consumer_key, consumer_key_secret) api = tweepy.API(twitter_auth) tweets = api.search_tweets("covid", count=100) print(tweets) import re import pandas as pd from textblob import TextBlob df = pd.DataFrame(columns=('tweet_text', 'tweet_sentiment')) df.sort_values("tweet_text", inplace = True) df.drop_duplicates(subset ="tweet_text", keep = False, inplace = True) for tweet in tweets: sentimentText = TextBlob(tweet.text) df = df.append({'tweet_text': re.sub(r'http\S+', '', tweet.text), 'tweet_sentiment': sentimentText.sentiment.polarity}, ignore_index=True) df
import tweepy consumer_key= "" consumer_key_secret= "" access_token= "v6" access_token_secret= "" twitter_auth = tweepy.OAuthHandler(consumer_key, consumer_key_secret) api = tweepy.API(twitter_auth) tweets = api.search_tweets("covid", count=100) print(tweets) import re import pandas as pd from textblob import TextBlob df = pd.DataFrame(columns=('tweet_text', 'tweet_sentiment')) df.sort_values("tweet_text", inplace = True) df.drop_duplicates(subset ="tweet_text", keep = False, inplace = True) for tweet in tweets: sentimentText = TextBlob(tweet.text) df = df.append({'tweet_text': re.sub(r'http\S+', '', tweet.text), 'tweet_sentiment': sentimentText.sentiment.polarity}, ignore_index=True) df