summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>2023-08-07 12:46:19 -0700
committerChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>2023-09-18 20:10:41 -0400
commitf55b96a53bde8d8c6a24d4db4e9d10f14ffee585 (patch)
tree271a21c209440586291b03438f45d46a6f039f27 /src
parent734f1b7764598bd5ff24acd11ab833f831d0f4a7 (diff)
downloadinvidious-f55b96a53bde8d8c6a24d4db4e9d10f14ffee585.tar.gz
invidious-f55b96a53bde8d8c6a24d4db4e9d10f14ffee585.tar.bz2
invidious-f55b96a53bde8d8c6a24d4db4e9d10f14ffee585.zip
Always craft Community Post params
Diffstat (limited to 'src')
-rw-r--r--src/invidious/channels/community.cr32
-rw-r--r--src/invidious/routes/channels.cr3
2 files changed, 16 insertions, 19 deletions
diff --git a/src/invidious/channels/community.cr b/src/invidious/channels/community.cr
index 76dab361..49ffd990 100644
--- a/src/invidious/channels/community.cr
+++ b/src/invidious/channels/community.cr
@@ -24,23 +24,21 @@ def fetch_channel_community(ucid, cursor, locale, format, thin_mode)
return extract_channel_community(items, ucid: ucid, locale: locale, format: format, thin_mode: thin_mode)
end
-def fetch_channel_community_post(ucid, post_id, locale, format, thin_mode, params : String | Nil = nil)
- if params.nil?
- object = {
- "2:string" => "community",
- "25:embedded" => {
- "22:string" => post_id.to_s,
- },
- "45:embedded" => {
- "2:varint" => 1_i64,
- "3:varint" => 1_i64,
- },
- }
- params = object.try { |i| Protodec::Any.cast_json(i) }
- .try { |i| Protodec::Any.from_json(i) }
- .try { |i| Base64.urlsafe_encode(i) }
- .try { |i| URI.encode_www_form(i) }
- end
+def fetch_channel_community_post(ucid, post_id, locale, format, thin_mode)
+ object = {
+ "2:string" => "community",
+ "25:embedded" => {
+ "22:string" => post_id.to_s,
+ },
+ "45:embedded" => {
+ "2:varint" => 1_i64,
+ "3:varint" => 1_i64,
+ },
+ }
+ params = object.try { |i| Protodec::Any.cast_json(i) }
+ .try { |i| Protodec::Any.from_json(i) }
+ .try { |i| Base64.urlsafe_encode(i) }
+ .try { |i| URI.encode_www_form(i) }
initial_data = YoutubeAPI.browse(ucid, params: params)
diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr
index 8515b910..20b02dc1 100644
--- a/src/invidious/routes/channels.cr
+++ b/src/invidious/routes/channels.cr
@@ -216,8 +216,7 @@ module Invidious::Routes::Channels
return error_template(400, "Invalid post ID") if response["error"]?
ucid = response.dig("endpoint", "browseEndpoint", "browseId").as_s
- params = response.dig("endpoint", "browseEndpoint", "params").as_s
- post_response = fetch_channel_community_post(ucid, id, locale, "json", thin_mode, params: params)
+ post_response = fetch_channel_community_post(ucid, id, locale, "json", thin_mode)
end
post_response = JSON.parse(post_response)