feat: search pagination
adds support for getting past the first page of search results
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user