diff options
| author | Omar Roth <omarroth@protonmail.com> | 2019-08-04 20:56:24 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@protonmail.com> | 2019-08-04 20:57:34 -0500 |
| commit | 7a33831d1471da0d117692539b739f0da146e540 (patch) | |
| tree | 08fb3119fc34cda4e260fbe0166fb9591b890502 /src | |
| parent | 4f120e19fd0e287c2202ceef8a20cf09263df0ed (diff) | |
| download | invidious-7a33831d1471da0d117692539b739f0da146e540.tar.gz invidious-7a33831d1471da0d117692539b739f0da146e540.tar.bz2 invidious-7a33831d1471da0d117692539b739f0da146e540.zip | |
Fix detection of premium content
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious/videos.cr | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 49ff0494..e1dff5aa 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -803,8 +803,11 @@ struct Video end def premium - premium = self.player_response.to_s.includes? "Get YouTube without the ads." - return premium + if info["premium"]? + self.info["premium"] == "true" + else + false + end end def captions @@ -1189,6 +1192,8 @@ def fetch_video(id, region) author = player_json["videoDetails"]["author"]?.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"])) .try &.["content"].to_i64? || 0_i64 |
