/Twitter-Hashtag-Bot

Bots to find and retrieve tweets of a hashtag

Primary LanguagePython

A Twitter bot to extract tweets of a given hashtag

SETUP
a. pip install selenium
b. pip install twython

USAGE

Note: Both bots only retrieve tweets associated with a hashtag. Pass the search term without '#' to the terminal

  1. To extract tweets for hashtags older than a week old(Web crawling)
    a) Download Selenium Webdriver for Chrome. Change path accordingly on line 49 of crawlerBot.py
    b) python crawlerBot.py hashtagToSearch filename.csv
    c) On a CSV file with the passed name, for every tweet, the following are saved:
    i. Username
    ii. The tweet
    iii. The date
    iv. Number of retweets
    v. Number of likes
    vi. Number of replies

  2. To extract tweets for hashtags less than a week old (Using Twitter API)
    a) Go to https://apps.twitter.com/ and register for API keys. Update lines 39-42 appropriately
    b) python APIBot.py hashtagToSearch filename.json
    c) On a JSON file with the passed name, ALL the data provided for each tweet(IT'S A LOT!!) by the Twitter API is dumped as as a JSON array