diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index ceda058a..432161fa 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -155,6 +155,7 @@ class TwitterExtractor(Extractor): if not self.unavailable: continue + mtype = media.get("type") descr = media.get("ext_alt_text") width = media["original_info"].get("width", 0) height = media["original_info"].get("height", 0) @@ -164,6 +165,7 @@ class TwitterExtractor(Extractor): files.append({ "url": "ytdl:{}/i/web/status/{}".format( self.root, tweet["id_str"]), + "type" : mtype, "width" : width, "height" : height, "extension" : None, @@ -177,6 +179,7 @@ class TwitterExtractor(Extractor): ) files.append({ "url" : variant["url"], + "type" : mtype, "width" : width, "height" : height, "bitrate" : variant.get("bitrate", 0), @@ -193,6 +196,7 @@ class TwitterExtractor(Extractor): base = url.rpartition("=")[0] + "=" files.append(text.nameext_from_url(url, { "url" : base + self._size_image, + "type" : mtype, "width" : width, "height" : height, "_fallback" : self._image_fallback(base), diff --git a/test/results/twitter.py b/test/results/twitter.py index 7c3a4753..d83c4112 100644 --- a/test/results/twitter.py +++ b/test/results/twitter.py @@ -319,6 +319,8 @@ __tests__ = ( "#category": ("", "twitter", "tweet"), "#class" : twitter.TwitterTweetExtractor, "#sha1_url": "3a2a43dc5fb79dd5432c701d8e55e87c4e551f47", + + "type": "photo", }, { @@ -327,6 +329,8 @@ __tests__ = ( "#category": ("", "twitter", "tweet"), "#class" : twitter.TwitterTweetExtractor, "#pattern" : r"https://video.twimg.com/ext_tw_video/.+\.mp4\?tag=5", + + "type": "video", }, { @@ -587,6 +591,7 @@ You’ll be able to receive four Galarian form Pokémon with Hidden Abilities, p "#class" : twitter.TwitterTweetExtractor, "description": "oc", + "type" : "photo", }, {