From 36b272e79738666195a31ba8e809bb5cdcb4edc0 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Tue, 3 Dec 2024 09:15:03 +1300 Subject: [PATCH] use thumbnail image for videos #366 --- app/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models.py b/app/models.py index 2e903196..14278d96 100644 --- a/app/models.py +++ b/app/models.py @@ -1259,7 +1259,10 @@ class Post(db.Model): post.image = image elif is_video_url(post.url): # youtube is detected later post.type = constants.POST_TYPE_VIDEO - image = File(source_url=post.url) + if 'image' in request_json['object'] and 'url' in request_json['object']['image']: + image = File(source_url=request_json['object']['image']['url']) + else: + image = File(source_url=post.url) db.session.add(image) post.image = image else: