user234683 / youtube-local

browser-based client for watching Youtube anonymously and with greater page performance
GNU Affero General Public License v3.0
486 stars 62 forks source link

Update token offset field #172

Closed David-JonesDVN closed 1 year ago

David-JonesDVN commented 1 year ago

Fix for the continuation token update. Changes the offset field to a uint with field number 1. Additionally, I did some more research into the continuation token for shorts and this is the minimal reproducible token I could come up with (works for shorts only):

Code ``` pointless_nest = proto.string(80226972, proto.string(2, channel_id) + proto.string(3, proto.percent_b64encode( proto.string(110, proto.string(3, proto.string(tab, proto.string(1, proto.string(1, proto.unpadded_b64encode( # proto.uint(1, offset) # does nothing proto.string(3, proto.string(100, proto.uint(2, 1) ) ) + proto.string(4, proto.string(1, b"1:" + ms_unix_time) ) + proto.string(5, proto.string(1, last_video) ) ) ) # targetId, just needs to be present but # doesn't need to be correct + proto.string(2, "63faaff0-0000-23fe-80f0-582429d11c38") ) # 1 - newest, 2 - popular + proto.uint(3, new_sort) ) ) ) ) ) ) ```

As suspected, the offset that changes by 47 on each page doesn't actually do anything, and the last_video field is the one that progresses the returned videos. Also, there is a mysterious ms_unix_time field that should be the time in which the specific pagination request was first made (in my case, using the browser on youtube's actual website). It does not return videos with any other time. In any case, I was unable to do anything meaningful with the token in this way, but I hope it'll be of use to upstream.

user234683 commented 1 year ago

Need to change line 39 from offset = str(30*(int(page) - 1)) to offset = 30*(int(page) - 1) Otherwise it's giving me an exception since uint function is expecting an integer

user234683 commented 1 year ago

For shorts, if that is indeed the case we may have to just extract the continuation token and use a "Next Page" button. One of those is needed as a backup on the channel pages regardless since youtube changes the ctoken format so often