Add Livestreams to trending page

This commit is contained in:
Fijxu 2025-09-18 16:49:09 -03:00
parent 325e013e0d
commit 5029777f07
No known key found for this signature in database
GPG Key ID: 32C1DDF333EDA6A4
3 changed files with 8 additions and 2 deletions

View File

@ -408,6 +408,7 @@
"Default": "Default",
"Music": "Music",
"Gaming": "Gaming",
"Livestreams": "Livestreams",
"News": "News",
"Movies": "Movies",
"Download": "Download",

View File

@ -4,6 +4,8 @@ def fetch_trending(trending_type, region, locale)
plid = nil
browse_id = "FEtrending"
case trending_type.try &.downcase
when "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 # Default
params = ""
end
client_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)

View File

@ -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>