Add fix for videos without 'rvs'

pull/116/head
Omar Roth 6 years ago
parent f3fde38137
commit 16fb5023e0

@ -257,10 +257,8 @@ get "/watch" do |env|
end end
rvs = [] of Hash(String, String) rvs = [] of Hash(String, String)
if video.info.has_key?("rvs") video.info["rvs"]?.try &.split(",").each do |rv|
video.info["rvs"].split(",").each do |rv| rvs << HTTP::Params.parse(rv).to_h
rvs << HTTP::Params.parse(rv).to_h
end
end end
rating = video.info["avg_rating"].to_f64 rating = video.info["avg_rating"].to_f64
@ -2007,7 +2005,7 @@ get "/api/v1/videos/:id" do |env|
json.field "recommendedVideos" do json.field "recommendedVideos" do
json.array do json.array do
video.info["rvs"].split(",").each do |rv| video.info["rvs"]?.try &.split(",").each do |rv|
rv = HTTP::Params.parse(rv) rv = HTTP::Params.parse(rv)
if rv["id"]? if rv["id"]?

@ -24,10 +24,8 @@ def crawl_videos(db)
end end
rvs = [] of Hash(String, String) rvs = [] of Hash(String, String)
if video.info.has_key?("rvs") video.info["rvs"]?.try &.split(",").each do |rv|
video.info["rvs"].split(",").each do |rv| rvs << HTTP::Params.parse(rv).to_h
rvs << HTTP::Params.parse(rv).to_h
end
end end
rvs.each do |rv| rvs.each do |rv|

Loading…
Cancel
Save