Since switching to Pixiv as my primary 2D image source, I’ve been bookmarking every picture I blog. Last night, I hacked together another PixivPy script to figure out which artists I’ve blogged work from, sorted by number of images and whether or not I follow them. The core of the code looks more or less like this, for anyone who might want to play with PixivPy:
from pixivpy3 import * aapi = AppPixivAPI() aapi.auth(refresh_token = my_auth_token) result = aapi.user_bookmarks_illust(aapi.user_id) for i in result.illusts: if i.user.id == 0: break if i.user.is_followed: # do stuff else: # do other stuff while result.next_url: next_qs = aapi.parse_qs(result.next_url) result = aapi.user_bookmarks_illust(**next_qs) for i in result.illusts: if i.user.id == 0: break if i.user.is_followed: # do stuff else: # do other stuff
i.user.id == 0 check was discovered through old-school printf
debugging; it’s the only place in the API where I’ve needed something
like that so far)
The most-blogged artists list currently looks like this:
|5||立羽 @ 3日目 西れ-29a|
Markdown formatting and simple HTML accepted.
Sometimes you have to double-click to enter text in the form (interaction between Isso and Bootstrap?). Tab is more reliable.