-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
29 lines (24 loc) · 812 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import rssbot
def main():
rss_list = [
'http://www.univer.kharkov.ua/rss/anons.rss',
'http://www.univer.kharkov.ua/rss/news.rss',
'http://www.univer.kharkov.ua/rss/conf.rss',
'http://landaucentre.org/feed/',
'http://career.karazin.ua/feed/',
'http://profkom.ua/feed/',
# 'http://unk.kh.ua/feed/',
]
sources = list(map(rssbot.RSSSource, rss_list))
url_shortener = rssbot.BitlyShortifier(os.environ.get('BITLY_TOKEN'))
bot = rssbot.RSSBot(
token=os.environ.get('TELEGRAM_TOKEN'),
shortener=url_shortener,
channel_id=int(os.environ.get('TELEGRAM_CHAT_ID')),
source_list=sources,
db_uri=os.environ.get('DATABASE_URL')
)
bot.publish_news()
if __name__ == '__main__':
main()