From 9ade476e5dad2e5a806bd68f89afa9725bfb6969 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 1 Jan 2022 08:35:17 -0600 Subject: [PATCH] Add Media.url Resolves #1722 --- tweepy/media.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tweepy/media.py b/tweepy/media.py index aec6435..6e49b10 100644 --- a/tweepy/media.py +++ b/tweepy/media.py @@ -10,7 +10,7 @@ class Media(DataMapping): __slots__ = ( "data", "media_key", "type", "duration_ms", "height", "non_public_metrics", "organic_metrics", "preview_image_url", - "promoted_metrics", "public_metrics", "width", "alt_text" + "promoted_metrics", "public_metrics", "width", "alt_text", "url" ) def __init__(self, data): @@ -28,6 +28,9 @@ class Media(DataMapping): self.width = data.get("width") self.alt_text = data.get("alt_text") + # https://twittercommunity.com/t/documentation-for-media-object-missing-url-field/163062 + self.url = data.get("url") + def __eq__(self, other): if isinstance(other, self.__class__): return self.media_key == other.media_key -- 2.25.1