upbit/pixivpy

Sanity level [Should be marked as Question]

Asidert opened this issue · 4 comments

If I look at the account feed from a web browser, then all the illustrations are visible, there is a maximum 14+ limit, obviously not 18+. But in the mobile version and, accordingly, through this package, more than half of the illustrations have a "SANITY_LEVEL" of more than 2 and are not displayed normally.

Does anyone have any ideas how to fix this?

https://user-images.githubusercontent.com/11748991/253568546-8af806f5-80e6-4e1a-812a-a4bce15c8f63.jpg

upbit commented

Is it that an interface like search or ranking did not return? Or return image like the screenshot, and url like this: https://s.pximg.net/common/images/limit_sanity_level_360.png

In the previous Pixiv only had R-18 restrictions on the web version, and would filter R-18 content in the interface when return. If it is confirmed that on the web version is showing, just check if the corresponding illust_id(R-18 target) are returned on the interface.

If is returned, you can paste the illust JSON here for more informations. If the image URL is limit_sanity_level_360.png, we may need to locate if there are new parameters on the mobile API to control the visibility of the returned data.

upbit commented

I tried testing it and it's really weird. Even if I turn off the R-18 browsing restriction on the web, it still returns a placeholder for limit_sanity_level. The typical feature is that the content in 'image_urls' will be a URL like this:

{
  "illust":
  {
    "id": "{illust id}",
    "title": "",
    "type": "illust",
    "image_urls": {
      "square_medium": "https://s.pximg.net/common/images/limit_sanity_level_360.png",
      "medium": "https://s.pximg.net/common/images/limit_sanity_level_360.png",
      "large": "https://s.pximg.net/common/images/limit_sanity_level_360.png"
    },
    "caption": "",
    "restrict": 0,
    "user": {
      "id": "{user id}",
      "name": "",
      "account": "",
      "profile_image_urls": {
        "medium": "https://s.pximg.net/common/images/no_profile.png"
      }
    },
    "tags": [],
    "tools": [],
    "create_date": "{now datetime}",
    "page_count": 1,
    "width": 100,
    "height": 100,
    "sanity_level": 6,
    "x_restrict": 1,
    "meta_single_page": {
      "original_image_url": "https://s.pximg.net/common/images/limit_sanity_level_360.png"
    },
    "meta_pages": [],
    "total_view": 0,
    "total_bookmarks": 0,
    "is_bookmarked": false,
    "visible": false,
    "is_muted": false,
    "illust_ai_type": 0,
    "illust_book_style": 0,
    "comment_access_control": 0
  }
}

Currently, I haven't found any sanity level parameters on the mobile API, so now we can only filter them by URL like mikf/gallery-dl:

  # json_result = aapi.illust_detail(xxx)
  illust = json_result.illust
  if illust.image_urls["large"] == "https://s.pximg.net/common/images/limit_sanity_level_360.png":
    # drop the illust and continue

I think that's https://www.pixiv.net/info.php?id=9786. Unfortunately they seem to be applying it randomly, like the post linked in #280 which has no reason to be flagged. I think you can just check the "visible" field instead of special casing the image URL, but maybe that's not there on all endpoints.

The only workaround I know is to use the web API instead of the mobile API. Unfortunately it's not only very different (it doesn't include image URLs in searches, you have to request info for each post individually), it also has completely separate auth, so you can't switch between them easily.

A dedicated thumbnail will be displayed in place of those works, as well as for the previously mentioned illustrations and manga depicting children in a realistic manner.
The current version of the Android app doesn't even do that on the artist's profile page / illustration list. It just does as if they don't even exist. One profile I checked showed 60 illusts in browser and 47 in the app with no indicator that something is hidden/censored.