fix(threads): small fix to quality selection

This commit is contained in:
Snazzah 2024-06-16 19:24:26 -05:00
parent e16dff3c84
commit 64d9f29209
No known key found for this signature in database
GPG key ID: EA479766A94CEB61

View file

@ -55,7 +55,7 @@ export default async function({ user, id, quality, dispatcher }) {
}
// types: 640p = 101, 480p = 102, 480p-low = 103
const selectedQualityType = quality === 'max' ? 101 : parseInt(quality) > 480 ? 102 : 101;
const selectedQualityType = quality === 'max' ? 101 : quality && parseInt(quality) <= 480 ? 102 : 101;
const video = post.video_versions.find((v) => v.type === selectedQualityType) || post.video_versions.sort((a, b) => a.type - b.type)[0];
if (!video) {
return { error: 'ErrorEmptyDownload' };