-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathjackett2telegram.py
690 lines (580 loc) ยท 23 KB
/
jackett2telegram.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
import inspect
import argparse
import logging
import requests
import os
import sqlite3
import string
import unicodedata
import xml.etree.ElementTree as ElementTree
from datetime import datetime
from telegram import (
helpers,
InlineKeyboardButton,
InlineKeyboardMarkup,
LinkPreviewOptions,
Update,
)
from telegram.ext import (
Application,
CallbackQueryHandler,
CommandHandler,
ContextTypes,
Defaults,
)
from typing import Any
from urllib import parse
blackhole_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "blackhole")
config_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "config")
db_path = os.path.join(config_path, "rss.db")
os.makedirs(blackhole_path, exist_ok=True)
os.makedirs(config_path, exist_ok=True)
rss_dict = {}
escaped_backslash = helpers.escape_markdown("-", 2)
char_limit = 255
# SQLITE
def init_sqlite() -> None:
logging.debug("Trying to create the Database")
conn = sqlite3.connect(db_path)
c = conn.cursor()
c.execute(
"""CREATE TABLE IF NOT EXISTS rss (name text PRIMARY KEY, link text, last_pubdate text, last_items text, is_down integer)"""
)
def sqlite_connect() -> None:
global conn
conn = sqlite3.connect(db_path, check_same_thread=False)
def sqlite_load_all() -> list[Any]:
sqlite_connect()
c = conn.cursor()
c.execute("SELECT * FROM rss")
rows = c.fetchall()
conn.close()
return rows
def sqlite_write(
name: str, link: str, last_pubdate: str, last_items: str, is_down: int
) -> None:
sqlite_connect()
c = conn.cursor()
values = [(name), (link), (last_pubdate), (last_items), (is_down)]
c.execute(
"""REPLACE INTO rss (name,link,last_pubdate,last_items,is_down) VALUES(?,?,?,?,?)""",
values,
)
conn.commit()
conn.close()
# RSS
def rss_load() -> None:
# if the dict is not empty, empty it.
if bool(rss_dict):
rss_dict.clear()
for row in sqlite_load_all():
rss_dict[row[0]] = (row[1], row[2], row[3], row[4])
async def cmd_rss_list(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
if not its_me(update):
return
indexers = ["*List of Registered Indexers\.*"]
if bool(rss_dict) is False:
indexers.append("The database is empty\.")
else:
for rss_name, rss_props in sorted(rss_dict.items(), key=lambda item: item[0]):
indexers.append(
f"Title: {helpers.escape_markdown(rss_name, 2)}"
+ f"\nJacket RSS: `{helpers.escape_markdown(rss_props[0], 2)}`"
+ f"\nLast article from: {helpers.escape_markdown(rss_props[1], 2)}"
+ f"\nStatus: {('โ๏ธ' if rss_props[3] == 0 else '๐ซ' if rss_props[3] == 2 else 'โ ๏ธ')}"
)
await telegram_send_reply_text(update, "\n\n".join(indexers))
async def cmd_rss_add(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
if not its_me(update):
return
if not context.args or not len(context.args) == 2:
await telegram_send_reply_error(
update,
"To add a new _Jackett or Prowlarr RSS_ the command needs to be:\n`/add TITLE JACKETT_OR_PROWLARR_RSS_FEED_URL`",
)
return
try:
response = requests.get(context.args[1])
root = ElementTree.fromstring(response.content)
channel = root.find("channel")
items = channel.findall("item") if channel is not None else []
except ElementTree.ParseError:
await telegram_send_reply_error(
update,
"The link does not seem to be a _Jackett or Prowlarr RSS Feed_ or is not supported\.",
)
return
except requests.exceptions.MissingSchema:
await telegram_send_reply_error(
update, "The _Jackett or Prowlarr RSS Feed Url_ is malformed\."
)
return
items.sort(
reverse=True, key=lambda item: pubDate_to_datetime(item.findtext("pubDate", ""))
)
sqlite_write(
context.args[0], context.args[1], items[0].findtext("pubDate", ""), str([]), 0
)
rss_load()
logging.info(f"List: Indexer {context.args[0]} | {context.args[1]} added.")
message = (
f"*Indexer added to list:* {helpers.escape_markdown(context.args[0], 2)}"
+ f"\n`{helpers.escape_markdown(context.args[1], 2)}`"
)
await telegram_send_reply_text(update, message)
async def cmd_rss_remove(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
if not its_me(update):
return
if not context.args or not len(context.args) == 1:
await telegram_send_reply_error(
update,
"To remove a _Jackett or Prowlarr RSS_ the command needs to be:\n`/remove TITLE`",
)
return
sqlite_connect()
c = conn.cursor()
q = (context.args[0],)
escaped_indexer = helpers.escape_markdown(context.args[0], 2)
try:
c.execute("SELECT count(*) FROM rss WHERE name = ?", q)
res = c.fetchall()[0][0]
if not (int(res) == 1):
await telegram_send_reply_error(
update,
f"Can't remove _Jackett or Prowlarr RSS_ with title _{escaped_indexer}_\. Not found\.",
)
return
c.execute("DELETE FROM rss WHERE name = ?", q)
conn.commit()
conn.close()
except sqlite3.Error:
await telegram_send_reply_error(
update, "Can't remove the _Jackett or Prowlarr RSS_ because of an unknown issue\."
)
return
rss_load()
await telegram_send_reply_text(
update, f"*Indexer removed from list:* {escaped_indexer}"
)
async def cmd_help(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
if not its_me(update):
return
msg = (
"*Jackett2Telegram \(Jackett and Prowlarr RSS to Telegram Bot\)*"
+ "\n\nAfter successfully adding a Jackett or Prowlarr RSS link, the bot starts fetching the feed every "
f"{str(delay)} seconds\. \(This can be set\)"
+ "\n\nTitles are used to easily manage RSS feeds and should contain only one word and are case sensitive\."
+ "\n\nCommands:"
+ "\n\- /help \- Posts this help message\. ๐"
+ "\n\- /add TITLE JACKETT\_OR\_PROWLARR\_RSS\_FEED\_URL \- Adds new Jackett or Prowlarr RSS Feed \(overwrited if title previously exist\)\."
+ "\n\- /remove TITLE \- Removes the RSS link\."
+ "\n\- /list \- Lists all the titles and the asociated Jackett or Prowlarr RSS links from the DB\."
+ "\n\- /test JACKETT\_OR\_PROWLARR\_RSS\_FEED\_URL \- Inbuilt command that fetches a post \(usually latest\) from a Jackett or Prowlarr RSS\."
+ "\n\nIn order to use *Blackhole*, your _Torrent_ client must support it and be configured to point to *Jackett2Telegram* _Blackhole_ folder\."
"\n\nIf you like the project, consider [BECOME A SPONSOR](https://github.com/sponsors/danimart1991)\."
)
if update.effective_message:
await update.effective_message.reply_text(msg)
elif context.bot:
await context.bot.send_message(chat_id, msg)
async def rss_monitor(context: ContextTypes.DEFAULT_TYPE) -> None:
for rss_name, rss_props in rss_dict.items():
try:
response = requests.get(rss_props[0])
root = ElementTree.fromstring(response.content)
if root.tag == "error":
code = root.attrib["code"]
description = root.attrib["description"]
if code == "410":
logging.info(f"Indexer {rss_name} is disabled.")
sqlite_write(rss_name, rss_props[0], rss_props[1], rss_props[2], 2)
else:
raise Exception(f"{code}: {description}")
else:
channel = root.find("channel")
items = channel.findall("item") if channel is not None else []
last_pubdate_datetime = pubDate_to_datetime(rss_props[1])
filteredItems = filter(
lambda item: pubDate_to_datetime(item.findtext("pubDate", ""))
>= last_pubdate_datetime,
items,
)
sortedFilteredItems = sorted(
filteredItems,
key=lambda item: pubDate_to_datetime(item.findtext("pubDate", "")),
)
if sortedFilteredItems:
last_items = eval(rss_props[2])
for item in sortedFilteredItems:
item_guid = item.findtext("guid", "")
if item_guid not in last_items:
last_items.append(item_guid)
await jackettitem_to_telegram(context, item, rss_name)
itemsCount = len(items)
while len(last_items) > itemsCount:
last_items.pop(0)
new_pubdate = sortedFilteredItems[-1].findtext("pubDate", "")
sqlite_write(
rss_name, rss_props[0], new_pubdate, str(last_items), 0
)
except Exception as exception:
# If not down yet, put down and send message.
if rss_props[3] != 1:
msg = f"Indexer {helpers.escape_markdown(rss_name, 2)} not available due to some issue\."
await context.bot.send_message(
chat_id, f"*ERROR:* {msg}", parse_mode="MARKDOWNV2"
)
logging.exception(f"{msg}: {exception}")
sqlite_write(rss_name, rss_props[0], rss_props[1], rss_props[2], 1)
pass
rss_load()
async def cmd_test(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
if not its_me(update):
return
if not context.args or not context.args[0]:
logging.error(f"User calls command /test with invalid arguments.")
await telegram_send_reply_error(
update, "The format needs to be:\n`/test JACKETT\_OR\_PROWLARR\_RSS\_FEED\_URL`"
)
return
try:
response = requests.get(context.args[0])
root = ElementTree.fromstring(response.content)
channel = root.find("channel")
if channel is None:
return
title = channel.findtext("title", default="")
items = channel.findall("item")
except ElementTree.ParseError:
await telegram_send_reply_error(
update,
"The link does not seem to be a _Jackett or Prowlarr RSS Feed_ or is not supported\.",
)
return
except requests.exceptions.MissingSchema:
await telegram_send_reply_error(
update, "The _Jackett or Prowlarr RSS Feed Url_ is malformed\."
)
return
items.sort(
reverse=True, key=lambda item: pubDate_to_datetime(item.findtext("pubDate", ""))
)
await jackettitem_to_telegram(context, items[0], title)
async def jackettitem_to_telegram(
context: ContextTypes.DEFAULT_TYPE, item: ElementTree.Element, rssName: str
) -> None:
coverurl = None
title = helpers.escape_markdown(
item.findtext("title", default=escaped_backslash), 2
)
category = (
parse_category(item.findtext("category", ""))
if item.findall("category")
else -1
)
icons = [parse_categoryIcon(category)]
trackerName = helpers.escape_markdown(rssName, 2)
externalLinks = []
seeders = escaped_backslash
peers = escaped_backslash
grabs = item.findtext("grabs", default=escaped_backslash)
files = item.findtext("files", default=escaped_backslash)
uploadvolumefactor = ""
downloadvolumefactor = ""
downloadUrl = ""
magnetUrl = ""
size = helpers.escape_markdown(
str(round(float(item.findtext("size", default=0)) / 1073741824, 2)) + "GiB", 2
)
guid = item.findtext("guid", default=None)
link = item.findtext("link", default=None)
if guid and guid.startswith("magnet:"):
magnetUrl = helpers.escape_markdown(guid, 2)
elif not magnetUrl and link and link.startswith("magnet:"):
magnetUrl = helpers.escape_markdown(link, 2)
if link and not link.startswith("magnet:"):
downloadUrl = link
keyboard = [[]]
if item.findall("comments"):
keyboard[0].append(
InlineKeyboardButton("๐", url=item.findtext("comments", default=None))
)
if downloadUrl:
if magnetUrl:
keyboard[0].append(InlineKeyboardButton("๐งฒ", url=downloadUrl))
else:
keyboard[0].append(InlineKeyboardButton("๐พ", url=downloadUrl))
keyboard[0].append(InlineKeyboardButton("๐ณ", callback_data="blackhole"))
reply_markup = InlineKeyboardMarkup(keyboard)
ns = {"torznab": "http://torznab.com/schemas/2015/feed"}
for torznabattr in item.findall("torznab:attr", ns):
torznabattr_name = torznabattr.get("name")
if torznabattr_name == "downloadvolumefactor":
downloadvolumefactor = parse_downloadvolumefactor(
float(torznabattr.get("value", 0))
)
if downloadvolumefactor:
icons.append(downloadvolumefactor[:1])
elif torznabattr_name == "uploadvolumefactor":
uploadvolumefactor = parse_uploadvolumefactor(
float(torznabattr.get("value", 0))
)
if uploadvolumefactor:
icons.append(uploadvolumefactor[:1])
elif torznabattr_name == "seeders":
seeders = torznabattr.get("value")
elif torznabattr_name == "peers":
peers = torznabattr.get("value")
elif torznabattr_name == "coverurl":
coverurl = torznabattr.get("value")
elif torznabattr_name == "imdbid":
externalLinks.append(
f"[*IMDb*](https://www.imdb.com/title/{torznabattr.get('value')})"
)
elif torznabattr_name == "tmdbid":
type = None
if category == 2:
type = "movie"
elif category == 5:
type = "tv"
if type:
externalLinks.append(
f"[*TMDb*](https://www.themoviedb.org/{type}/{torznabattr.get('value')})"
)
elif torznabattr_name == "magneturl" and not magnetUrl:
magnetUrl = torznabattr.get("value")
externalLinks = ("\n๐ " + "\|".join(externalLinks)) if externalLinks else ""
message = (
f"{helpers.escape_markdown('|'.join(icons),2)} \- {title} by _{trackerName}_"
+ f"{externalLinks}"
+ f"\n\n๐ค {seeders} ๐ฅ {peers} ๐พ {grabs} ๐ {size} ๐ {files}"
+ f"\n\n{downloadvolumefactor}{uploadvolumefactor}\n\n`{magnetUrl}`"
)
if coverurl:
try:
coverraw = requests.get(coverurl, stream=True).raw
await context.bot.send_photo(
chat_id,
photo=coverraw,
caption=message,
reply_markup=reply_markup,
)
return
# Error, most of the times is a Image 400 Bad Request, without reason.
except:
logging.warning(
"Error sending release with cover. Trying to send without cover."
)
await context.bot.send_message(chat_id, message, reply_markup=reply_markup)
async def cbq_to_blackhole(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
if not its_me(update):
return
if (
not (message := update.effective_message)
or not (reply_markup := message.reply_markup)
or not (query := update.callback_query)
):
await telegram_send_error(context, "The message cannot be found\.")
return
await query.answer()
inline_keyboard_zero = list(reply_markup.inline_keyboard[0])
inline_keyboard_zero.pop()
inline_keyboard_zero.append(InlineKeyboardButton("โณ", callback_data=query.data))
await context.bot.edit_message_reply_markup(
chat_id=message.chat_id,
message_id=message.message_id,
reply_markup=InlineKeyboardMarkup([inline_keyboard_zero]),
)
msg = None
torrent_url = reply_markup.inline_keyboard[0][1].url
if torrent_url:
torrent_file = parse.parse_qs(parse.urlparse(torrent_url).query)["file"][0]
if torrent_file:
torrent_file = clean_filename(torrent_file + ".torrent")
try:
torrent_data = requests.get(torrent_url)
if torrent_data and torrent_data.content:
button_msg = "โ๏ธ"
with open(os.path.join(blackhole_path, torrent_file), "wb") as file:
file.write(torrent_data.content)
else:
msg = "Can't obtain `.Torrent` file data\."
except Exception as exception:
if exception.args[0] and "magnet:?" in exception.args[0]:
msg = "It seems that the torrent is a magnet file, it can't be added using blackhole, please use another option\."
else:
logging.exception(exception)
msg = "Can't obtain `.Torrent` file data\."
else:
msg = "Can't obtain `.Torrent` file name\."
else:
msg = "Can't obtain `.Torrent` Url to download\."
if msg:
button_msg = "โ"
await telegram_send_reply_error(update, msg)
inline_keyboard_zero.pop()
inline_keyboard_zero.append(
InlineKeyboardButton(button_msg, callback_data=query.data)
)
await context.bot.edit_message_reply_markup(
chat_id=message.chat_id,
message_id=message.message_id,
reply_markup=InlineKeyboardMarkup([inline_keyboard_zero]),
)
async def post_init(application: Application) -> None:
msg = (
"*Jackett2Telegram has started\.*"
+ f"\nRSS Indexers: {str(len(rss_dict))}"
+ f"\nDelay: {str(delay)} seconds"
+ f"\nLog Level: {log_level}"
)
clean_msg = msg.replace("\n", " ")
logging.info(f"{inspect.stack()[1][3]} - {clean_msg}")
await application.bot.send_message(chat_id, msg)
# Telegram
async def telegram_send_message(context: ContextTypes.DEFAULT_TYPE, msg: str) -> None:
clean_msg = msg.replace("\n", " ")
logging.info(f"{inspect.stack()[1][3]} - {clean_msg}")
if bot := context.bot:
await bot.send_message(chat_id, f"*ERROR:* {msg}")
async def telegram_send_error(context: ContextTypes.DEFAULT_TYPE, msg: str) -> None:
clean_msg = msg.replace("\n", " ")
logging.error(f"{inspect.stack()[1][3]} - {clean_msg}")
if bot := context.bot:
await bot.send_message(chat_id, f"*ERROR:* {msg}")
async def telegram_send_reply_text(update: Update, msg: str) -> None:
clean_msg = msg.replace("\n", " ")
logging.info(f"{inspect.stack()[1][3]} - {clean_msg}")
if message := update.effective_message:
await message.reply_text(msg)
async def telegram_send_reply_error(update: Update, msg: str) -> None:
clean_msg = msg.replace("\n", " ")
logging.error(f"{inspect.stack()[1][3]} - {clean_msg}")
if message := update.effective_message:
await message.reply_text(f"*ERROR:* {msg}")
def its_me(update: Update) -> bool:
return str(update.effective_chat.id) == chat_id if update.effective_chat else False
# Utils
def clean_filename(filename: str) -> str:
# replace spaces
for r in " ":
cleaned_filename = filename.replace(r, "_")
# keep only valid ascii chars
cleaned_filename = (
unicodedata.normalize("NFKD", cleaned_filename)
.encode("ASCII", "ignore")
.decode()
)
# keep only whitelisted chars
whitelist = "-_.() %s%s" % (string.ascii_letters, string.digits)
cleaned_filename = "".join(c for c in cleaned_filename if c in whitelist)
if len(cleaned_filename) > char_limit:
logging.warning(
f"Filename truncated because it was over {char_limit}. Filenames may no longer be unique."
)
return cleaned_filename[:char_limit]
def pubDate_to_datetime(pubDate: str) -> datetime:
return datetime.strptime(pubDate, "%a, %d %b %Y %H:%M:%S %z")
def parse_downloadvolumefactor(value: float) -> str:
if value == 0:
return "๐ฅ FREELEECH ๐ฅ\n"
elif value == 0.5:
return "๐ 50% DOWNLOAD ๐\n"
return ""
def parse_uploadvolumefactor(value: float) -> str:
if value > 1:
return f"๐ {str(int(value*100))}% UPLOAD ๐"
return ""
def parse_category(category: str) -> int:
try:
value = int(category) // 1000
except ValueError:
value = -1
logging.exception(f"Category: {category} is not an Integer")
return value
def parse_categoryIcon(category: int) -> str:
if category == 1:
return "๐ฎ"
elif category == 2:
return "๐ฌ"
elif category == 3:
return "๐ต"
elif category == 4:
return "๐พ"
elif category == 5:
return "๐บ"
elif category == 6:
return "๐ถ"
elif category == 7:
return "๐"
elif category == 8:
return "โ"
return ""
# Main
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument(
"--token", dest="token", type=str, help="Your Telegram Bot Token", required=True
)
parser.add_argument(
"--chat_id",
dest="chat_id",
type=str,
help="Your Telegram Chat ID",
required=True,
)
parser.add_argument(
"--delay",
dest="delay",
type=int,
help="Seconds between each RSS fetching",
default=600,
)
parser.add_argument(
"--log_level",
dest="log_level",
help="Set the level of console logs",
choices=["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"],
default=logging.getLevelName(logging.INFO),
)
args = parser.parse_args()
global chat_id
global delay
global log_level
chat_id = args.chat_id
delay = args.delay
log_level = args.log_level
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=log_level
)
defaults = Defaults(
link_preview_options=LinkPreviewOptions(is_disabled=True),
do_quote=True,
parse_mode="MARKDOWNV2",
)
application = (
Application.builder()
.token(args.token)
.defaults(defaults)
.post_init(post_init)
.build()
)
application.add_handler(CommandHandler("add", cmd_rss_add))
application.add_handler(CommandHandler("help", cmd_help))
application.add_handler(CommandHandler("test", cmd_test))
application.add_handler(CommandHandler("list", cmd_rss_list))
application.add_handler(CommandHandler("remove", cmd_rss_remove))
application.add_handler(CallbackQueryHandler(cbq_to_blackhole))
# Try to create a database if missing
try:
init_sqlite()
except sqlite3.OperationalError:
logging.exception("Fail trying to create the Database.")
pass
rss_load()
if job_queue := application.job_queue:
job_queue.run_repeating(rss_monitor, delay)
application.run_polling(allowed_updates=Update.ALL_TYPES)
conn.close()
if __name__ == "__main__":
main()