1
0
mirror of https://github.com/zedeus/nitter.git synced 2025-12-07 20:45:36 -05:00

use largest resolution mp4 video available

This commit is contained in:
girst
2022-05-18 19:47:03 +02:00
parent 0633ec2c39
commit e2b8e17f85
4 changed files with 29 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: AGPL-3.0-only
import strutils, sequtils, strformat, options
import strutils, sequtils, strformat, options, algorithm
import karax/[karaxdsl, vdom, vstyles]
from jester import Request
@@ -105,8 +105,11 @@ proc renderVideo*(video: Video; prefs: Prefs; path: string): VNode =
img(src=thumb)
renderVideoDisabled(video, path)
else:
let vid = video.variants.filterIt(it.contentType == playbackType)
let source = if prefs.proxyVideos: getVidUrl(vid[0].url) else: vid[0].url
let
vars = video.variants.filterIt(it.contentType == playbackType)
vidUrl = vars.sortedByIt(it.resolution)[^1].url
source = if prefs.proxyVideos: getVidUrl(vidUrl)
else: vidUrl
case playbackType
of mp4:
if prefs.muteVideos: