Fix hlsvp extractor

pull/297/head
Omar Roth 6 years ago
parent 8f57388cd3
commit 0f48d221b4

@ -368,8 +368,8 @@ get "/watch" do |env|
host_params = env.request.query_params host_params = env.request.query_params
host_params.delete_all("v") host_params.delete_all("v")
if video.info["hlsvp"]? if video.player_response["streamingData"]?.try &.["hlsManifestUrl"]?
hlsvp = video.info["hlsvp"] hlsvp = video.player_response["streamingData"]["hlsManifestUrl"].as_s
hlsvp = hlsvp.gsub("https://manifest.googlevideo.com", host_url) hlsvp = hlsvp.gsub("https://manifest.googlevideo.com", host_url)
end end
@ -470,8 +470,8 @@ get "/embed/:id" do |env|
host_params = env.request.query_params host_params = env.request.query_params
host_params.delete_all("v") host_params.delete_all("v")
if video.info["hlsvp"]? if video.player_response["streamingData"]?.try &.["hlsManifestUrl"]?
hlsvp = video.info["hlsvp"] hlsvp = video.player_response["streamingData"]["hlsManifestUrl"].as_s
hlsvp = hlsvp.gsub("https://manifest.googlevideo.com", host_url) hlsvp = hlsvp.gsub("https://manifest.googlevideo.com", host_url)
end end
@ -2520,12 +2520,12 @@ get "/api/v1/videos/:id" do |env|
json.field "isListed", video.info["is_listed"] == "1" json.field "isListed", video.info["is_listed"] == "1"
end end
if video.info["hlsvp"]? if video.player_response["streamingData"]?.try &.["hlsManifestUrl"]?
host_url = make_host_url(Kemal.config.ssl || CONFIG.https_only, env.request.headers["Host"]?) host_url = make_host_url(Kemal.config.ssl || CONFIG.https_only, env.request.headers["Host"]?)
host_params = env.request.query_params host_params = env.request.query_params
host_params.delete_all("v") host_params.delete_all("v")
hlsvp = video.info["hlsvp"] hlsvp = video.player_response["streamingData"]["hlsManifestUrl"].as_s
hlsvp = hlsvp.gsub("https://manifest.googlevideo.com", host_url) hlsvp = hlsvp.gsub("https://manifest.googlevideo.com", host_url)
json.field "hlsUrl", hlsvp json.field "hlsUrl", hlsvp

Loading…
Cancel
Save