diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 24 | ||||
| -rw-r--r-- | src/views/watch.ecr | 12 |
2 files changed, 35 insertions, 1 deletions
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) { <div class="pure-g"> <div class="pure-u-1 pure-u-md-1-5"> - <div class="h-box"> + <div style="overflow-wrap:break-word; word-wrap:break-word;" class="h-box"> <p><i class="fa fa-eye" aria-hidden="true"></i> <%= number_with_separator(video.views) %></p> <p><i class="fa fa-thumbs-up" aria-hidden="true"></i> <%= number_with_separator(video.likes) %></p> <p><i class="fa fa-thumbs-down" aria-hidden="true"></i> <%= number_with_separator(video.dislikes) %></p> <p id="Wilson">Wilson Score : <%= video.wilson_score.round(4) %></p> <p id="Rating">Rating : <%= rating.round(4) %> / 5</p> <p id="Engagement">Engagement : <%= engagement.round(2) %>%</p> + <% if ad_slots %> + <p>Ad Slots : <%= ad_slots %></p> + <% end %> + <% if engage_types %> + <p>Engage Types : <%= engage_types %></p> + <% end %> + <% if ad_tag %> + <p>Ad Category : <%= ad_category %></p> + <p>Ad Tags(?) : <%= k2 %></p> + <% end %> </div> </div> |
