diff --git a/examples/filter-search.py b/examples/filter-search.py new file mode 100644 index 0000000..5e4eaf7 --- /dev/null +++ b/examples/filter-search.py @@ -0,0 +1,23 @@ +from innertube import InnerTube + +PARAMS_TYPE_VIDEO = "EgIQAQ%3D%3D" +PARAMS_TYPE_CHANNEL = "EgIQAg%3D%3D" +PARAMS_TYPE_PLAYLIST = "EgIQAw%3D%3D" +PARAMS_TYPE_FILM = "EgIQBA%3D%3D" + +client = InnerTube("WEB", "2.20230920.00.00") + +data = client.search("arctic monkeys", params=PARAMS_TYPE_PLAYLIST) + +items = data["contents"]["twoColumnSearchResultsRenderer"]["primaryContents"][ + "sectionListRenderer" +]["contents"][0]["itemSectionRenderer"]["contents"] + +for item in items: + playlist = item["playlistRenderer"] + + playlist_id = playlist["playlistId"] + playlist_title = playlist["title"]["simpleText"] + playlist_video_count = playlist["videoCount"] + + print(f"[{playlist_id}] {playlist_title} ({playlist_video_count} videos)") diff --git a/innertube/clients.py b/innertube/clients.py index 011efb9..f8c18eb 100644 --- a/innertube/clients.py +++ b/innertube/clients.py @@ -124,16 +124,11 @@ def search( ) -> dict: return self( Endpoint.SEARCH, - params=utils.filter( - dict( - continuation=continuation, - ctoken=continuation, - ) - ), body=utils.filter( dict( query=query or "", params=params, + continuation=continuation, ) ), ) diff --git a/pyproject.toml b/pyproject.toml index a24a829..61a4e77 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "innertube" -version = "2.1.9" +version = "2.1.11" description = "Python Client for Google's Private InnerTube API. Works with Youtube, YouTube Music and more!" authors = ["Tom Bulled <26026015+tombulled@users.noreply.github.com>"] license = "MIT"