Skip to content

A bot which scrapes all tweets from twitter containing a user provided search term

Notifications You must be signed in to change notification settings

ckigenk/Twitter-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitter bot

Twitter bot scrapes all the tweets from twitter which contains a search term provided by the user. The program retrieves the following from a tweet:

  • Name of user
  • Username
  • Tweet itself
  • Retweet count
  • Likes count

All the data is saved in a csv file.

Installation

Prerequisites

Python

https://www.python.org/

Selenium

pip install selenium 

Chrome web driver

  • Check your chrome version
chrome://version
  • Download the chrome driver matching your version
https://chromedriver.chromium.org/downloads

Steps

  1. Clone this repository

    git@github.com:ckigenk/Twitter-bot.git
    
  2. Edit the bot/constants.py file:

    • PATH = copy the path to your chrome driver
    • USERNAME = your twitter username
    • PASSWORD = your twitter password
    • SEARCH_TERM = what you want to search, any term or hashtag
     PATH = r"" 
     URL="https://twitter.com/i/flow/login"
     USERNAME=""
     PASSWORD=""
     SEARCH_TERM=""
    
  3. Run the main.py file

    python main.py
    

Sample output

Screenshot of csv file containng tweet data

About

A bot which scrapes all tweets from twitter containing a user provided search term

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages