We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to use enterprise search api for this because I want to define fromDate and toDate parameters.
I couldn't find any way to do it though, and when I try to cursor tweets from this date, It only returns the tweets about 14 days ago from now.
twitter = Twython(consumer_token, access_token=ACCESS_TOKEN) Search parameters def search_query(QUERY_TO_BE_SEARCHED): """ QUERY_TO_BE_SEARCHED : text you want to search for """ df_dict=[] results = twitter.cursor(twitter.search, q=QUERY_TO_BE_SEARCHED,fromDate='2019071200',toDate='2019071400',count=100) for q in results: retweet_count = q['retweet_count'] favs_count = q['favorite_count'] date_created = q['created_at'] text = q['text'] hashtags = q['entities']['hashtags'] user_name = '@'+str(q['user']['screen_name']) user_mentions = [] if(len(q['entities']['user_mentions'])!=0): for n in q['entities']['user_mentions']: user_mentions.append(n['screen_name']) # Mentioned profile names in the tweet temp_dict = {'User ID':user_name,'Date':date_created,'Text':text,'Favorites':favs_count,'RTs':retweet_count, 'Hashtags':hashtags,'Mentions':user_mentions} df_dict.append(temp_dict) return pd.DataFrame(df_dict)
twitter = Twython(consumer_token, access_token=ACCESS_TOKEN)
def search_query(QUERY_TO_BE_SEARCHED): """ QUERY_TO_BE_SEARCHED : text you want to search for """ df_dict=[]
results = twitter.cursor(twitter.search, q=QUERY_TO_BE_SEARCHED,fromDate='2019071200',toDate='2019071400',count=100) for q in results: retweet_count = q['retweet_count'] favs_count = q['favorite_count'] date_created = q['created_at'] text = q['text'] hashtags = q['entities']['hashtags'] user_name = '@'+str(q['user']['screen_name']) user_mentions = [] if(len(q['entities']['user_mentions'])!=0): for n in q['entities']['user_mentions']: user_mentions.append(n['screen_name']) # Mentioned profile names in the tweet temp_dict = {'User ID':user_name,'Date':date_created,'Text':text,'Favorites':favs_count,'RTs':retweet_count, 'Hashtags':hashtags,'Mentions':user_mentions} df_dict.append(temp_dict) return pd.DataFrame(df_dict)
that is my code, can you help me improve this ?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I want to use enterprise search api for this because I want to define fromDate and toDate parameters.
I couldn't find any way to do it though, and when I try to cursor tweets from this date, It only returns the tweets about 14 days ago from now.
that is my code, can you help me improve this ?
The text was updated successfully, but these errors were encountered: