Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/invidious/yt_backend/extractors.cr
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,22 @@ private module Parsers
end
end

# A livestream no longer necessarily carries a "LIVE" entry in `badges`.
# On the trending feed — which is the livestreams feed since YouTube
# removed the aggregated trending page — `badges` is absent altogether and
# the only marker is the thumbnail's time-status overlay, which reads
# `{"style": "LIVE", "text": "LIVE"}` in place of a duration.
Comment thread
mdbraber marked this conversation as resolved.
Outdated
#
# Without this, every item on that feed is serialised as
# `liveNow: false`, directly contradicting `/api/v1/videos` for the same
# video id. (`length_seconds` needs no equivalent fix: the overlay text is
# "LIVE", which `decode_length_seconds` already reduces to 0 — correct for
# a stream with no fixed duration.)
is_live_overlay = item_contents["thumbnailOverlays"]?.try &.as_a.any? do |overlay|
overlay.dig?("thumbnailOverlayTimeStatusRenderer", "style").try &.as_s == "LIVE"
end
badges |= VideoBadges::LiveNow if is_live_overlay

SearchVideo.new({
title: title,
id: video_id,
Expand Down
Loading