From 3fa5a55f570887a05de14a76e5e31bb56605280f Mon Sep 17 00:00:00 2001
From: James Taylor <user234683@users.noreply.github.com>
Date: Wed, 16 Dec 2020 07:49:20 -0800
Subject: Fix channel search by using new protobuf format
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes 'Unknown Error'

Closes #42

Signed-off-by: Jesús <heckyel@hyperbola.info>
---
 youtube/channel.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/youtube/channel.py b/youtube/channel.py
index 6f40965..97afa6e 100644
--- a/youtube/channel.py
+++ b/youtube/channel.py
@@ -187,7 +187,8 @@ def get_number_of_videos_general(base_url):
 
 
 def get_channel_search_json(channel_id, query, page):
-    params = proto.string(2, 'search') + proto.string(15, str(page))
+    offset = proto.unpadded_b64encode(proto.uint(3, (page-1)*30))
+    params = proto.string(2, 'search') + proto.string(15, offset)
     params = proto.percent_b64encode(params)
     ctoken = proto.string(2, channel_id) + proto.string(3, params) + proto.string(11, query)
     ctoken = base64.urlsafe_b64encode(proto.nested(80226972, ctoken)).decode('ascii')
-- 
cgit v1.2.3