Merge branch 'master' into fix-shorts

This commit is contained in:
ChunkyProgrammer 2023-04-02 16:42:46 -04:00
commit dc929be198
8 changed files with 42 additions and 4 deletions

View file

@ -515,6 +515,9 @@ hr {
#descexpansionbutton ~ div { #descexpansionbutton ~ div {
overflow: hidden; overflow: hidden;
}
#descexpansionbutton:not(:checked) ~ div {
max-height: 8.3em; max-height: 8.3em;
} }

View file

@ -22,9 +22,11 @@ function setTheme(theme) {
if (theme === THEME_DARK) { if (theme === THEME_DARK) {
toggle_theme.children[0].className = 'icon ion-ios-sunny'; toggle_theme.children[0].className = 'icon ion-ios-sunny';
document.body.className = 'dark-theme'; document.body.className = 'dark-theme';
} else { } else if (theme === THEME_LIGHT) {
toggle_theme.children[0].className = 'icon ion-ios-moon'; toggle_theme.children[0].className = 'icon ion-ios-moon';
document.body.className = 'light-theme'; document.body.className = 'light-theme';
} else {
document.body.className = 'no-theme';
} }
} }

View file

@ -402,6 +402,7 @@
"Movies": "Movies", "Movies": "Movies",
"Download": "Download", "Download": "Download",
"Download as: ": "Download as: ", "Download as: ": "Download as: ",
"Download is disabled": "Download is disabled",
"%A %B %-d, %Y": "%A %B %-d, %Y", "%A %B %-d, %Y": "%A %B %-d, %Y",
"(edited)": "(edited)", "(edited)": "(edited)",
"YouTube comment permalink": "YouTube comment permalink", "YouTube comment permalink": "YouTube comment permalink",

View file

@ -317,6 +317,7 @@
"Movies": "Filmy", "Movies": "Filmy",
"Download": "Pobierz", "Download": "Pobierz",
"Download as: ": "Pobierz jako: ", "Download as: ": "Pobierz jako: ",
"Download is disabled": "Pobieranie jest wyłączone",
"%A %B %-d, %Y": "%A, %-d %B %Y", "%A %B %-d, %Y": "%A, %-d %B %Y",
"(edited)": "(edytowany)", "(edited)": "(edytowany)",
"YouTube comment permalink": "Odnośnik bezpośredni do komentarza na YouTube", "YouTube comment permalink": "Odnośnik bezpośredni do komentarza na YouTube",

View file

@ -30,7 +30,9 @@ def produce_channel_videos_continuation(ucid, page = 1, auto_generated = nil, so
"15:embedded" => { "15:embedded" => {
"1:embedded" => { "1:embedded" => {
"1:string" => object_inner_2_encoded, "1:string" => object_inner_2_encoded,
"2:string" => "00000000-0000-0000-0000-000000000000", },
"2:embedded" => {
"1:string" => "00000000-0000-0000-0000-000000000000",
}, },
"3:varint" => sort_by_numerical, "3:varint" => sort_by_numerical,
}, },

View file

@ -20,7 +20,7 @@ module Invidious::Frontend::WatchPage
def download_widget(locale : String, video : Video, video_assets : VideoAssets) : String def download_widget(locale : String, video : Video, video_assets : VideoAssets) : String
if CONFIG.disabled?("downloads") if CONFIG.disabled?("downloads")
return "<p id=\"download\">#{translate(locale, "Download is disabled.")}</p>" return "<p id=\"download\">#{translate(locale, "Download is disabled")}</p>"
end end
return String.build(4000) do |str| return String.build(4000) do |str|

View file

@ -330,7 +330,10 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
# Used when the video has multiple songs # Used when the video has multiple songs
if song_title = music_desc.dig?("carouselLockupRenderer", "videoLockup", "compactVideoRenderer", "title") if song_title = music_desc.dig?("carouselLockupRenderer", "videoLockup", "compactVideoRenderer", "title")
# "simpleText" for plain text / "runs" when song has a link # "simpleText" for plain text / "runs" when song has a link
song = song_title["simpleText"]? || song_title.dig("runs", 0, "text") song = song_title["simpleText"]? || song_title.dig?("runs", 0, "text")
# some videos can have empty tracks. See: https://www.youtube.com/watch?v=eBGIQ7ZuuiU
next if !song
end end
music_desc.dig?("carouselLockupRenderer", "infoRows").try &.as_a.each do |desc| music_desc.dig?("carouselLockupRenderer", "infoRows").try &.as_a.each do |desc|

View file

@ -18,6 +18,7 @@ private ITEM_PARSERS = {
Parsers::CategoryRendererParser, Parsers::CategoryRendererParser,
Parsers::RichItemRendererParser, Parsers::RichItemRendererParser,
Parsers::ReelItemRendererParser, Parsers::ReelItemRendererParser,
Parsers::ItemSectionRendererParser,
Parsers::ContinuationItemRendererParser, Parsers::ContinuationItemRendererParser,
} }
@ -377,6 +378,30 @@ private module Parsers
end end
end end
# Parses an InnerTube itemSectionRenderer into a SearchVideo.
# Returns nil when the given object isn't a ItemSectionRenderer
#
# A itemSectionRenderer seems to be a simple wrapper for a videoRenderer, used
# by the result page for channel searches. It is located inside a continuationItems
# container.It is very similar to RichItemRendererParser
#
module ItemSectionRendererParser
def self.process(item : JSON::Any, author_fallback : AuthorFallback)
if item_contents = item.dig?("itemSectionRenderer", "contents", 0)
return self.parse(item_contents, author_fallback)
end
end
private def self.parse(item_contents, author_fallback)
child = VideoRendererParser.process(item_contents, author_fallback)
return child
end
def self.parser_name
return {{@type.name}}
end
end
# Parses an InnerTube richItemRenderer into a SearchVideo. # Parses an InnerTube richItemRenderer into a SearchVideo.
# Returns nil when the given object isn't a RichItemRenderer # Returns nil when the given object isn't a RichItemRenderer
# #
@ -772,6 +797,7 @@ end
def extract_items(initial_data : InitialData, &block) def extract_items(initial_data : InitialData, &block)
if unpackaged_data = initial_data["contents"]?.try &.as_h if unpackaged_data = initial_data["contents"]?.try &.as_h
elsif unpackaged_data = initial_data["response"]?.try &.as_h elsif unpackaged_data = initial_data["response"]?.try &.as_h
elsif unpackaged_data = initial_data.dig?("onResponseReceivedActions", 1).try &.as_h
elsif unpackaged_data = initial_data.dig?("onResponseReceivedActions", 0).try &.as_h elsif unpackaged_data = initial_data.dig?("onResponseReceivedActions", 0).try &.as_h
else else
unpackaged_data = initial_data unpackaged_data = initial_data