From f35babc26a019a4a4c55229f905881d8a089cdef Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 14 Feb 2018 08:32:02 +0100 Subject: [PATCH 1/2] Fix HTML style parser not working properly. Fixes #21 --- pyrogram/client/style/html.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/style/html.py b/pyrogram/client/style/html.py index 41127011..3b333c3b 100644 --- a/pyrogram/client/style/html.py +++ b/pyrogram/client/style/html.py @@ -31,7 +31,7 @@ from . import utils class HTML: - HTML_RE = re.compile(r"<(\w+)(?: href=([\"'])(.*)\2)?>(.*)") + HTML_RE = re.compile(r"<(\w+)(?: href=([\"'])([^<]+)\2)?>([^>]+)") MENTION_RE = re.compile(r"tg://user\?id=(\d+)") def __init__(self, peers_by_id): @@ -44,7 +44,7 @@ class HTML: for match in self.HTML_RE.finditer(text): start = match.start() - offset - style, url, body = match.groups() + style, url, body = match.group(1, 3, 4) if url: mention = self.MENTION_RE.match(url) From 11bf40f50bd90cf2963788e94900ff8d381f7220 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 14 Feb 2018 15:50:24 +0100 Subject: [PATCH 2/2] Add new parameter supports_streaming to send_video method --- pyrogram/client/client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 511a3e45..8272714b 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -1086,6 +1086,7 @@ class Client: duration: int = 0, width: int = 0, height: int = 0, + supports_streaming: bool = None, disable_notification: bool = None, reply_to_message_id: int = None): """Use this method to send video files. @@ -1117,6 +1118,9 @@ class Client: height (:obj:`int`, optional): Video height. + supports_streaming (:obj:`bool`, optional): + Pass True, if the uploaded video is suitable for streaming. + disable_notification (:obj:`bool`, optional): Sends the message silently. Users will receive a notification with no sound. @@ -1143,6 +1147,7 @@ class Client: file=file, attributes=[ types.DocumentAttributeVideo( + supports_streaming=supports_streaming, duration=duration, w=width, h=height