|
|
@ -176,24 +176,26 @@ get "/watch" do |env|
|
|
|
|
base = video.html.xpath_node(%q(//script[@name="player_ias/base"]))
|
|
|
|
base = video.html.xpath_node(%q(//script[@name="player_ias/base"]))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if base
|
|
|
|
if !base
|
|
|
|
|
|
|
|
error_message = "Could not find signature for #{video.id}"
|
|
|
|
|
|
|
|
next templated "error"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
base = base["src"]
|
|
|
|
base = base["src"]
|
|
|
|
base = base.split("/")[3].split("-")[1]
|
|
|
|
base = base.split("/")[3].split("-")[1]
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
fmt_stream.each do |fmt|
|
|
|
|
decrypt_signature(fmt_stream[0]["s"], base)
|
|
|
|
if fmt["s"]? && !base
|
|
|
|
rescue ex
|
|
|
|
File.write("info/#{id}.html", video.html)
|
|
|
|
error_message = ex.message
|
|
|
|
raise "Could not find signature for #{video.id}"
|
|
|
|
next templated "error"
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
fmt["url"] = "#{fmt["url"]}&signature=#{decrypt_signature(fmt["s"]?, base)}"
|
|
|
|
fmt_stream.each do |fmt|
|
|
|
|
|
|
|
|
if base
|
|
|
|
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"], base)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
rescue ex
|
|
|
|
|
|
|
|
error_message = ex
|
|
|
|
|
|
|
|
next templated "error"
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# We want lowest quality first
|
|
|
|
# We want lowest quality first
|
|
|
@ -207,7 +209,9 @@ get "/watch" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
adaptive_fmts.each do |fmt|
|
|
|
|
adaptive_fmts.each do |fmt|
|
|
|
|
fmt["url"] = "#{fmt["url"]}&signature=#{decrypt_signature(fmt["s"]?, base)}"
|
|
|
|
if base
|
|
|
|
|
|
|
|
fmt["url"] += "&signature=" + decrypt_signature(fmt["s"], base)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
rvs = [] of Hash(String, String)
|
|
|
|
rvs = [] of Hash(String, String)
|
|
|
|