PanNorek / tweet-manager

A simple app for collecting tweets from Twitter API by given hashtags or account name.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tweet-manager

A simple app for collecting tweets from Twitter API by given hashtags or account name

📂 Directory Structure

├───assets
└───data
    ├───notepad2
    ├───src
    │   └───tweetscrapper
    └───tests

🚀 How to run

Project Setup

  • Create a virtual environment using virtualenv venv
  • Activate the virtual environment by running venv/bin/activate
  • On Windows use venv\Scripts\activate.bat
  • Install the dependencies using pip install -r requirements.txt
  • Open Edit Configuration File to configure your setup.
  • Edit Run.bat file to specify your python path.
  • Double click Run.bat file and enjoy!
  • You can check unittests by switching folder from root to data and typing python -m unittest

    Twitter developer account

    1. Login to your account on Twitter https://twitter.com/login
    2. Create dev account https://developer.twitter.com/en/portal/petition/essential/basic-info
    3. Create a new app and project. https://developer.twitter.com/en/portal/dashboard
    4. Copy all the keys from the app and keep them in the api_keys.json file (this version only needs the bearer token) You can paste your keys in the your_api_keys_sample.json file and cut off 'your_' and '_sample' from the file name.

    Configuration file – basic informations

    This section contains minimum information that you need to know to quickly run tweet-manager.

    Follow these steps to run your first job with tweet-manager:

    1. Open configuration file (you can simply open it by clicking Edit Configuration File.bat

    2. Specify keys_path as a full (absolute) path to the json file where your Twitter Api keys are stored.

    3. Run tweet-manager.

    This will create output file with a name specified by output_path in the input folder (location of input file).

    Configuration file – details and advanced features

    A job is defined by 5 parameters:

  • keys_path - absolute (full) path to the json file where your Twitter Api keys are stored.
  • max_results - number of tweets taken by specified hashtag/user
  • all_conversation - True/False if you what the tweets with replies(default number of replies per tweet is 100)
  • output_path - path to the output file. It can be absolute or relative to the folder where the input file is located. It may contain tags , and that are replaced with proper values at runtime. And one of these two:
  • hashtag - name of desired hashtag
  • account_name - name of account

    Example configuration files

    1. Single mode Screenshot

    2. Batch mode Screenshot As you can see - the vast part of parameters can be stored in [DEFAULT] section of config file. The only one thing you have to specify in the jobs is the hashtag or account name.

    📅 Development Schedule

    Version 1.0.0

    • Beta version (Minimum viable product)

    Version 1.1.0

    • Merge all json files into big one
    • Add tool to find current most popular hashtags

    📧 Contact

    If you find a bug, you have an idea for improvement or you need help, let me know:

  • About

    A simple app for collecting tweets from Twitter API by given hashtags or account name.


    Languages

    Language:Python 97.5%Language:Batchfile 2.5%