mirror of
https://github.com/iv-org/invidious.git
synced 2026-11-11 06:17:18 +00:00
fix: also check for "video" string in the video count of playlists
Closes https://github.com/iv-org/invidious/issues/6136
This commit is contained in:
@@ -808,7 +808,13 @@ private module Parsers
|
||||
.compact_map(&.dig?("thumbnailOverlayBadgeViewModel", "thumbnailBadges").try &.as_a)
|
||||
.flatten
|
||||
.find(nil, &.dig?("thumbnailBadgeViewModel", "text").try do |node|
|
||||
{"episodes", "videos", "lessons"}.any? { |str| node.as_s.ends_with?(str) }
|
||||
# Playlists that contain MORE THAN ONE video, use "videos" for their video count.
|
||||
# "text" => "8 videos"
|
||||
#
|
||||
# Playlists that contain ONLY ONE video, use "video" for their video count.
|
||||
# "text" => "1 video"
|
||||
#
|
||||
{"episodes", "videos", "video", "lessons"}.any? { |str| node.as_s.ends_with?(str) }
|
||||
end)
|
||||
.try &.dig("thumbnailBadgeViewModel", "text").as_s.to_i(strict: false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user