diff options
| author | Omar Roth <omarroth@hotmail.com> | 2019-01-02 20:09:00 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2019-01-02 20:09:00 -0600 |
| commit | 0832fa9bdb81d81f55ab981d39ca5f5e6ae01db2 (patch) | |
| tree | 11df3418ea987f99597de5c3e805102ac7b60345 | |
| parent | c2c224b16f9ee11e5bebeed8901aedbc0e15bfae (diff) | |
| download | invidious-0832fa9bdb81d81f55ab981d39ca5f5e6ae01db2.tar.gz invidious-0832fa9bdb81d81f55ab981d39ca5f5e6ae01db2.tar.bz2 invidious-0832fa9bdb81d81f55ab981d39ca5f5e6ae01db2.zip | |
Filter paid videos from RSS and channel list
| -rw-r--r-- | src/invidious.cr | 2 | ||||
| -rw-r--r-- | src/invidious/helpers/helpers.cr | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 4be9ee7e..1d85a0bf 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1909,6 +1909,7 @@ get "/feed/channel/:ucid" do |env| page = 1 videos, count = get_60_videos(ucid, page, auto_generated) + videos.select! { |video| !video.paid } host_url = make_host_url(Kemal.config.ssl || CONFIG.https_only, env.request.headers["Host"]?) path = env.request.path @@ -2173,6 +2174,7 @@ get "/channel/:ucid" do |env| end videos, count = get_60_videos(ucid, page, auto_generated, sort_by) + videos.select! { |video| !video.paid } templated "channel" end diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index 94250a21..4af924c0 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -317,10 +317,10 @@ def extract_items(nodeset, ucid = nil) premium = false end - if node.xpath_node(%q(.//span[contains(text(), "Get YouTube Premium")])) - paid = true - else + if !premium || node.xpath_node(%q(.//span[contains(text(), "Free episode")])) paid = false + else + paid = true end items << SearchVideo.new( |
