Skip to content

Commit

Permalink
Merge branch 'main' of github.com:tombulled/innertube into feature/de…
Browse files Browse the repository at this point in the history
…serialise
  • Loading branch information
tombulled committed Jan 6, 2024
2 parents dd4c605 + e25abdd commit 2df4eeb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
23 changes: 23 additions & 0 deletions examples/filter-search.py
Original file line number Diff line number Diff line change
@@ -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)")
7 changes: 1 addition & 6 deletions innertube/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
),
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 2df4eeb

Please sign in to comment.