Welcome to Pykemo’s documentation!
Pykemo is a Python library that effectively functions as a binding to the Kemono API.
Examples
Retrieving a creator
You can create a Creator instance like so:
from pykemo import get_creator, ServiceType
creator_id = "2658856"
creator = get_creator(ServiceType.FANBOX, creator_id)
print(creator)
from pykemo import get_creator
creator_id = "2658856"
creator = get_creator("fanbox", creator_id)
print(creator)
And it will print:
Creator(id='2658856', name='fumihiko', service=<ServiceType.FANBOX: 'fanbox'>)
Fetching posts
From there you can check its posts:
# Fetching last 5 posts
last_posts = creator.posts(max_posts=5)
for post in last_posts:
print(post)
from datetime import datetime
# Every post from June 15th to July 23rd
before = datetime(year=2024, month=7, day=23)
since = datetime(year=2024, month=6, day=15)
specific_posts = creator.posts(before=before, since=since)
for post in specific_posts:
print(post)
And it will show:
Post(id='8104634', creator_id='2658856', service='fanbox', title='獅●ぼ●ん(気高いメスライオンが枕●業Vtuber)')
Post(id='8101402', creator_id='2658856', service='fanbox', title='大●ス●ル(おっπ見せてほしいとお願いしたらVtuber線画)')
Post(id='8100642', creator_id='2658856', service='fanbox', title='【閲覧注意】湊●く●(目の前で寝取られるVtuber線画)')
Post(id='8100373', creator_id='2658856', service='fanbox', title='湊●く●(お料理中に襲われてVtuber線画)')
...
Alternatively, you can also use the helper function get_posts(), which has the same parameters,
for a search of all the recent posts of every creator.
from pykemo import get_posts()
any_posts = get_posts(max_posts=15)
Downloading files
Finally, you can downloads the files of any post, if there is any:
chosen_one = specific_posts[0]
for file in chosen_one.attachments:
file.save("./download/", verbose=False)
chosen_one = specific_posts[0]
chosen_one.save("/download/*", verbose=True)
Note
Use verbose=True to see the fancy progress bars.