diff options
author | James Taylor <user234683@users.noreply.github.com> | 2021-03-05 19:35:16 -0800 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2021-03-15 22:04:09 -0500 |
commit | 1170403953d8e56d6f4737e92cd7e753a498c8bc (patch) | |
tree | afd68b029bc66bc0eda7593fb3714c5efc759ce9 /youtube | |
parent | 1532a48ef440079efb43cb4a4c6ad3043fecd2a3 (diff) | |
download | yt-local-1170403953d8e56d6f4737e92cd7e753a498c8bc.tar.lz yt-local-1170403953d8e56d6f4737e92cd7e753a498c8bc.tar.xz yt-local-1170403953d8e56d6f4737e92cd7e753a498c8bc.zip |
Fix channel search
Update the search from the browse_ajax api to the new one
Fixes #57
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube')
-rw-r--r-- | youtube/channel.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/youtube/channel.py b/youtube/channel.py index a182320..00e1cf9 100644 --- a/youtube/channel.py +++ b/youtube/channel.py @@ -202,7 +202,25 @@ def get_channel_search_json(channel_id, query, page): ctoken = proto.string(2, channel_id) + proto.string(3, params) + proto.string(11, query) ctoken = base64.urlsafe_b64encode(proto.nested(80226972, ctoken)).decode('ascii') - polymer_json = util.fetch_url("https://www.youtube.com/browse_ajax?ctoken=" + ctoken, headers_desktop, debug_name='channel_search') + key = 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8' + url = 'https://www.youtube.com/youtubei/v1/browse?key=' + key + + data = { + 'context': { + 'client': { + 'hl': 'en', + 'gl': 'US', + 'clientName': 'WEB', + 'clientVersion': '2.20180830', + }, + }, + 'continuation': ctoken, + } + + content_type_header = (('Content-Type', 'application/json'),) + polymer_json = util.fetch_url( + url, headers_desktop + content_type_header, + data=json.dumps(data), debug_name='channel_search') return polymer_json |