check post.preview

This commit is contained in:
teddit 2020-12-05 20:42:38 +01:00
parent a1bf92471b
commit a1e53600e6

View File

@ -102,12 +102,16 @@ module.exports = function() {
} else { } else {
obj.has_media = true obj.has_media = true
if(!gif_to_mp4) { if(!gif_to_mp4) {
obj.media = { if(post.preview) {
source: await downloadAndSave(post.preview.reddit_video_preview.fallback_url), obj.media = {
height: post.preview.reddit_video_preview.height, source: await downloadAndSave(post.preview.reddit_video_preview.fallback_url),
width: post.preview.reddit_video_preview.width, height: post.preview.reddit_video_preview.height,
duration: post.preview.reddit_video_preview.duration, width: post.preview.reddit_video_preview.width,
is_gif: true duration: post.preview.reddit_video_preview.duration,
is_gif: true
}
} else {
obj.has_media = false
} }
} else { } else {
obj.media = { obj.media = {