Skip to content

A node.js app that grabs tweets from your favorite profiles, filters them according to a search string, and saves a screenshot of the tweet.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.txt
Notifications You must be signed in to change notification settings

lewis-munyi/tweet-to-screenshot

Repository files navigation

Tweet-to-screenshot

A Python/node.js app that extracts tweets from your favourite profiles, filters them according to a search string, and saves a screenshot of the tweet.

Buy Me A Coffee

Table of Contents

Tweet to screenshot

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

You will need these to run and set up the app

  • Python 3
  • Pip
  • Node.js installed on your PC

Installing

  1. Clone or download the repo from this url and extract it.

  2. Open your console and change into that directory

    cd tweet-to-screenshot/
    
  3. List the contents of the directory.

    ls
    
  4. You should have such a directory structure

    javascript-web-scraper/
    └── config.py
    |── .gitignore
    │── .env.example
    |── tweet.py           
    |── search.js
    |── ...
    │── ...     
    |── index.js
    └── package.json
    
  5. Install the required python modules

    npm install
    
  6. Install the required modules for npm

    pip install -r requirements.txt
    
  7. Copy the .env.example file to .env

     cp .env.example .env
    
  8. Visit the twitter developer page to get your app's API keys.

  9. Enter your twitter API keys in the respective fields of the .env file. Makes sure you add them in the .env file, and not the .env.example file.

    CONSUMER_KEY = ""
    CONSUMER_SECRET = ""
    ACCESS_KEY = ""
    ACCESS_SECRET = ""
    
  10. That's it!

Running the app

The app is split into two parts;

  • A web scraping application that scraps data and stores it in Cloud firestore
  • Cloud functions that are triggered and run when updating the Telegram bot.

Running the app

  1. Open the config.py file and add the usernames of the people who's tweets you want to harvest. Add them in the profiles object.

    profiles = [
        "username1",
        "username2"
    ]
    
  2. Open your console and from the root(/) directory, run

    python ./tweets.py
    

    It should display the progress of the harvesting activity.

  3. To search and take a screenshot. open search.js

  4. In the search_term object, add the string you want to query. E.g.

    search_terms = [
        "strawberry ice cream",
        "marshmallows"
    ]
    
  5. Run

    npm run start
    
  6. It will open the tweets and save the screenshot to the /images directory.

  7. If you want to get rid of the pop up windows, change the state flag in search.js to true

    export const state = true
    

Yaay! It works.

Deployment

Work in progress ...

Built With

  • Tweepy - Tweet harvesting library
  • Pupeeteer - Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol

Contributing

Currently accepting pull requests.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

Enjoy 🤘

About

A node.js app that grabs tweets from your favorite profiles, filters them according to a search string, and saves a screenshot of the tweet.

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •