mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Fix detection of premium content
This commit is contained in:
parent
4f120e19fd
commit
7a33831d14
1 changed files with 7 additions and 2 deletions
|
@ -803,8 +803,11 @@ struct Video
|
||||||
end
|
end
|
||||||
|
|
||||||
def premium
|
def premium
|
||||||
premium = self.player_response.to_s.includes? "Get YouTube without the ads."
|
if info["premium"]?
|
||||||
return premium
|
self.info["premium"] == "true"
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def captions
|
def captions
|
||||||
|
@ -1189,6 +1192,8 @@ def fetch_video(id, region)
|
||||||
author = player_json["videoDetails"]["author"]?.try &.as_s || ""
|
author = player_json["videoDetails"]["author"]?.try &.as_s || ""
|
||||||
ucid = player_json["videoDetails"]["channelId"]?.try &.as_s || ""
|
ucid = player_json["videoDetails"]["channelId"]?.try &.as_s || ""
|
||||||
|
|
||||||
|
info["premium"] = html.xpath_node(%q(.//span[text()="Premium"])) ? "true" : "false"
|
||||||
|
|
||||||
views = html.xpath_node(%q(//meta[@itemprop="interactionCount"]))
|
views = html.xpath_node(%q(//meta[@itemprop="interactionCount"]))
|
||||||
.try &.["content"].to_i64? || 0_i64
|
.try &.["content"].to_i64? || 0_i64
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue