mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-07 13:18:30 +00:00
Formatting
This commit is contained in:
parent
9c78d912dd
commit
e4af5e85cb
@ -776,6 +776,7 @@ def extract_channel_community_cursor(continuation)
|
||||
end
|
||||
|
||||
INITDATA_PREQUERY = "window[\"ytInitialData\"] = {"
|
||||
|
||||
def get_about_info(ucid, locale)
|
||||
about = YT_POOL.client &.get("/channel/#{ucid}/about?gl=US&hl=en")
|
||||
if about.status_code != 200
|
||||
@ -815,13 +816,13 @@ def get_about_info(ucid, locale)
|
||||
|
||||
ucid = about.xpath_node(%q(//meta[@itemprop="channelId"])).not_nil!["content"]
|
||||
|
||||
#Raises a KeyError on failure.
|
||||
# Raises a KeyError on failure.
|
||||
banners = initdata["header"]["c4TabbedHeaderRenderer"]?.try &.["banner"]?.try &.["thumbnails"]?
|
||||
banner = banners.try &.[-1]?.try &.["url"].as_s?
|
||||
|
||||
#if banner.includes? "channels/c4/default_banner"
|
||||
# if banner.includes? "channels/c4/default_banner"
|
||||
# banner = nil
|
||||
#end
|
||||
# end
|
||||
|
||||
description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || ""
|
||||
description_html = HTML.escape(description).gsub("\n", "<br>")
|
||||
@ -895,9 +896,8 @@ def get_about_info(ucid, locale)
|
||||
tabs = tabs_json.reject { |node| node["tabRenderer"]?.nil? }.map { |node| node["tabRenderer"]["title"].as_s.downcase }
|
||||
end
|
||||
|
||||
|
||||
sub_count = initdata["header"]["c4TabbedHeaderRenderer"]?.try &.["subscriberCountText"]?.try &.["simpleText"]?.try &.as_s?
|
||||
.try { |text| short_text_to_number(text.split(" ")[0])} || 0
|
||||
.try { |text| short_text_to_number(text.split(" ")[0]) } || 0
|
||||
|
||||
AboutChannel.new({
|
||||
ucid: ucid,
|
||||
|
Loading…
Reference in New Issue
Block a user