# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
def search_tweets(search_term, max_count) :
    collected_tweets = []
    tweets = tweepy.Cursor(api.search, q=search_term, tweet_mode='extended', lang='en', result_type='popular', fromDate="201906241000").items(max_count)
    for tweet in tweets:
        print(tweet.full_text)
        # Add tweets in this format
        dict_ = {'Screen Name': tweet.user.screen_name,
                'User Name': tweet.user.name,
                'Tweet Created At': tweet.created_at,
                'Tweet Text': tweet.full_text,
                'User Location': tweet.user.location,
                'Tweet Coordinates': tweet.coordinates,
                'Retweet Count': tweet.retweet_count,
                'Retweeted': tweet.retweeted,
                'Phone Type': tweet.source,
                'Favorite Count': tweet.favorite_count,
                'Favorited': tweet.favorited,
                'Replied': tweet.in_reply_to_status_id_str
                }
        #content = tweet.
        collected_tweets.append(dict_)
        print("\n\n")
    return collected_tweets

search_term = "@swiggy_in OR @swiggycares"  #since:2019-06-24 until:2019-06-25
item = search_tweets(search_term,10)
#print(item)

# +
def search_tweets(search_term, max_count) :
    collected_tweets = []
    tweets = tweepy.Cursor(api.search, q=search_term, tweet_mode='extended', lang='en', until='2019-05-24').items(max_count)
    for tweet in tweets:
        print(tweet.full_text)
        print(tweet.created_at)
        # Add tweets in this format
        dict_ = {'Screen Name': tweet.user.screen_name,
                'User Name': tweet.user.name,
                'Tweet Created At': tweet.created_at,
                'Tweet Text': tweet.full_text,
                'User Location': tweet.user.location,
                'Tweet Coordinates': tweet.coordinates,
                'Retweet Count': tweet.retweet_count,
                'Retweeted': tweet.retweeted,
                'Phone Type': tweet.source,
                'Favorite Count': tweet.favorite_count,
                'Favorited': tweet.favorited,
                'Replied': tweet.in_reply_to_status_id_str
                }
        #content = tweet.
        collected_tweets.append(dict_)
        print("\n\n")
    return collected_tweets
        
item = search_tweets("Swiggy AND Zomato",10)
#print(item)

StarcoderdataJupyterScriptsDedupFiltered