From efd53285cf9aaaefce0cbf2ddedbbb47056dad91 Mon Sep 17 00:00:00 2001 From: syeopite Date: Sat, 26 Jun 2021 18:50:02 -0700 Subject: [PATCH] Handle channels with empty home pages --- locales/ar.json | 3 ++- locales/de.json | 3 ++- locales/el.json | 3 ++- locales/en-US.json | 3 ++- locales/eo.json | 3 ++- locales/es.json | 3 ++- locales/fa.json | 3 ++- locales/fi.json | 3 ++- locales/fr.json | 3 ++- locales/he.json | 3 ++- locales/hr.json | 3 ++- locales/id.json | 3 ++- locales/is.json | 3 ++- locales/it.json | 3 ++- locales/ja.json | 3 ++- locales/nb-NO.json | 3 ++- locales/nl.json | 3 ++- locales/pl.json | 3 ++- locales/pt-BR.json | 3 ++- locales/pt-PT.json | 3 ++- locales/ro.json | 3 ++- locales/ru.json | 3 ++- locales/sv-SE.json | 3 ++- locales/tr.json | 3 ++- locales/uk.json | 3 ++- locales/zh-CN.json | 3 ++- locales/zh-TW.json | 3 ++- src/invidious/helpers/extractors.cr | 3 +++ src/invidious/routes/channels.cr | 2 +- src/invidious/views/channel/home.ecr | 6 ++++++ 30 files changed, 64 insertions(+), 28 deletions(-) diff --git a/locales/ar.json b/locales/ar.json index c668c2aa..f13031d3 100644 --- a/locales/ar.json +++ b/locales/ar.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/de.json b/locales/de.json index 2068610d..8a9c624b 100644 --- a/locales/de.json +++ b/locales/de.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/el.json b/locales/el.json index 2be6bea3..3d90cc53 100644 --- a/locales/el.json +++ b/locales/el.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/en-US.json b/locales/en-US.json index b4509249..4e350479 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -449,5 +449,6 @@ "Licenses": "Licences", "Privacy": "Privacy", "short": "Short (< 4 minutes)", - "long": "Long (> 20 minutes)" + "long": "Long (> 20 minutes)", + "This channel doesn't have any content.": "This channel doesn't have any content." } diff --git a/locales/eo.json b/locales/eo.json index a79164dc..9e3f1b65 100644 --- a/locales/eo.json +++ b/locales/eo.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/es.json b/locales/es.json index 5400bf3e..0a6e1d1f 100644 --- a/locales/es.json +++ b/locales/es.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/fa.json b/locales/fa.json index ee6d55a4..142de04f 100644 --- a/locales/fa.json +++ b/locales/fa.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/fi.json b/locales/fi.json index 86c65442..9354acb5 100644 --- a/locales/fi.json +++ b/locales/fi.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/fr.json b/locales/fr.json index 83a3d468..f092ad7d 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/he.json b/locales/he.json index a2748ebf..1b5d47d6 100644 --- a/locales/he.json +++ b/locales/he.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/hr.json b/locales/hr.json index 61bea236..b4a283ef 100644 --- a/locales/hr.json +++ b/locales/hr.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/id.json b/locales/id.json index e1fe0570..1bd2cc72 100644 --- a/locales/id.json +++ b/locales/id.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/is.json b/locales/is.json index efe58bab..06303ab5 100644 --- a/locales/is.json +++ b/locales/is.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/it.json b/locales/it.json index 6cffda00..551fac5b 100644 --- a/locales/it.json +++ b/locales/it.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/ja.json b/locales/ja.json index 27f27deb..1600dfc0 100644 --- a/locales/ja.json +++ b/locales/ja.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/nb-NO.json b/locales/nb-NO.json index 648a2656..185fd68f 100644 --- a/locales/nb-NO.json +++ b/locales/nb-NO.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/nl.json b/locales/nl.json index f607ae04..aa7da1e9 100644 --- a/locales/nl.json +++ b/locales/nl.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/pl.json b/locales/pl.json index 597d981d..208fc4ba 100644 --- a/locales/pl.json +++ b/locales/pl.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/pt-BR.json b/locales/pt-BR.json index 25fb54fa..a15e04c4 100644 --- a/locales/pt-BR.json +++ b/locales/pt-BR.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/pt-PT.json b/locales/pt-PT.json index 7e678908..5681df13 100644 --- a/locales/pt-PT.json +++ b/locales/pt-PT.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/ro.json b/locales/ro.json index 7f3364d2..2a7a6a66 100644 --- a/locales/ro.json +++ b/locales/ro.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/ru.json b/locales/ru.json index 3c2c1192..c16b7bc3 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/sv-SE.json b/locales/sv-SE.json index 2a48f2a0..0a0300b0 100644 --- a/locales/sv-SE.json +++ b/locales/sv-SE.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/tr.json b/locales/tr.json index 1f1b5be3..63a1b9b4 100644 --- a/locales/tr.json +++ b/locales/tr.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/uk.json b/locales/uk.json index 19d51229..9a13def9 100644 --- a/locales/uk.json +++ b/locales/uk.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 0788d6bb..54b97fc1 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/locales/zh-TW.json b/locales/zh-TW.json index 788b8278..53a41a70 100644 --- a/locales/zh-TW.json +++ b/locales/zh-TW.json @@ -449,5 +449,6 @@ "Licenses": "", "Privacy": "", "short": "", - "long": "" + "long": "", + "This channel doesn't have any content.": "" } diff --git a/src/invidious/helpers/extractors.cr b/src/invidious/helpers/extractors.cr index 9f5b1059..b37b123c 100644 --- a/src/invidious/helpers/extractors.cr +++ b/src/invidious/helpers/extractors.cr @@ -311,6 +311,9 @@ private class YoutubeTabsExtractor < ItemsContainerExtractor elsif items_container = renderer_container_contents["channelVideoPlayerRenderer"]? # Parsing for channel trailer is already taken elsewhere next + elsif items_container = renderer_container_contents["messageRenderer"]? + # Likely an error message regarding content being empty + next else items_container = renderer_container_contents end diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 3e897eee..ae641b3a 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -16,7 +16,7 @@ class Invidious::Routes::Channels < Invidious::Routes::BaseRoute items = fetch_channel_home(ucid, channel) has_trailer = false - if items[0].is_a? Video + if !items.empty? && items[0].is_a? Video has_trailer = true end diff --git a/src/invidious/views/channel/home.ecr b/src/invidious/views/channel/home.ecr index de4a8764..70c41a00 100644 --- a/src/invidious/views/channel/home.ecr +++ b/src/invidious/views/channel/home.ecr @@ -57,4 +57,10 @@ <% end %> <% end %> + + <% if items.size == 0 %> +

+ <%= translate(locale, "This channel doesn't have any content.")%> +

+ <% end %> \ No newline at end of file