1
0
mirror of https://codeberg.org/teddit/teddit synced 2024-12-22 16:39:24 +01:00

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 {
obj.has_media = true
if(!gif_to_mp4) {
obj.media = {
source: await downloadAndSave(post.preview.reddit_video_preview.fallback_url),
height: post.preview.reddit_video_preview.height,
width: post.preview.reddit_video_preview.width,
duration: post.preview.reddit_video_preview.duration,
is_gif: true
if(post.preview) {
obj.media = {
source: await downloadAndSave(post.preview.reddit_video_preview.fallback_url),
height: post.preview.reddit_video_preview.height,
width: post.preview.reddit_video_preview.width,
duration: post.preview.reddit_video_preview.duration,
is_gif: true
}
} else {
obj.has_media = false
}
} else {
obj.media = {