|
|
@ -173,7 +173,6 @@ video_threads.times do |i|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
top_videos = [] of Video
|
|
|
|
top_videos = [] of Video
|
|
|
|
|
|
|
|
|
|
|
|
spawn do
|
|
|
|
spawn do
|
|
|
|
if CONFIG.dl_api_key
|
|
|
|
if CONFIG.dl_api_key
|
|
|
|
DetectLanguage.configure do |config|
|
|
|
|
DetectLanguage.configure do |config|
|
|
|
@ -213,6 +212,20 @@ spawn do
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Refresh decrypt function
|
|
|
|
|
|
|
|
decrypt_function = [] of {name: String, value: Int32}
|
|
|
|
|
|
|
|
spawn do
|
|
|
|
|
|
|
|
loop do
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
client = make_client(YT_URL)
|
|
|
|
|
|
|
|
decrypt_function = update_decrypt_function(client)
|
|
|
|
|
|
|
|
rescue ex
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fiber.yield
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
before_all do |env|
|
|
|
|
before_all do |env|
|
|
|
|
if env.request.cookies.has_key? "SID"
|
|
|
|
if env.request.cookies.has_key? "SID"
|
|
|
|
headers = HTTP::Headers.new
|
|
|
|
headers = HTTP::Headers.new
|
|
|
@ -296,11 +309,11 @@ get "/watch" do |env|
|
|
|
|
|
|
|
|
|
|
|
|
if adaptive_fmts[0]? && adaptive_fmts[0]["s"]?
|
|
|
|
if adaptive_fmts[0]? && adaptive_fmts[0]["s"]?
|
|
|
|
adaptive_fmts.each do |fmt|
|
|
|
|
adaptive_fmts.each do |fmt|
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"])
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"], decrypt_function)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
fmt_stream.each do |fmt|
|
|
|
|
fmt_stream.each do |fmt|
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"])
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"], decrypt_function)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -433,11 +446,11 @@ get "/embed/:id" do |env|
|
|
|
|
|
|
|
|
|
|
|
|
if adaptive_fmts[0]? && adaptive_fmts[0]["s"]?
|
|
|
|
if adaptive_fmts[0]? && adaptive_fmts[0]["s"]?
|
|
|
|
adaptive_fmts.each do |fmt|
|
|
|
|
adaptive_fmts.each do |fmt|
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"])
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"], decrypt_function)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
fmt_stream.each do |fmt|
|
|
|
|
fmt_stream.each do |fmt|
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"])
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"], decrypt_function)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -1044,7 +1057,7 @@ get "/api/manifest/dash/id/:id" do |env|
|
|
|
|
|
|
|
|
|
|
|
|
if adaptive_fmts[0]? && adaptive_fmts[0]["s"]?
|
|
|
|
if adaptive_fmts[0]? && adaptive_fmts[0]["s"]?
|
|
|
|
adaptive_fmts.each do |fmt|
|
|
|
|
adaptive_fmts.each do |fmt|
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"])
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"], decrypt_function)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|