GithubHelp home page GithubHelp logo

durhamster / tweetscraper Goto Github PK

View Code? Open in Web Editor NEW
20.0 1.0 10.0 81 KB

A simple script to scrape a list of accounts or single account from Twitter into a neatly formatted Excel file.

License: MIT License

Shell 1.38% Python 98.62%
twitter python twitter-api scraper social-media web-scraping tweepy

tweetscraper's Introduction

TweetScraper

GitHub Pipenv locked Python version License

A script using the Twitter API to do the following:

  1. Scrape a single account
  2. Scrape a list of accounts
  3. Get the follower count for a list of accounts
  4. Check a list of handles to see if any are suspended, private, or incorrect.
  5. Scrape tweets based on a keyword search.

All tweets and follower counts are saved to a formatted excel (.xlsx) file. All URLs will be converted to strings if they exceed the limit in excel (65,530).

Please note that this only scrapes up to the 500 recent tweets (the end result may be less than this depending on the account or keyword you are scraping for). This can be changed in the script itself.

Installation

Use the package manager pip to install the required libraries.

pip install -r requirements.txt

or

Using pipenv:

pipenv install

Obtaining a Twitter Developer Key

If you do not have a Twitter handle you must first sign up for one.

  1. Apply for API access
  2. Create your application.
  3. Get your authentication details.
  4. In the folder containing this README file (the main folder for this project)
    • Open the .env file and enter the client id and secret like the following and save the file.
consumer_key = "YourConsumerKeyHere"
consumer_secret = "YourSecretKeyHere"
access_key = "YourAccessKeyHere"
access_secret = "YourAccessSecretHere"

More detailed instructions on how to obtain an api key can be found here.

Scraping Lists of Twitter Handles

When scraping multiple handles, this script will pause periodically to prevent the user from exceeding the rate limit.

To change the list of handles to be scraped, open the handles.txt file under the Account Lists directory. Do NOT include the '@' sign. Make sure to list one handle per line.

For example:

Twitter
Jack
BBCNews
Apple
Windows
msexcel
Android
Reddit
Discord
github

tweetscraper's People

Contributors

durhamster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tweetscraper's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.