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.
- Getting started
- Prerequisites
- Installing
- Running the app
- Deployment
- Built With
- Authors
- License
- Acknowledgments
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.
You will need these to run and set up the app
- Python 3
- Pip
- Node.js installed on your PC
-
Clone or download the repo from this url and extract it.
-
Open your console and change into that directory
cd tweet-to-screenshot/ -
List the contents of the directory.
ls -
You should have such a directory structure
javascript-web-scraper/ └── config.py |── .gitignore │── .env.example |── tweet.py |── search.js |── ... │── ... |── index.js └── package.json -
Install the required python modules
npm install -
Install the required modules for npm
pip install -r requirements.txt -
Copy the
.env.examplefile to.envcp .env.example .env -
Visit the twitter developer page to get your app's API keys.
-
Enter your twitter API keys in the respective fields of the
.envfile. Makes sure you add them in the.envfile, and not the.env.examplefile.CONSUMER_KEY = "" CONSUMER_SECRET = "" ACCESS_KEY = "" ACCESS_SECRET = "" -
That's it!
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.
-
Open the
config.pyfile and add the usernames of the people who's tweets you want to harvest. Add them in theprofilesobject.profiles = [ "username1", "username2" ] -
Open your console and from the root(
/) directory, runpython ./tweets.pyIt should display the progress of the harvesting activity.
-
To search and take a screenshot. open
search.js -
In the
search_termobject, add the string you want to query. E.g.search_terms = [ "strawberry ice cream", "marshmallows" ] -
Run
npm run start -
It will open the tweets and save the screenshot to the
/imagesdirectory. -
If you want to get rid of the pop up windows, change the
stateflag insearch.jstotrueexport const state = true
Yaay! It works.
Work in progress ...
- 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
Currently accepting pull requests.
- Lewis Munyi - Dev - Website
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details
- Hat tip to anyone whose code was used
- Photo by Luke Chesser on Unsplash
Enjoy 🤘
