feat: search pagination

adds support for getting past the first page of search results
This commit is contained in:
2025-10-03 01:16:56 +02:00
parent 7eb4452fec
commit 468795a7a2
3 changed files with 27 additions and 5 deletions

View File

@@ -357,14 +357,19 @@ def browseChannel(ucid: str, params: str = None, ctoken: str = None):
return response_json
def WEBextractSearchResults(search_query: str) -> list:
def WEBextractSearchResults(search_query: str, page: int) -> list:
# Posts a search request to innertube API
# and processes only the relevant part (the actual results)
if search_query is None:
return []
web_context = makeWebContext({"query": search_query})
additional_context = {"query": search_query}
if page is not None:
params = ythdd_proto.produceSearchParams(page)
additional_context["params"] = params
web_context = makeWebContext(additional_context)
response = requests.post('https://www.youtube.com/youtubei/v1/search',
params={"prettyPrint": False},
headers=stage2_headers,