more simple url processing

This commit is contained in:
Ghytro
2024-11-07 17:03:58 +03:00
parent 9d90726813
commit 1014e4a0d9

View File

@ -33,8 +33,8 @@ class TrackerRemovalMsgProcessor:
# но ссылка может быть и без указания схемы, телега может распарсить # но ссылка может быть и без указания схемы, телега может распарсить
# просто строку через точки и в конце какой то домен верхнего уровня как ссылку # просто строку через точки и в конце какой то домен верхнего уровня как ссылку
def is_url(url: str) -> bool: def is_url(url: str) -> bool:
SCHEME = "http://" SCHEMES = ["http://", "https://"]
return url.startswith(SCHEME) return len([s for s in SCHEMES if url.startswith(s)]) != 0
lexems = self.__msg.text.split() lexems = self.__msg.text.split()
for i, l in enumerate(lexems): for i, l in enumerate(lexems):