Invidious is an alternative front-end to YouTube
Add Livestreams to trending page (#5480)
Fijxufdf0a25b9e35
diff --git a/locales/en-US.json b/locales/en-US.jsonindex fa28e7f8..6fd1ab0b 100644--- a/locales/en-US.json+++ b/locales/en-US.json@@ -408,6 +408,7 @@"Default": "Default","Music": "Music","Gaming": "Gaming",+ "Livestreams": "Livestreams","News": "News","Movies": "Movies","Download": "Download",diff --git a/src/invidious/trending.cr b/src/invidious/trending.crindex d14cde5d..e289ed5b 100644--- a/src/invidious/trending.cr+++ b/src/invidious/trending.cr@@ -4,6 +4,8 @@ def fetch_trending(trending_type, region, locale)plid = nil+ browse_id = "FEtrending"+case trending_type.try &.downcasewhen "music"params = "4gINGgt5dG1hX2NoYXJ0cw%3D%3D"@@ -11,12 +13,15 @@ def fetch_trending(trending_type, region, locale)params = "4gIcGhpnYW1pbmdfY29ycHVzX21vc3RfcG9wdWxhcg%3D%3D"when "movies"params = "4gIKGgh0cmFpbGVycw%3D%3D"+ when "livestreams"+ browse_id = "UC4R8DWoMoI7CAwX8_LjQHig"+ params = "EgdsaXZldGFikgEDCKEK"else # Defaultparams = ""endclient_config = YoutubeAPI::ClientConfig.new(region: region)- initial_data = YoutubeAPI.browse("FEtrending", params: params, client_config: client_config)+ initial_data = YoutubeAPI.browse(browse_id, params: params, client_config: client_config)items, _ = extract_items(initial_data)diff --git a/src/invidious/views/feeds/trending.ecr b/src/invidious/views/feeds/trending.ecrindex 7dc416c6..69483f30 100644--- a/src/invidious/views/feeds/trending.ecr+++ b/src/invidious/views/feeds/trending.ecr@@ -21,7 +21,7 @@</div><div class="pure-u-1-3"><div class="pure-g" style="text-align:right">- <% {"Default", "Music", "Gaming", "Movies"}.each do |option| %>+ <% {"Default", "Music", "Gaming", "Movies", "Livestreams"}.each do |option| %><div class="pure-u-1 pure-md-1-3"><% if trending_type == option %><b><%= translate(locale, option) %></b>