Python Packages from Voken Project
Available on PyPI:
$ python -m pip install voken
Embed and provide a interactive console...
from voken import shell
shell.embed('welcome')
# >>>
- Extract all
TEXT_LINK(s)
- Get
hostname
from aTEXT_LINK
- Get
telegram_username
from aTEXT_LINK
from voken import text_link as tl
text = 'Lorem ipsum dolor sit amet, a.com b.com/a c.io c.io/abc t.me t.me/BotFather telegram.me telegram.me/BotFather something else...'
text_links = tl.find_all_text_links(text)
for text_link in text_links:
print()
print(text_link)
print(tl.get_hostname(text_link))
print(tl.get_telegram_username(text_link))
# a.com
# a.com
# None
# b.com/a
# b.com
# None
# c.io
# c.io
# None
# c.io/abc
# c.io
# None
# t.me
# t.me
# None
# t.me/BotFather
# t.me
# BotFather
# telegram.me
# telegram.me
# None
# telegram.me/BotFather
# telegram.me
# BotFather