mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Channels: Fix fetching more community posts (#3761)
This commit is contained in:
commit
ff5e42d836
1 changed files with 5 additions and 9 deletions
|
@ -31,18 +31,16 @@ def fetch_channel_community(ucid, continuation, locale, format, thin_mode)
|
||||||
session_token: session_token,
|
session_token: session_token,
|
||||||
}
|
}
|
||||||
|
|
||||||
response = YT_POOL.client &.post("/comment_service_ajax?action_get_comments=1&ctoken=#{continuation}&continuation=#{continuation}&hl=en&gl=US", headers, form: post_req)
|
body = YoutubeAPI.browse(continuation)
|
||||||
body = JSON.parse(response.body)
|
|
||||||
|
|
||||||
body = body["response"]["continuationContents"]["itemSectionContinuation"]? ||
|
body = body.dig?("continuationContents", "itemSectionContinuation") ||
|
||||||
body["response"]["continuationContents"]["backstageCommentsContinuation"]?
|
body.dig?("continuationContents", "backstageCommentsContinuation")
|
||||||
|
|
||||||
if !body
|
if !body
|
||||||
raise InfoException.new("Could not extract continuation.")
|
raise InfoException.new("Could not extract continuation.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
continuation = body["continuations"]?.try &.[0]["nextContinuationData"]["continuation"].as_s
|
|
||||||
posts = body["contents"].as_a
|
posts = body["contents"].as_a
|
||||||
|
|
||||||
if message = posts[0]["messageRenderer"]?
|
if message = posts[0]["messageRenderer"]?
|
||||||
|
@ -270,10 +268,8 @@ def fetch_channel_community(ucid, continuation, locale, format, thin_mode)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if cont = posts.dig?(-1, "continuationItemRenderer", "continuationEndpoint", "continuationCommand", "token")
|
||||||
if body["continuations"]?
|
json.field "continuation", extract_channel_community_cursor(cont.as_s)
|
||||||
continuation = body["continuations"][0]["nextContinuationData"]["continuation"].as_s
|
|
||||||
json.field "continuation", extract_channel_community_cursor(continuation)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue