Illust Deleted vs Hidden, How Do You Tell?
SakiSakiSakiSakiSaki opened this issue · 4 comments
Is there anything in the illust_detail
JSON that can tell me if an illustration has been hard deleted, or just private'd by the user?
For example, looking at the JSON of the following active and visible illustration:
{
"illust": {
"id": 29608836,
"title": "NOMORE",
"type": "illust",
"image_urls": {
"square_medium": "https://i.pximg.net/c/360x360_70/img-master/img/2012/08/24/08/48/01/29608836_p0_square1200.jpg",
"medium": "https://i.pximg.net/c/540x540_70/img-master/img/2012/08/24/08/48/01/29608836_p0_master1200.jpg",
"large": "https://i.pximg.net/c/600x1200_90/img-master/img/2012/08/24/08/48/01/29608836_p0_master1200.jpg"
},
"caption": "映画泥棒 □8/24 DR197 IR154 ♀309 8/25 DR166 IR131 二日間も!アリガトウ!ゴザイマス!オジャマシマシタ!",
"restrict": 0,
"user": {
"id": 816236,
"name": "シャンティ",
"account": "nana0712",
"profile_image_urls": {
"medium": "https://i.pximg.net/user-profile/img/2021/11/14/22/08/14/21740275_b969f537c981254b932a54b65bc3a0d5_170.jpg"
},
"is_followed": false
},
"tags": [
{
"name": "映画泥棒",
"translated_name": "movie thief"
},
{
"name": "パトライトさん",
"translated_name": null
},
{
"name": "なにこれかっこいい",
"translated_name": "so cool!"
},
{
"name": "イケパトすぎて禿げた",
"translated_name": null
}
],
"tools": [],
"create_date": "2012-08-24T08:48:01+09:00",
"page_count": 1,
"width": 574,
"height": 800,
"sanity_level": 2,
"x_restrict": 0,
"series": null,
"meta_single_page": {
"original_image_url": "https://i.pximg.net/img-original/img/2012/08/24/08/48/01/29608836_p0.png"
},
"meta_pages": [],
"total_view": 14172,
"total_bookmarks": 1185,
"is_bookmarked": false,
"visible": true,
"is_muted": false,
"total_comments": 2,
"illust_ai_type": 0,
"illust_book_style": 0,
"comment_access_control": 0
}
}
What keys point to where I should be looking? I was thinking restrict
had something to do with it. Some deleted posts have restrict : 1
while others have restrict : 2
. Unsure what the difference is, or whether if this is even relevant to what I'm looking for.
To answer the question I posted some test illustrations on my accounts. On posting page, the visibility has 3 options: public, my pixiv (friend only), and private (hidden for all).
If an illustration is deleted, they will not show up in any list responses (e.g. user_illusts
). If you call illust_detail
directly on it, the response will be
{'error': {'message': '',
'reason': '',
'user_message': 'The creator has limited who can view this content',
'user_message_details': {}}}
If an illustration is hidden, there are two conditions:
- You're the author of that illustration, or you're allowed to view the illustration (e.g. it's friend only).
- The illustration will show up normally in the responses, with
restrict
attribute be 1 (friend only) or 2 (hidden for all).
- The illustration will show up normally in the responses, with
- Otherwise, you're not allowed to view the illustration.
- The illustration will not show up in any list responses (e.g.
user_illusts
), just like deleted illustrations. If you callillust_detail
directly on it, the response will be
{'illust': {'caption': '', 'comment_access_control': 0, 'create_date': '2077-01-01T00:00:00+09:00', 'height': 100, 'id': 123456789, 'illust_ai_type': 0, 'illust_book_style': 0, 'image_urls': {'large': 'https://s.pximg.net/common/images/limit_unknown_360.png', 'medium': 'https://s.pximg.net/common/images/limit_unknown_360.png', 'square_medium': 'https://s.pximg.net/common/images/limit_unknown_360.png'}, 'is_bookmarked': False, 'is_muted': False, 'meta_pages': [], 'meta_single_page': {'original_image_url': 'https://s.pximg.net/common/images/limit_unknown_360.png'}, 'page_count': 1, 'restrict': 2, 'sanity_level': 0, 'series': None, 'tags': [], 'title': '', 'tools': [], 'total_bookmarks': 0, 'total_view': 0, 'type': 'illust', 'user': {'account': '', 'id': 12345678, 'name': '', 'profile_image_urls': {'medium': 'https://s.pximg.net/common/images/no_profile.png'}}, 'visible': False, 'width': 100, 'x_restrict': 0}}
- The illustration will not show up in any list responses (e.g.
Thank you so much for your research!
As an aside, do you know if a user deleting their illustration removes it from your bookmarks? I'm going to guess "no", because I see this in my bookmarks occasionally on the website:
But I've noticed time to time that my overall bookmarks counter would decrease.
And upon expecting the JSON of all of my bookmarks, I see that all of them return a full JSON, visible or hidden. I don't see any errors like the one you mentioned.
The code that I used to generate a JSON of my bookmarks:
qs = {'user_id': USER_ID}
while qs:
while True:
json_result = api.user_bookmarks_illust(**qs)
if 'error' in json_result:
auto_refresh_token = get_new_tokens(api, auto_refresh_token, config)
else:
break
qs = api.parse_qs(json_result.next_url)
for illust in json_result.illusts:
illusts_list.append(illust)
So to ask again, are deleted illustrations removed from your bookmarks?
You're right, user_bookmarks_illust
's response is different with illust_detail
on these illustrations. So I did furtuer experiment:
- When an bookmakred (liked) illustration is hidden,
user_bookmarks_illust
's respnse will be like:{'illusts': [{'caption': '', 'create_date': '2023-04-01T10:20:27+09:00', 'height': 100, 'id': 123456789, 'illust_ai_type': 0, 'illust_book_style': 0, 'image_urls': {'large': 'https://s.pximg.net/common/images/limit_mypixiv_360.png', 'medium': 'https://s.pximg.net/common/images/limit_mypixiv_360.png', 'square_medium': 'https://s.pximg.net/common/images/limit_mypixiv_360.png'}, 'is_bookmarked': True, 'is_muted': False, 'meta_pages': [], 'meta_single_page': {'original_image_url': 'https://s.pximg.net/common/images/limit_mypixiv_360.png'}, 'page_count': 1, 'restrict': 1, 'sanity_level': 0, 'series': None, 'tags': [], 'title': '', 'tools': [], 'total_bookmarks': 0, 'total_view': 0, 'type': 'illust', 'user': {'account': '', 'id': 1234567, 'name': '', 'profile_image_urls': {'medium': 'https://s.pximg.net/common/images/no_profile.png'}}, 'visible': False, 'width': 100, 'x_restrict': 0}], 'next_url': None}
- When an bookmakred (liked) illustration is deleted,
user_bookmarks_illust
's respnse will be like:{'illusts': [{'caption': '', 'create_date': '2023-04-01T10:21:03+09:00', 'height': 100, 'id': 123456789, 'illust_ai_type': 0, 'illust_book_style': 0, 'image_urls': {'large': 'https://s.pximg.net/common/images/limit_unknown_360.png', 'medium': 'https://s.pximg.net/common/images/limit_unknown_360.png', 'square_medium': 'https://s.pximg.net/common/images/limit_unknown_360.png'}, 'is_bookmarked': True, 'is_muted': False, 'meta_pages': [], 'meta_single_page': {'original_image_url': 'https://s.pximg.net/common/images/limit_unknown_360.png'}, 'page_count': 1, 'restrict': 0, 'sanity_level': 0, 'series': None, 'tags': [], 'title': '', 'tools': [], 'total_bookmarks': 0, 'total_view': 0, 'type': 'illust', 'user': {'account': '', 'id': 0, 'name': '', 'profile_image_urls': {'medium': 'https://s.pximg.net/common/images/no_profile.png'}}, 'visible': False, 'width': 100, 'x_restrict': 0}], 'next_url': None}
We can see that the main difference is that for deleted illustrations, the user ID and restrict
will become 0.
I actually did notice the things you just mentioned. While restrict : 0
isn't too much of a helpful identifier since visible
illustrations also have 0 for that, the user_id
of 0 is the clear identifier for whether an illustration in your bookmarks is gone forever.
Doing some digging with the following script:
for id in enumerate(bookmarked_ids):
detail = api.illust_detail(id)
if 'error' in detail:
print(f"Error: {id}\n")
I answered my own question, deleted illusts do in fact remain in your bookmarks as data.
I suppose that's handy to know, and helpful for building my database to see the status of illustrations in my possession.
Thank you!