mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-08 09:20:52 +01:00
Add detection for ad tags and category
This commit is contained in:
parent
86bf5a6266
commit
44ebf0ed8e
@ -296,6 +296,30 @@ get "/watch" do |env|
|
|||||||
calculated_rating = 0.0
|
calculated_rating = 0.0
|
||||||
end
|
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)
|
reddit_client = make_client(REDDIT_URL)
|
||||||
headers = HTTP::Headers{"User-Agent" => "web:invidio.us:v0.1.0 (by /u/omarroth)"}
|
headers = HTTP::Headers{"User-Agent" => "web:invidio.us:v0.1.0 (by /u/omarroth)"}
|
||||||
begin
|
begin
|
||||||
|
@ -121,13 +121,23 @@ function toggle_comments(target) {
|
|||||||
|
|
||||||
<div class="pure-g">
|
<div class="pure-g">
|
||||||
<div class="pure-u-1 pure-u-md-1-5">
|
<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-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-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><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="Wilson">Wilson Score : <%= video.wilson_score.round(4) %></p>
|
||||||
<p id="Rating">Rating : <%= rating.round(4) %> / 5</p>
|
<p id="Rating">Rating : <%= rating.round(4) %> / 5</p>
|
||||||
<p id="Engagement">Engagement : <%= engagement.round(2) %>%</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user