upbit / pixivpy

Pixiv API for Python
https://pypi.org/project/PixivPy3/#files
The Unlicense
1.78k stars 148 forks source link

illust_comments() responds with 404 #349

Open nautics889 opened 6 months ago

nautics889 commented 6 months ago

Context:

Python 3.11.4 PixivPy 3.7.5

Steps to reproduce

  1. Run demo.py: python ./demo.py
  2. Error occurs when calling aapi.illust_comments(59580629).

Description

There in illust_comments() method, self.no_auth_requests_call(...) seems to be returning Response [404].

Local context:

In[4]: url
Out[4]: 'https://app-api.pixiv.net/v1/illust/comments'
In[5]: params
Out[5]: {'illust_id': 59580629}  # this one from demo.py, but there can be any other
In[6]: req_auth
Out[6]: True

...and my headers when calling self.requests_call(...)

In[11]: headers_
Out[11]: {'Authorization': 'Bearer ***',
 'app-os': 'ios',
 'app-os-version': '14.6',
 'user-agent': 'PixivIOSApp/7.13.3 (iOS 14.6; iPhone13,2)'}

I believe it'd be worth checking if /v1/illust/comments is still available, probably.

upbit commented 6 months ago

Thank you for submitting the MR, and point out the issue in the /v1/illust/comments.

I will review it as soon as possible and attempt to fix the problems.

xiyihan0 commented 5 months ago

It seems that this API have moved to:/v3/illust/comments. This API is used in the newest version of Pixiv APP, but it has modified the data format compared to /v1/novel/comments:

res_illust_comments = api.illust_comments(112518890) #modified to /v3/illust/comments
print(res_illust_comments)

The output:

{'comments': [{'id': 175138655,
   'comment': '',
   'date': '2024-04-21T01:13:02+09:00',
   'user': {'id': 104906901,
    'name': '片神',
    'account': 'user_uaud2225',
    'profile_image_urls': {'medium': 'https://s.pximg.net/common/images/no_profile.png'}},
   'has_replies': False,
   'stamp': {'stamp_id': 304,
    'stamp_url': 'https://s.pximg.net/common/images/stamp/generated-stamps/304_s.jpg?20180605'}},
  {'id': 172222064,
   'comment': '舌头怎么会起泡呢?(heaven)',
   'date': '2024-02-29T19:35:02+09:00',
   'user': {'id': 53603145,
    'name': '落痕',
    'account': 'user_ppca3242',
    'profile_image_urls': {'medium': 'https://i.pximg.net/user-profile/img/2022/04/09/15/43/20/22523559_58cee495392fa3642588b8b60608be37_170.png'}},
   'has_replies': False,
   'stamp': None},
  {'id': 168526698,
   'comment': '(excited3)(excited3)',
   'date': '2023-12-27T03:31:15+09:00',
   'user': {'id': 38047701,
    'name': '熵玄',
    'account': 'zmr0911',
    'profile_image_urls': {'medium': 'https://i.pximg.net/user-profile/img/2023/05/04/22/16/01/24377699_a7c5db9504b715c19df387ba66f804cb_170.png'}},
   'has_replies': False,
   'stamp': None},
  ...],
 'next_url': None,
 'comment_access_control': 0}
xiyihan0 commented 5 months ago

And if you want to get the replies of a certain comment, you must call v2/illust/comments/replies?comment_id=...&offset=...