mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Add support for default channel banners
This commit is contained in:
parent
556d5b0ca5
commit
48ad744ebf
4 changed files with 39 additions and 29 deletions
|
@ -114,7 +114,7 @@ struct AboutChannel
|
|||
auto_generated: Bool,
|
||||
author_url: String,
|
||||
author_thumbnail: String,
|
||||
banner: String,
|
||||
banner: String?,
|
||||
description_html: String,
|
||||
paid: Bool,
|
||||
total_views: Int64,
|
||||
|
@ -654,6 +654,10 @@ def get_about_info(ucid, locale)
|
|||
banner = about.xpath_node(%q(//div[@id="gh-banner"]/style)).not_nil!.content
|
||||
banner = "https:" + banner.match(/background-image: url\((?<url>[^)]+)\)/).not_nil!["url"]
|
||||
|
||||
if banner.includes? "channels/c4/default_banner"
|
||||
banner = nil
|
||||
end
|
||||
|
||||
description_html = about.xpath_node(%q(//div[contains(@class,"about-description")])).try &.to_s || ""
|
||||
|
||||
paid = about.xpath_node(%q(//meta[@itemprop="paid"])).not_nil!["content"] == "True"
|
||||
|
|
|
@ -3,13 +3,15 @@
|
|||
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/channel/<%= channel.ucid %>" />
|
||||
<% end %>
|
||||
|
||||
<div class="h-box">
|
||||
<img style="width:100%" src="/ggpht<%= URI.parse(channel.banner.gsub("=w1060", "=w1280")).full_path %>">
|
||||
</div>
|
||||
<% if channel.banner %>
|
||||
<div class="h-box">
|
||||
<img style="width:100%" src="/ggpht<%= URI.parse(channel.banner.not_nil!.gsub("=w1060", "=w1280")).full_path %>">
|
||||
</div>
|
||||
|
||||
<div class="h-box">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="h-box">
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="pure-g h-box">
|
||||
<div class="pure-u-2-3">
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
<title><%= channel.author %> - Invidious</title>
|
||||
<% end %>
|
||||
|
||||
<div class="h-box">
|
||||
<img style="width:100%" src="/ggpht<%= URI.parse(channel.banner.gsub("=w1060", "=w1280")).full_path %>">
|
||||
</div>
|
||||
<% if channel.banner %>
|
||||
<div class="h-box">
|
||||
<img style="width:100%" src="/ggpht<%= URI.parse(channel.banner.not_nil!.gsub("=w1060", "=w1280")).full_path %>">
|
||||
</div>
|
||||
|
||||
<div class="h-box">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="h-box">
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="pure-g h-box">
|
||||
<div class="pure-u-2-3">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue