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

@@ -87,10 +87,15 @@ proc parseVideo(js: JsonNode): Video =
result.description = description.getStr
for v in js{"video_info", "variants"}:
let
contentType = parseEnum[VideoType](v{"content_type"}.getStr("summary"))
url = v{"url"}.getStr
resolution = getMp4Resolution(url) # only available if contentType == mp4
result.variants.add VideoVariant(
contentType: parseEnum[VideoType](v{"content_type"}.getStr("summary")),
contentType: contentType,
bitrate: v{"bitrate"}.getInt,
url: v{"url"}.getStr
url: url,
resolution: resolution
)
proc parsePromoVideo(js: JsonNode): Video =