|
|
@ -423,18 +423,10 @@ private module Parsers
|
|
|
|
"overlay", "reelPlayerOverlayRenderer"
|
|
|
|
"overlay", "reelPlayerOverlayRenderer"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# Sometimes, the "reelPlayerOverlayRenderer" object is missing the
|
|
|
|
if video_details_container = reel_player_overlay.dig?(
|
|
|
|
# important part of the response. We use this exception to tell
|
|
|
|
|
|
|
|
# the calling function to fetch the content again.
|
|
|
|
|
|
|
|
if !reel_player_overlay.as_h.has_key?("reelPlayerHeaderSupportedRenderers")
|
|
|
|
|
|
|
|
raise RetryOnceException.new
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
video_details_container = reel_player_overlay.dig(
|
|
|
|
|
|
|
|
"reelPlayerHeaderSupportedRenderers",
|
|
|
|
"reelPlayerHeaderSupportedRenderers",
|
|
|
|
"reelPlayerHeaderRenderer"
|
|
|
|
"reelPlayerHeaderRenderer"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# Author infos
|
|
|
|
# Author infos
|
|
|
|
|
|
|
|
|
|
|
|
author = video_details_container
|
|
|
|
author = video_details_container
|
|
|
@ -455,10 +447,17 @@ private module Parsers
|
|
|
|
.try { |t| decode_date(t.as_s) } || Time.utc
|
|
|
|
.try { |t| decode_date(t.as_s) } || Time.utc
|
|
|
|
|
|
|
|
|
|
|
|
# View count
|
|
|
|
# View count
|
|
|
|
|
|
|
|
view_count_text = video_details_container.dig?("viewCountText", "simpleText")
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
author = author_fallback.name
|
|
|
|
|
|
|
|
ucid = author_fallback.id
|
|
|
|
|
|
|
|
published = Time.utc
|
|
|
|
|
|
|
|
title = item_contents.dig?("headline", "simpleText").try &.as_s || ""
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
# View count
|
|
|
|
|
|
|
|
|
|
|
|
# View count used to be in the reelWatchEndpoint, but that changed?
|
|
|
|
# View count used to be in the reelWatchEndpoint, but that changed?
|
|
|
|
view_count_text = item_contents.dig?("viewCountText", "simpleText")
|
|
|
|
view_count_text ||= item_contents.dig?("viewCountText", "simpleText")
|
|
|
|
view_count_text ||= video_details_container.dig?("viewCountText", "simpleText")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view_count = view_count_text.try &.as_s.gsub(/\D+/, "").to_i64? || 0_i64
|
|
|
|
view_count = view_count_text.try &.as_s.gsub(/\D+/, "").to_i64? || 0_i64
|
|
|
|
|
|
|
|
|
|
|
|