I've rewritten the code to work with Twitter's v2 API, incorporating asynchronous queues and the latest versions of Tweepy and Python-Telegram-Bot. Instead of requiring any keys from Twitter, it now only needs a Bearer token. What it does:
- takes a list of users from Google Sheets.
- saves them to local sqlite database
- checks latest posted Tweet for every user
- it the tweet was not processed - fetches it and uses filters to process it
- forward tweet to telegram channel
credentials.json from Google Sheets API is needed
A simple Telegram Bot to Stream the tweets from any account from twitter to your telegram channel.
- Get Twitter API Keys and Access Keys from here
- Ask for Twitter elevated permissions here, click at Elevated option and fill the forms
- Go to @BotFather in telegram and create a Bot
- Open keys_sample.env and fill the API Keys and Access Keys and Chat ID where you want the bot to send messages.
- Rename
key_sample.env
tokeys.env
- Open
userlist.py
and add the usernames of the person's you want to Stream tweets from for Example:-userslist = ['elonmusk','nasa']
- Run the Bot by executing:
pip3 install -r requirements.txt
python3 main.py
Just do all the things given in the Guide except the 6th part and follow the further steps here for Heroku deployment.
- Create a Heroku APP
- Git add and commit the files in the project directory and make sure you have the Heroku CLI installed.
git add. -f
git commit -m "Initial Commit"
git push heroku HEAD:master --force
- Then go to the app page in your heroku dashboard and turn on the dynos.