From 25362f16a0d0bcb8c2116b3e68750708486a43f5 Mon Sep 17 00:00:00 2001 From: syeopite <70992037+syeopite@users.noreply.github.com> Date: Sun, 15 Aug 2021 01:38:30 -0700 Subject: [PATCH] Readd paid attribute for videos (#2330) --- src/invidious/videos.cr | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 6a53b8ca..6a9c328e 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -301,6 +301,7 @@ struct Video json.field "likeCount", self.likes json.field "dislikeCount", self.dislikes + json.field "paid", self.paid json.field "premium", self.premium json.field "isFamilyFriendly", self.is_family_friendly json.field "allowedRegions", self.allowed_regions @@ -688,6 +689,12 @@ struct Video items end + def paid + reason = info["playabilityStatus"]?.try &.["reason"]? + paid = reason == "This video requires payment to watch." ? true : false + paid + end + def premium keywords.includes? "YouTube Red" end