forked from github.com/GenderDysphoria.fyi
Ensure that video/gif embeds in tweets are also cached locally
This commit is contained in:
@@ -129,6 +129,22 @@ module.exports = exports = function (tweets) {
|
||||
media.media_url_https = '/' + mediaItem.output;
|
||||
}
|
||||
|
||||
if (media.video_info && media.video_info.variants) {
|
||||
media.video_info.variants = media.video_info.variants.map((variant) => {
|
||||
if (!variant.url) return variant;
|
||||
|
||||
const mediaItem = {
|
||||
input: variant.url,
|
||||
output: `tweets/${tweet.id_str}/${path.basename(variant.url)}`,
|
||||
cache: `twitter-entities/${tweet.id_str}/${path.basename(variant.url)}`,
|
||||
};
|
||||
tweet.media.push(mediaItem);
|
||||
variant.url = '/' + mediaItem.output;
|
||||
|
||||
return variant;
|
||||
});
|
||||
}
|
||||
|
||||
return media;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user