- the bot creates log
- the bot shows subscribers and view statistic info for selected youtube channel.
- once every n seconds the bot check the change in the number of subscribers and sends a notification to the designated contacts if the numbers have changed
build on heroku and use postgres
don't forget to create tables and specify your config vars on Heroku
variable name | type | description |
---|---|---|
CHANNEL_NAME |
str | name of the channel and table to store data in database |
DATABASE_URL |
str | connection string for your database |
PROJECT_NAME |
str | just name of your project. use to make heroku web hook |
TELEGRAM_TOKEN |
str | create your bot and get the token here |
YOUTUBE_TOKEN |
str | your token more info |
DELAY |
int | sleep time (seconds) |
for local use, create config.py
with environ variables
import os
os.environ['CHANNEL_NAME'] = 'name of the channel and database you create'
os.environ['DATABASE_URL'] = 'con. string'
os.environ['PROJECT_NAME'] = 'bot name'
os.environ['TELEGRAM_TOKEN'] = '<your token>'
os.environ['YOUTUBE_TOKEN'] = '<your token>'
os.environ['DELAY'] = 900 # sleep time
- пишет логи
- возвращать по запросу количество просмотров и подписчиков канала на youtube.com
- раз в n секунд проверять изменение количества подписчиков и отправляет уведомление обозначенным контактам если цифры изменились
Настроен на работу с сервисом heroku и базой данных posgressql.
Не забудь создать нужные таблицы и прописать переменные окружения в Heroku
variable name | type | description |
---|---|---|
CHANNEL_NAME |
str | name of the channel and table to store data in database |
DATABASE_URL |
str | connection string for your database |
PROJECT_NAME |
str | just name of your project. use to make heroku web hook |
TELEGRAM_TOKEN |
str | create your bot and get the token here |
YOUTUBE_TOKEN |
str | your token more info |
DELAY |
int | sleep time (seconds) |
Для локального исполнения, создай файл config.py
с переменными окружения
import os
os.environ['CHANNEL_NAME'] = 'name of the channel and database you create'
os.environ['DATABASE_URL'] = 'con. string'
os.environ['PROJECT_NAME'] = 'bot name'
os.environ['TELEGRAM_TOKEN'] = '<your token>'
os.environ['YOUTUBE_TOKEN'] = '<your token>'
os.environ['DELAY'] = 900 # sleep time