mirror of
https://github.com/iv-org/invidious.git
synced 2025-06-28 09:38:31 +00:00
Try to detect an "unlisted" badge for videos.
This commit is contained in:
parent
637aef87c8
commit
fe7355126a
@ -68,6 +68,23 @@ rescue ex
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_unlisted_badge?(badges : JSON::Any?)
|
||||||
|
return false if badges.nil?
|
||||||
|
|
||||||
|
badges.as_a.each do |badge|
|
||||||
|
icon_type = badge.dig("metadataBadgeRenderer", "icon", "iconType").as_s
|
||||||
|
|
||||||
|
return true if icon_type == "PRIVACY_UNLISTED"
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
rescue ex
|
||||||
|
LOGGER.debug("Unable to parse owner badges. Got exception: #{ex.message}")
|
||||||
|
LOGGER.trace("Owner badges data: #{badges.to_json}")
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
# This function extracts SearchVideo items from a Category.
|
# This function extracts SearchVideo items from a Category.
|
||||||
# Categories are commonly returned in search results and trending pages.
|
# Categories are commonly returned in search results and trending pages.
|
||||||
def extract_category(category : Category) : Array(SearchVideo)
|
def extract_category(category : Category) : Array(SearchVideo)
|
||||||
|
Loading…
Reference in New Issue
Block a user