Add author for item
This commit is contained in:
parent
3a95d21808
commit
dff93f67f9
|
@ -273,6 +273,15 @@ get "/search" do |env|
|
||||||
end
|
end
|
||||||
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
|
videos << video
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
<div style="margin:1em;">
|
<div style="margin:1em;">
|
||||||
<a style="width:100%;" class="link" href="/watch?v=<%= video.id %>">
|
<a style="width:100%;" class="link" href="/watch?v=<%= video.id %>">
|
||||||
<img style="width:100%;" src="<%= player_response["videoDetails"]["thumbnail"]["thumbnails"][0]["url"] %>"/>
|
<img style="width:100%;" src="<%= player_response["videoDetails"]["thumbnail"]["thumbnails"][0]["url"] %>"/>
|
||||||
<%= video.title %>
|
<p><%= video.title %></p>
|
||||||
</a>
|
</a>
|
||||||
|
<p><b><a style="width:100%;" class="link" href="https://youtube.com/channel/<%= video.info["ucid"] %>"><%= video.info["author"] %></a></b></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<img style="width:100%;" src="<%= video["thumbnail"] %>"/>
|
<img style="width:100%;" src="<%= video["thumbnail"] %>"/>
|
||||||
<%= video["title"] %>
|
<%= video["title"] %>
|
||||||
</a>
|
</a>
|
||||||
|
<p><b><a style="width:100%;" class="link" href="<%= video["author_url"]%>"><%= video["author"] %></a></b></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -101,7 +101,8 @@ var player = videojs('player', options, function() {
|
||||||
<% if rv.has_key?("id") %>
|
<% if rv.has_key?("id") %>
|
||||||
<a class="link" href="/watch?v=<%= rv["id"] %>">
|
<a class="link" href="/watch?v=<%= rv["id"] %>">
|
||||||
<img style="width:100%;" alt="thumbnail" src="<%= rv["iurlmq"] %>">
|
<img style="width:100%;" alt="thumbnail" src="<%= rv["iurlmq"] %>">
|
||||||
<%= rv["title"] %>
|
<p style="width:100%"><%= rv["title"] %></p>
|
||||||
|
<p><b style="width: 100%"><%= rv["author"] %></b></p>
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue