diff --git a/src/invidious.cr b/src/invidious.cr index c0b22d69..c89cfc2e 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -296,6 +296,30 @@ get "/watch" do |env| calculated_rating = 0.0 end + if video.info["ad_slots"]? + ad_slots = video.info["ad_slots"].split(",") + ad_slots.sort_by! { |a| a.to_i } + ad_slots = ad_slots.join(", ") + end + + if video.info["enabled_engage_types"]? + engage_types = video.info["enabled_engage_types"].split(",") + engage_types = engage_types.join(", ") + end + + if video.info["ad_tag"]? + ad_tag = URI.parse(video.info["ad_tag"]) + ad_query = HTTP::Params.parse(ad_tag.query.not_nil!) + + ad_category = URI.unescape(ad_query["iu"]) + ad_category = ad_category.lstrip("/4061/").split(".")[-1] + + ad_query = HTTP::Params.parse(ad_query["scp"]) + + k2 = URI.unescape(ad_query["k2"]).split(",") + k2 = k2.join(", ") + end + reddit_client = make_client(REDDIT_URL) headers = HTTP::Headers{"User-Agent" => "web:invidio.us:v0.1.0 (by /u/omarroth)"} begin diff --git a/src/views/watch.ecr b/src/views/watch.ecr index 82065397..ce9f4b53 100644 --- a/src/views/watch.ecr +++ b/src/views/watch.ecr @@ -121,13 +121,23 @@ function toggle_comments(target) {
-
+

<%= number_with_separator(video.views) %>

<%= number_with_separator(video.likes) %>

<%= number_with_separator(video.dislikes) %>

Wilson Score : <%= video.wilson_score.round(4) %>

Rating : <%= rating.round(4) %> / 5

Engagement : <%= engagement.round(2) %>%

+ <% if ad_slots %> +

Ad Slots : <%= ad_slots %>

+ <% end %> + <% if engage_types %> +

Engage Types : <%= engage_types %>

+ <% end %> + <% if ad_tag %> +

Ad Category : <%= ad_category %>

+

Ad Tags(?) : <%= k2 %>

+ <% end %>