mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
General cleanup
This commit is contained in:
parent
d753e52680
commit
6a7d19163e
2 changed files with 13 additions and 13 deletions
|
@ -531,7 +531,7 @@ def login_req(login_form, f_req)
|
|||
"flowEntry" => "ServiceLogin",
|
||||
}
|
||||
|
||||
data = data.merge(login_form)
|
||||
data = login_form.merge(data)
|
||||
|
||||
return HTTP::Params.encode(data)
|
||||
end
|
||||
|
|
|
@ -20,8 +20,8 @@ require "option_parser"
|
|||
require "pg"
|
||||
require "xml"
|
||||
require "yaml"
|
||||
require "./helpers"
|
||||
require "./cookie_fix"
|
||||
require "./helpers"
|
||||
|
||||
CONFIG = Config.from_yaml(File.read("config/config.yml"))
|
||||
|
||||
|
@ -147,10 +147,10 @@ spawn do
|
|||
config.api_key = CONFIG.dl_api_key.not_nil!
|
||||
end
|
||||
filter = true
|
||||
else
|
||||
filter = false
|
||||
end
|
||||
|
||||
filter ||= false
|
||||
|
||||
loop do
|
||||
begin
|
||||
top = rank_videos(PG_DB, 40, filter, YT_URL)
|
||||
|
@ -286,9 +286,8 @@ get "/watch" do |env|
|
|||
|
||||
if video.likes > 0 || video.dislikes > 0
|
||||
calculated_rating = (video.likes.to_f/(video.likes.to_f + video.dislikes.to_f) * 4 + 1)
|
||||
else
|
||||
calculated_rating = 0.0
|
||||
end
|
||||
calculated_rating ||= 0.0
|
||||
|
||||
if video.info["ad_slots"]?
|
||||
ad_slots = video.info["ad_slots"].split(",")
|
||||
|
@ -359,26 +358,23 @@ get "/search" do |env|
|
|||
id = root.xpath_node(%q(div[contains(@class,"yt-lockup-thumbnail")]/a/@href))
|
||||
if id
|
||||
id = id.content.lchop("/watch?v=")
|
||||
else
|
||||
id = ""
|
||||
end
|
||||
id ||= ""
|
||||
video["id"] = id
|
||||
|
||||
title = root.xpath_node(%q(div[@class="yt-lockup-content"]/h3/a))
|
||||
if title
|
||||
video["title"] = title.content
|
||||
else
|
||||
video["title"] = ""
|
||||
end
|
||||
video["title"] ||= ""
|
||||
|
||||
author = root.xpath_node(%q(div[@class="yt-lockup-content"]/div/a))
|
||||
if author
|
||||
video["author"] = author.content
|
||||
video["ucid_url"] = author["href"]
|
||||
else
|
||||
video["author"] = ""
|
||||
video["ucid_url"] = ""
|
||||
end
|
||||
video["author"] ||= ""
|
||||
video["ucid_url"] ||= ""
|
||||
|
||||
videos << video
|
||||
end
|
||||
|
@ -395,6 +391,10 @@ get "/login" do |env|
|
|||
referer = "/feed/subscriptions"
|
||||
end
|
||||
|
||||
if referer.size > 32
|
||||
referer = "/feed/subscriptions"
|
||||
end
|
||||
|
||||
templated "login"
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue