Skip to content

Commit

Permalink
add preview image for RSS feeds of youtube videos
Browse files Browse the repository at this point in the history
  • Loading branch information
mawise committed Sep 1, 2024
1 parent b9b3322 commit 554cd20
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/views/feeds/read.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ end
<source src="<%= entry.audio %>" type="audio/mpeg">
</audio>
<% end %>
<% if entry.link.start_with? "https://www.youtube.com/watch?v="
video_id = entry.link.split("?v=").last.split("&").first
video_img = "https://img.youtube.com/vi/#{video_id}/0.jpg"
%>
<a href="<%=entry.link%>"><img src="<%=video_img%>" /></a>
<% end %>
<hr>
<% entry_number += 1 %>
<% end %>
Expand Down

0 comments on commit 554cd20

Please sign in to comment.