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
(the 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:
| Count | Artist |
|---|---|
| 12 | N.G. |
| 10 | ちた@1月からのお仕事募集中 |
| 9 | もねてぃ◎エロゲ3月発売 |
| 8 | 朱シオ |
| 7 | 方天戟(げっきー) |
| 7 | みづき |
| 6 | ましゅー |
| 6 | Salmon88 |
| 6 | 柊はじめ@C95月曜日カ46a |
| 6 | 森沢晴行 |
| 6 | mamuru日曜日東D46b |
| 5 | 風牙 |
| 5 | しろきつね:こみトレ_ア25a |
| 5 | はまけん。@2日目西れ43b |
| 5 | 立羽 @ 3日目 西れ-29a |
| 5 | 米白粕 |
| 5 | たけあしろ |
| 5 | whoisshe |
| 5 | 宮前りん |
| 5 | ヤッペン@5月以降仕事募集中 |
| 5 | GIn00 |
| 5 | 弾 |
| 5 | TanDo |
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.