From 5b300ef83cdbd5cc088abe694d46dc33b4d0189e Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 20 May 2018 12:45:37 +0200 Subject: [PATCH] Fix some GIF not having video attributes --- pyrogram/client/ext/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyrogram/client/ext/utils.py b/pyrogram/client/ext/utils.py index dc2b1f28..724b554d 100644 --- a/pyrogram/client/ext/utils.py +++ b/pyrogram/client/ext/utils.py @@ -415,7 +415,7 @@ def parse_messages( date=doc.date ) elif types.DocumentAttributeAnimated in attributes: - video_attributes = attributes[types.DocumentAttributeVideo] + video_attributes = attributes.get(types.DocumentAttributeVideo, None) gif = pyrogram_types.GIF( file_id=encode( @@ -427,9 +427,9 @@ def parse_messages( doc.access_hash ) ), - width=video_attributes.w, - height=video_attributes.h, - duration=video_attributes.duration, + width=getattr(video_attributes, "w", 0), + height=getattr(video_attributes, "h", 0), + duration=getattr(video_attributes, "duration", 0), thumb=parse_thumb(doc.thumb), mime_type=doc.mime_type, file_size=doc.size,