Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SamantazFox committed Nov 10, 2024
1 parent bf69777 commit a85f579
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/invidious/videos/streams.cr
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,18 @@ module Invidious::Videos
property bitrate_avg : UInt64?

# Itag 22 sometimes doesn't have a contentLength ?!
# Not present on livestreams
property content_length : UInt64?

private macro init_av_common_properties(format)
@bitrate = format["bitrate"].as_i.to_u64
@bitrate_avg = format["averageBitrate"]?.try &.as_i.to_u64
@content_length = format["contentLength"].try &.as_s.to_u64
@content_length = format["contentLength"]?.try &.as_s.to_u64
end
end
end

# Properties that only applies to mulit-lingual adaptative streams.
# Properties that only applies to multi-lingual adaptative streams.
# They apply to audio and text streams (notably text/mp4).
#
# Sample JSON for an audio track:
Expand Down Expand Up @@ -213,7 +214,7 @@ module Invidious::Videos
@codecs = raw_codecs.lchop(" codecs=\"").rchop('"')

# Last modified is not present on livestreams
if last_modified = format["lastModified"].as_s
if last_modified = format["lastModified"]?.try &.as_s
# E.g "1670664306(.)849305"
# Note: (.) is not present in the input data, it's used here to show
# the demarcation between seconds and microseconds.
Expand Down

0 comments on commit a85f579

Please sign in to comment.