diff options
| author | Omar Roth <omarroth@protonmail.com> | 2019-06-30 12:59:38 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@protonmail.com> | 2019-06-30 12:59:38 -0500 |
| commit | 48ad744ebfca0437b1cb6d91c155e31dffe7f2b6 (patch) | |
| tree | 791c5ad06f90d57fb08b0ba4e27b327c03ce5dc8 /src/invidious.cr | |
| parent | 556d5b0ca55f3feedb6c59e07a92251c2646fdbc (diff) | |
| download | invidious-48ad744ebfca0437b1cb6d91c155e31dffe7f2b6.tar.gz invidious-48ad744ebfca0437b1cb6d91c155e31dffe7f2b6.tar.bz2 invidious-48ad744ebfca0437b1cb6d91c155e31dffe7f2b6.zip | |
Add support for default channel banners
Diffstat (limited to 'src/invidious.cr')
| -rw-r--r-- | src/invidious.cr | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index ad985924..5c054c4c 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -3565,23 +3565,25 @@ get "/api/v1/channels/:ucid" do |env| json.field "authorBanners" do json.array do - qualities = { - {width: 2560, height: 424}, - {width: 2120, height: 351}, - {width: 1060, height: 175}, - } - qualities.each do |quality| - json.object do - json.field "url", channel.banner.gsub("=w1060", "=w#{quality[:width]}") - json.field "width", quality[:width] - json.field "height", quality[:height] + if channel.banner + qualities = { + {width: 2560, height: 424}, + {width: 2120, height: 351}, + {width: 1060, height: 175}, + } + qualities.each do |quality| + json.object do + json.field "url", channel.banner.not_nil!.gsub("=w1060", "=w#{quality[:width]}") + json.field "width", quality[:width] + json.field "height", quality[:height] + end end - end - json.object do - json.field "url", channel.banner.rchop("=w1060-fcrop64=1,00005a57ffffa5a8-nd-c0xffffffff-rj-k-no") - json.field "width", 512 - json.field "height", 288 + json.object do + json.field "url", channel.banner.not_nil!.rchop("=w1060-fcrop64=1,00005a57ffffa5a8-nd-c0xffffffff-rj-k-no") + json.field "width", 512 + json.field "height", 288 + end end end end @@ -3592,7 +3594,7 @@ get "/api/v1/channels/:ucid" do |env| qualities.each do |quality| json.object do - json.field "url", channel.author_thumbnail.gsub("/s100-", "/s#{quality}-") + json.field "url", channel.author_thumbnail.gsub("=s100-", "=s#{quality}-") json.field "width", quality json.field "height", quality end |
