|
|
|
@ -175,17 +175,18 @@ private module Parsers
|
|
|
|
|
# Always simpleText
|
|
|
|
|
# TODO change default value to nil
|
|
|
|
|
|
|
|
|
|
subscriber_count = item_contents.dig?("subscriberCountText", "simpleText")
|
|
|
|
|
subscriber_count = item_contents.dig?("subscriberCountText", "simpleText").try &.as_s
|
|
|
|
|
channel_handle = subscriber_count if (subscriber_count.try &.starts_with? "@")
|
|
|
|
|
|
|
|
|
|
# Since youtube added channel handles, `VideoCountText` holds the number of
|
|
|
|
|
# subscribers and `subscriberCountText` holds the handle, except when the
|
|
|
|
|
# channel doesn't have a handle (e.g: some topic music channels).
|
|
|
|
|
# See https://github.com/iv-org/invidious/issues/3394#issuecomment-1321261688
|
|
|
|
|
if !subscriber_count || !subscriber_count.as_s.includes? " subscriber"
|
|
|
|
|
subscriber_count = item_contents.dig?("videoCountText", "simpleText")
|
|
|
|
|
if !subscriber_count || !subscriber_count.includes? " subscriber"
|
|
|
|
|
subscriber_count = item_contents.dig?("videoCountText", "simpleText").try &.as_s
|
|
|
|
|
end
|
|
|
|
|
subscriber_count = subscriber_count
|
|
|
|
|
.try { |s| short_text_to_number(s.as_s.split(" ")[0]).to_i32 } || 0
|
|
|
|
|
.try { |s| short_text_to_number(s.split(" ")[0]).to_i32 } || 0
|
|
|
|
|
|
|
|
|
|
# Auto-generated channels doesn't have videoCountText
|
|
|
|
|
# Taken from: https://github.com/iv-org/invidious/pull/2228#discussion_r717620922
|
|
|
|
@ -200,6 +201,7 @@ private module Parsers
|
|
|
|
|
author_thumbnail: author_thumbnail,
|
|
|
|
|
subscriber_count: subscriber_count,
|
|
|
|
|
video_count: video_count,
|
|
|
|
|
channel_handle: channel_handle,
|
|
|
|
|
description_html: description_html,
|
|
|
|
|
auto_generated: auto_generated,
|
|
|
|
|
author_verified: author_verified,
|
|
|
|
|