mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-02 18:58:29 +00:00
update detection of auto_generated channels
This commit is contained in:
parent
df15cf91ff
commit
d61acbed01
@ -139,8 +139,9 @@ def get_about_info(ucid, locale) : AboutChannel
|
|||||||
# For auto-generated channels, channel_about_meta only has
|
# For auto-generated channels, channel_about_meta only has
|
||||||
# ["description"]["simpleText"] and ["primaryLinks"][0]["title"]["simpleText"]
|
# ["description"]["simpleText"] and ["primaryLinks"][0]["title"]["simpleText"]
|
||||||
auto_generated = (
|
auto_generated = (
|
||||||
(channel_about_meta["primaryLinks"]?.try &.size) == 1 && \
|
((channel_about_meta["primaryLinks"]?.try &.size) == 1 && \
|
||||||
extract_text(channel_about_meta.dig?("primaryLinks", 0, "title")) == "Auto-generated by YouTube"
|
extract_text(channel_about_meta.dig?("primaryLinks", 0, "title")) == "Auto-generated by YouTube") ||
|
||||||
|
channel_about_meta.dig?("links", 0, "channelExternalLinkViewModel", "title", "content").try &.as_s == "Auto-generated by YouTube"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -20,21 +20,7 @@ module Invidious::Routes::Channels
|
|||||||
sort_by = env.params.query["sort_by"]?.try &.downcase
|
sort_by = env.params.query["sort_by"]?.try &.downcase
|
||||||
|
|
||||||
if channel.auto_generated
|
if channel.auto_generated
|
||||||
sort_options = {"last", "oldest", "newest"}
|
return env.redirect "/channel/#{ucid}/playlists"
|
||||||
|
|
||||||
items, next_continuation = fetch_channel_playlists(
|
|
||||||
channel.ucid, channel.author, continuation, (sort_by || "last")
|
|
||||||
)
|
|
||||||
|
|
||||||
items.uniq! do |item|
|
|
||||||
if item.responds_to?(:title)
|
|
||||||
item.title
|
|
||||||
elsif item.responds_to?(:author)
|
|
||||||
item.author
|
|
||||||
end
|
|
||||||
end
|
|
||||||
items = items.select(SearchPlaylist)
|
|
||||||
items.each(&.author = "")
|
|
||||||
else
|
else
|
||||||
sort_options = {"newest", "oldest", "popular"}
|
sort_options = {"newest", "oldest", "popular"}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user