Better parsing modes for telethon.TelegramClient
Project description
Parsing library
Absolute bloatware. 🚀
from telethon import TelegramClient
from dimentyy.tl.parse import HTML
client: TelegramClient = ...
client.parse_mode = HTML(client) # two ways of applying
parser = HTML.applied_to(client) # preferred
# From now on, every message will be handled by the
# new parser. It resembles default "HTML", but with
# some new features such as mentions and spoilers!
Installation
pip install dimentyy.tl-parse
-
Correct offset & length
Text formatting won't be offset! Using len()
will actually result in the wrong length if the text contains some specific Unicode characters, such as some emojis.
-
Mentions
<!-- Telethon version, a little unreadable, right? -->
<a href="tg://user?id=490288812">dimentyy</a>
<!-- Uses real mention without replacing <a> when sending -->
<mention user_id=490288812>dimentyy</mention>
-
Spoilers
<spoiler>I will never update burger-bot</spoiler>
<!-- Consistent name -->
<custom_emoji document_id=123></custom_emoji>
(needs testing!)
Features to come:
- Unparsing
- Fixing improper entities order (testing)
<!-- Some clients will display that incorrectly, event -->
<b>BOLD. <i>BOTH.</b> ITALIC.</i> <!-- Even GitHub won't highlight </i> -->
<!-- So, this feature will fix that -->
<b>BOLD. <i>BOTH.</i></b><i> ITALIC.</i>
MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for dimentyy_tl_parse-0.0.1.dev4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff229a59cff626f6819a247874180671b6b829e7967d224b973952e78f80e024 |
|
MD5 | 8e06b02f7c80c42cf4da5c4016403883 |
|
BLAKE2b-256 | e093be2179d79f0615e3c3a644689811c1186bb43d7a6288a34e83cfec2f5100 |
Close
Hashes for dimentyy_tl_parse-0.0.1.dev4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b73a0003db5f11cd7e626b1c6371faebc5c513e196cb5ab6a8d7cf13da6ed587 |
|
MD5 | c33f4d1383e84777547bccecd51c7da6 |
|
BLAKE2b-256 | 1828d153df3e556490885fc10342c18201f547323a0e3c86fc82eb5e26819826 |