diff --git a/src/invidious.cr b/src/invidious.cr index 009e59df..96e1eb65 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -273,6 +273,15 @@ get "/search" do |env| end end + author = root.xpath_node(%q(div[@class="yt-lockup-content"]/div/a)) + if author + video["author"] = author.content + video["author_url"] = author["href"] + else + video["author"] = "" + video["author_url"] = "" + end + videos << video end end diff --git a/src/views/index.ecr b/src/views/index.ecr index 3b061fa1..843ceefb 100644 --- a/src/views/index.ecr +++ b/src/views/index.ecr @@ -10,8 +10,9 @@
"/> - <%= video.title %> +

<%= video.title %>

+

"><%= video.info["author"] %>

<% end %> diff --git a/src/views/search.ecr b/src/views/search.ecr index 105e25af..4ed6f408 100644 --- a/src/views/search.ecr +++ b/src/views/search.ecr @@ -11,6 +11,7 @@ "/> <%= video["title"] %> +

"><%= video["author"] %>

<% end %> diff --git a/src/views/watch.ecr b/src/views/watch.ecr index ee2b0345..28f57203 100644 --- a/src/views/watch.ecr +++ b/src/views/watch.ecr @@ -101,7 +101,8 @@ var player = videojs('player', options, function() { <% if rv.has_key?("id") %> "> thumbnail"> - <%= rv["title"] %> +

<%= rv["title"] %>

+

<%= rv["author"] %>

<% end %> <% end %>