summaryrefslogtreecommitdiffstats
path: root/src/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/views')
-rw-r--r--src/views/index.ecr2
-rw-r--r--src/views/search.ecr22
-rw-r--r--src/views/watch.ecr49
3 files changed, 41 insertions, 32 deletions
diff --git a/src/views/index.ecr b/src/views/index.ecr
index e69de29b..483a0c51 100644
--- a/src/views/index.ecr
+++ b/src/views/index.ecr
@@ -0,0 +1,2 @@
+<% content_for "header" do %>
+<% end %> \ No newline at end of file
diff --git a/src/views/search.ecr b/src/views/search.ecr
index c48ac3e5..45eb4caf 100644
--- a/src/views/search.ecr
+++ b/src/views/search.ecr
@@ -1,17 +1,9 @@
<% content_for "header" do %>
- <%= query.size > 30 ? query[0,30] + "... - " : query %>
+ <%= query.size > 30 ? query[0,30].chomp("...") + "... - " : query + " - " %>
<% end %>
-<% videos_list.each do |video| %>
-<div class="pure-g">
- <div class="pure-u-1 pure-u-md-1-6">
- <a class="link" href="/watch?v=<%= video.id %>">
- <img style="width: 90%" src="<%= video.info["thumbnail_url"] %>">
- </a>
- </div>
- <div class="pure-u-1 pure-u-md-5-6">
- <a style="width: 100%; height:100%; display: block; position: relative" class="link" href="/watch?v=<%= video.id %>">
- <%= video.info["title"] %>
- </a>
- </div>
-</div>
-<% end %> \ No newline at end of file
+
+<% videos.each do |item| %>
+<p><a class="link" href="<%= item["link"] %>"><%= item["title"] %></a></p>
+<% end %>
+
+<p style="text-align: right"><a href="/search?q=<%= query %>&page=<%= page + 1 %>">Next page</a></p> \ No newline at end of file
diff --git a/src/views/watch.ecr b/src/views/watch.ecr
index 6766ddfa..7a9e2efc 100644
--- a/src/views/watch.ecr
+++ b/src/views/watch.ecr
@@ -1,8 +1,9 @@
<% content_for "header" do %>
<%= video.info["title"] + " - " %>
<% end %>
-<video style="width: 100%" poster="<%= video.info.has_key?("iurlhq720") ? video.info["iurlhq720"] : video.info["iurlmq"] %>" controls>
- <% if listen %>
+
+<video style="width: 100%" poster="<%= player_response["videoDetails"]["thumbnail"]["thumbnails"][-1]["url"] %>" controls>
+ <% if listen == "true" %>
<% adaptive_fmts.each do |fmt| %>
<% url = fmt["url"] %>
<% type = fmt["type"].to_s.split(";")[0] %>
@@ -16,29 +17,43 @@
<% end %>
<% end %>
</video>
- <h1><%= video.info["title"] %> <a class="link" href="/watch?<%= query.to_s %>">
- <i class="fa <%= listen ? "fa-video-camera" : "fa-volume-up" %>" aria-hidden="true"></i>
+ <h1>
+ <%= video.info["title"] %>
+ <% if listen == "true" %>
+ <a class="link" href="/watch?v=<%= id %>">
+ <i class="fa fa-video-camera" aria-hidden="true"></i>
</a>
+ <% else %>
+ <a class="link" href="/watch?v=<%= id %>&listen=true">
+ <i class="fa fa-volume-up" aria-hidden="true"></i>
+ </a>
+ <% end %>
</h1>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-5">
- <p><i class="fa fa-eye" aria-hidden="true"></i> <%= views.to_i %></p>
- <p><i class="fa fa-thumbs-up" aria-hidden="true"></i> <%= likes.to_i %></p>
- <p><i class="fa fa-thumbs-down" aria-hidden="true"></i> <%= dislikes.to_i %></p>
- <p>Wilson Score : <%= ci_lower_bound(likes, likes + dislikes).round(4) %></p>
- <p>Rating : <%= rating.round(4) %> / 5</p>
- <p>Engagement : <%= engagement.round(2) %>%</p>
- <p>Earnings : <%= video.info.has_key?("allowed_ads") ? "~$" + ((views.to_f / 500).round(2)).to_s : "Unmonetized" %></p>
- <p>Allowed ads : <br><%= video.info.has_key?("allowed_ads") ? video.info["allowed_ads"] : "Unmonetized" %></p>
+ <p><i class="fa fa-eye" aria-hidden="true"></i> <%= views %></p>
+ <p><i class="fa fa-thumbs-up" aria-hidden="true"></i> <%= likes %></p>
+ <p><i class="fa fa-thumbs-down" aria-hidden="true"></i> <%= dislikes %></p>
+ <p id="Wilson">Wilson Score : <%= ci_lower_bound(likes, likes + dislikes).round(4) %></p>
+ <p id="Rating">Rating : <%= rating.round(4) %> / 5</p>
+ <p id="Engagement">Engagement : <%= engagement.round(2) %>%</p>
</div>
<div class="pure-u-1 pure-u-md-3-5">
<p><a class="link" href="https://youtube.com/channel/<%= video.info["ucid"] %>"><%= video.info["author"] %></a></p>
- <p><%= description %></p>
+ <p id="Description"><%= description %></p>
+ <% rvs.each do |rv| %>
+ <% rv.each do |value| %>
+ <p style="word-break: break-all"><%= value[0] %> => <%= value[1] %></p>
+ <% end %>
+ <br>
+ <% end %>
</div>
<div class="pure-u-1 pure-u-md-1-5">
- <% related_videos_list.each do |video| %>
- <a class="link" href="/watch?v=<%= video.id %>"><p><%= video.info["title"] %></p></a>
- <% end %>
- </div>
+ <% rvs.each do |rv| %>
+ <% if rv.has_key?("id") %>
+ <p><a class="link" href="/watch?v=<%= rv["id"] %>"><%= rv["title"] %></a></p>
+ <% end %>
+ <% end %>
+ </div>
</div>
</div> \ No newline at end of file