|
|
@ -965,8 +965,8 @@ post "/login" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if cookie.extension
|
|
|
|
if cookie.extension
|
|
|
|
cookie.extension = cookie.extension.not_nil!.gsub(".youtube.com", host)
|
|
|
|
cookie.extension = cookie.extension.not_nil!.gsub(".youtube.com", host)
|
|
|
|
cookie.extension = cookie.extension.not_nil!.gsub("Secure; ", "")
|
|
|
|
cookie.extension = cookie.extension.not_nil!.gsub("Secure; ", "")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
env.response.cookies << cookie
|
|
|
|
env.response.cookies << cookie
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -2569,8 +2569,8 @@ get "/api/v1/stats" do |env|
|
|
|
|
next statistics.to_json
|
|
|
|
next statistics.to_json
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
statistics.to_json
|
|
|
|
statistics.to_json
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/captions/:id" do |env|
|
|
|
|
get "/api/v1/captions/:id" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
@ -2613,8 +2613,8 @@ get "/api/v1/captions/:id" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
next response
|
|
|
|
next response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
env.response.content_type = "text/vtt"
|
|
|
|
env.response.content_type = "text/vtt"
|
|
|
|
|
|
|
|
|
|
|
@ -2723,7 +2723,7 @@ get "/api/v1/comments/:id" do |env|
|
|
|
|
reddit_thread = JSON.parse(reddit_thread.to_json).as_h
|
|
|
|
reddit_thread = JSON.parse(reddit_thread.to_json).as_h
|
|
|
|
reddit_thread["comments"] = JSON.parse(comments.to_json)
|
|
|
|
reddit_thread["comments"] = JSON.parse(comments.to_json)
|
|
|
|
|
|
|
|
|
|
|
|
next reddit_thread.to_json
|
|
|
|
next reddit_thread.to_json
|
|
|
|
else
|
|
|
|
else
|
|
|
|
response = {
|
|
|
|
response = {
|
|
|
|
"title" => reddit_thread.title,
|
|
|
|
"title" => reddit_thread.title,
|
|
|
@ -2731,10 +2731,10 @@ get "/api/v1/comments/:id" do |env|
|
|
|
|
"contentHtml" => content_html,
|
|
|
|
"contentHtml" => content_html,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
next response.to_json
|
|
|
|
next response.to_json
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/insights/:id" do |env|
|
|
|
|
get "/api/v1/insights/:id" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
@ -2821,8 +2821,8 @@ get "/api/v1/insights/:id" do |env|
|
|
|
|
"graphData" => graph_data,
|
|
|
|
"graphData" => graph_data,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
next response.to_json
|
|
|
|
next response.to_json
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/videos/:id" do |env|
|
|
|
|
get "/api/v1/videos/:id" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
@ -3027,8 +3027,8 @@ get "/api/v1/videos/:id" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
video_info
|
|
|
|
video_info
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/trending" do |env|
|
|
|
|
get "/api/v1/trending" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
@ -3075,8 +3075,8 @@ get "/api/v1/trending" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
videos
|
|
|
|
videos
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/popular" do |env|
|
|
|
|
get "/api/v1/popular" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
@ -3105,8 +3105,8 @@ get "/api/v1/popular" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
videos
|
|
|
|
videos
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/top" do |env|
|
|
|
|
get "/api/v1/top" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
@ -3148,8 +3148,8 @@ get "/api/v1/top" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
videos
|
|
|
|
videos
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/channels/:ucid" do |env|
|
|
|
|
get "/api/v1/channels/:ucid" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
@ -3353,8 +3353,8 @@ get "/api/v1/channels/:ucid" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
channel_info
|
|
|
|
channel_info
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
["/api/v1/channels/:ucid/videos", "/api/v1/channels/videos/:ucid"].each do |route|
|
|
|
|
["/api/v1/channels/:ucid/videos", "/api/v1/channels/videos/:ucid"].each do |route|
|
|
|
|
get route do |env|
|
|
|
|
get route do |env|
|
|
|
@ -3421,9 +3421,9 @@ get "/api/v1/channels/:ucid" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
result
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
["/api/v1/channels/:ucid/latest", "/api/v1/channels/latest/:ucid"].each do |route|
|
|
|
|
["/api/v1/channels/:ucid/latest", "/api/v1/channels/latest/:ucid"].each do |route|
|
|
|
|
get route do |env|
|
|
|
|
get route do |env|
|
|
|
@ -3470,9 +3470,9 @@ get "/api/v1/channels/:ucid" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
response
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
["/api/v1/channels/:ucid/playlists", "/api/v1/channels/playlists/:ucid"].each do |route|
|
|
|
|
["/api/v1/channels/:ucid/playlists", "/api/v1/channels/playlists/:ucid"].each do |route|
|
|
|
|
get route do |env|
|
|
|
|
get route do |env|
|
|
|
@ -3536,9 +3536,9 @@ get "/api/v1/channels/:ucid" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
response
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/channels/search/:ucid" do |env|
|
|
|
|
get "/api/v1/channels/search/:ucid" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
@ -3637,8 +3637,8 @@ get "/api/v1/channels/search/:ucid" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
response
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/search" do |env|
|
|
|
|
get "/api/v1/search" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
@ -3762,8 +3762,8 @@ get "/api/v1/search" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
response
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/playlists/:plid" do |env|
|
|
|
|
get "/api/v1/playlists/:plid" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
@ -3862,8 +3862,8 @@ get "/api/v1/playlists/:plid" do |env|
|
|
|
|
}.to_json
|
|
|
|
}.to_json
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
response
|
|
|
|
response
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
get "/api/v1/mixes/:rdid" do |env|
|
|
|
|
get "/api/v1/mixes/:rdid" do |env|
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
|
|
|