|
|
@ -880,7 +880,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_
|
|
|
|
|
|
|
|
|
|
|
|
primary_results = player_response.try &.["contents"]?.try &.["twoColumnWatchNextResults"]?.try &.["results"]?
|
|
|
|
primary_results = player_response.try &.["contents"]?.try &.["twoColumnWatchNextResults"]?.try &.["results"]?
|
|
|
|
.try &.["results"]?.try &.["contents"]?
|
|
|
|
.try &.["results"]?.try &.["contents"]?
|
|
|
|
sentiment_bar = primary_results.try &.as_a.select { |object| object["videoPrimaryInfoRenderer"]? }[0]?
|
|
|
|
sentiment_bar = primary_results.try &.as_a.select(&.["videoPrimaryInfoRenderer"]?)[0]?
|
|
|
|
.try &.["videoPrimaryInfoRenderer"]?
|
|
|
|
.try &.["videoPrimaryInfoRenderer"]?
|
|
|
|
.try &.["sentimentBar"]?
|
|
|
|
.try &.["sentimentBar"]?
|
|
|
|
.try &.["sentimentBarRenderer"]?
|
|
|
|
.try &.["sentimentBarRenderer"]?
|
|
|
@ -891,11 +891,11 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_
|
|
|
|
params["likes"] = JSON::Any.new(likes)
|
|
|
|
params["likes"] = JSON::Any.new(likes)
|
|
|
|
params["dislikes"] = JSON::Any.new(dislikes)
|
|
|
|
params["dislikes"] = JSON::Any.new(dislikes)
|
|
|
|
|
|
|
|
|
|
|
|
params["descriptionHtml"] = JSON::Any.new(primary_results.try &.as_a.select { |object| object["videoSecondaryInfoRenderer"]? }[0]?
|
|
|
|
params["descriptionHtml"] = JSON::Any.new(primary_results.try &.as_a.select(&.["videoSecondaryInfoRenderer"]?)[0]?
|
|
|
|
.try &.["videoSecondaryInfoRenderer"]?.try &.["description"]?.try &.["runs"]?
|
|
|
|
.try &.["videoSecondaryInfoRenderer"]?.try &.["description"]?.try &.["runs"]?
|
|
|
|
.try &.as_a.try { |t| content_to_comment_html(t).gsub("\n", "<br/>") } || "<p></p>")
|
|
|
|
.try &.as_a.try { |t| content_to_comment_html(t).gsub("\n", "<br/>") } || "<p></p>")
|
|
|
|
|
|
|
|
|
|
|
|
metadata = primary_results.try &.as_a.select { |object| object["videoSecondaryInfoRenderer"]? }[0]?
|
|
|
|
metadata = primary_results.try &.as_a.select(&.["videoSecondaryInfoRenderer"]?)[0]?
|
|
|
|
.try &.["videoSecondaryInfoRenderer"]?
|
|
|
|
.try &.["videoSecondaryInfoRenderer"]?
|
|
|
|
.try &.["metadataRowContainer"]?
|
|
|
|
.try &.["metadataRowContainer"]?
|
|
|
|
.try &.["metadataRowContainerRenderer"]?
|
|
|
|
.try &.["metadataRowContainerRenderer"]?
|
|
|
@ -928,7 +928,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
author_info = primary_results.try &.as_a.select { |object| object["videoSecondaryInfoRenderer"]? }[0]?
|
|
|
|
author_info = primary_results.try &.as_a.select(&.["videoSecondaryInfoRenderer"]?)[0]?
|
|
|
|
.try &.["videoSecondaryInfoRenderer"]?.try &.["owner"]?.try &.["videoOwnerRenderer"]?
|
|
|
|
.try &.["videoSecondaryInfoRenderer"]?.try &.["owner"]?.try &.["videoOwnerRenderer"]?
|
|
|
|
|
|
|
|
|
|
|
|
params["authorThumbnail"] = JSON::Any.new(author_info.try &.["thumbnail"]?
|
|
|
|
params["authorThumbnail"] = JSON::Any.new(author_info.try &.["thumbnail"]?
|
|
|
@ -1023,13 +1023,13 @@ end
|
|
|
|
def process_video_params(query, preferences)
|
|
|
|
def process_video_params(query, preferences)
|
|
|
|
annotations = query["iv_load_policy"]?.try &.to_i?
|
|
|
|
annotations = query["iv_load_policy"]?.try &.to_i?
|
|
|
|
autoplay = query["autoplay"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
|
|
|
autoplay = query["autoplay"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
|
|
|
comments = query["comments"]?.try &.split(",").map { |a| a.downcase }
|
|
|
|
comments = query["comments"]?.try &.split(",").map(&.downcase)
|
|
|
|
continue = query["continue"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
|
|
|
continue = query["continue"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
|
|
|
continue_autoplay = query["continue_autoplay"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
|
|
|
continue_autoplay = query["continue_autoplay"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
|
|
|
listen = query["listen"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
|
|
|
listen = query["listen"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
|
|
|
local = query["local"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
|
|
|
local = query["local"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
|
|
|
player_style = query["player_style"]?
|
|
|
|
player_style = query["player_style"]?
|
|
|
|
preferred_captions = query["subtitles"]?.try &.split(",").map { |a| a.downcase }
|
|
|
|
preferred_captions = query["subtitles"]?.try &.split(",").map(&.downcase)
|
|
|
|
quality = query["quality"]?
|
|
|
|
quality = query["quality"]?
|
|
|
|
quality_dash = query["quality_dash"]?
|
|
|
|
quality_dash = query["quality_dash"]?
|
|
|
|
region = query["region"]?
|
|
|
|
region = query["region"]?
|
|
|
|