Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问App-API有没有画师推荐的api? #257

Open
Akise opened this issue Jan 25, 2023 · 6 comments
Open

请问App-API有没有画师推荐的api? #257

Akise opened this issue Jan 25, 2023 · 6 comments

Comments

@Akise
Copy link

Akise commented Jan 25, 2023

请问App-API有没有画师推荐的api?

@Akise
Copy link
Author

Akise commented Jan 25, 2023

发现app有画师推荐, 试着抓下app包, app显示读取失败估计是校验证书了
屏幕截图 2023-01-25 192703

@Akise
Copy link
Author

Akise commented Jan 25, 2023

用旧手机抓到了
用户推荐
https://app-api.pixiv.net/v1/user/recommended?filter=for_android&offset=30
关注用户后推荐
https://app-api.pixiv.net/v1/user/related?filter=for_android&seed_user_id=1

@Akise Akise closed this as completed Jan 25, 2023
@upbit
Copy link
Owner

upbit commented Jan 30, 2023

这个应该后面新增的,我找时间补充进去。重开这个issue备忘下
感谢反馈~!

@upbit upbit reopened this Jan 30, 2023
nautics889 added a commit to nautics889/pixivpy that referenced this issue Mar 23, 2023
Implemented method `user_recommended` in `AppPixivAPI` class.
The method supposed to be used to send GET-request to
/user/recommended URL.
@nautics889
Copy link
Contributor

I've implemented one, it looks like it works more or less.

After calling user_recommended():

>>> api = AppPixivAPI()
>>> api.auth(refresh_token=REFRESH_TOKEN)
>>> print(json.dumps(api.user_recommended(), indent=2))

i've seen the next JSON (all data sanitized) in the reponse:
https://pastebin.com/HKNu5ynu

@upbit could you please have a look? Is it something what we expect considering the structure of JSON?

nautics889 added a commit to nautics889/pixivpy that referenced this issue Mar 23, 2023
Implemented method `user_recommended` in `AppPixivAPI` class.
The method supposed to be used to send GET-request to
/user/recommended URL.
nautics889 added a commit to nautics889/pixivpy that referenced this issue Mar 23, 2023
Implemented method `user_recommended` in `AppPixivAPI` class.
The method supposed to be used to send GET-request to
/user/recommended URL.
nautics889 added a commit to nautics889/pixivpy that referenced this issue Mar 23, 2023
Implemented method `user_recommended` in `AppPixivAPI` class.
The method supposed to be used to send GET-request to
/user/recommended URL.
@nautics889
Copy link
Contributor

nautics889 commented Mar 23, 2023

The linter (flake8) keeps failing anyway:

pixivpy3/aapi.py:303:5: C901 'AppPixivAPI.illust_recommended' is too complex (12)

Perhaps illust_recommended() should be slightly refactored.

Should we handle that as a part of the current issue?

nautics889 added a commit to nautics889/pixivpy that referenced this issue Mar 23, 2023
Updated `illust_recommended()` method of `AppPixivAPI` class.
Add using ternary operator when setting up "bookmark_illust_ids"
query-parameter.
@nautics889
Copy link
Contributor

The linter (flake8) keeps failing anyway:

pixivpy3/aapi.py:303:5: C901 'AppPixivAPI.illust_recommended' is too complex (12)

Perhaps illust_recommended() should be slightly refactored.

Should we handle that as a part of the current issue?

Done. All checks have passed.

Using conditional expression (aka "ternary operator") instead of if / elif has worked out.


Meanwhile i wouldn't say this is a conclusive solution for the problem that linter has exposed (not to mention conditional expressions reduce readability).
There are a lot of methods in AppPixivAPI doing the same job for setting up query-parameters to form the URL. That causes each of them have same/similar logic. I understand that this problem appeared as the library has been getting larger and there were more and more query-parameters to being added. Possibly the most comprehensive solution would be to move the common logic to utils.py module, but this is definetely out of scope of this issue.

upbit pushed a commit that referenced this issue Apr 9, 2023
* Add `user_recommended()` in API class (#257)

Implemented method `user_recommended` in `AppPixivAPI` class.
The method supposed to be used to send GET-request to
/user/recommended URL.

* Fix: linter flake8 issue (#257)

Updated `illust_recommended()` method of `AppPixivAPI` class.
Add using ternary operator when setting up "bookmark_illust_ids"
query-parameter.
upbit pushed a commit that referenced this issue Apr 17, 2023
* Add `user_recommended()` in API class (#257)

Implemented method `user_recommended` in `AppPixivAPI` class.
The method supposed to be used to send GET-request to
/user/recommended URL.

* Fix: linter flake8 issue (#257)

Updated `illust_recommended()` method of `AppPixivAPI` class.
Add using ternary operator when setting up "bookmark_illust_ids"
query-parameter.

* fix: Update novel_id in demo.py (fixing CI)

Replace novel id 14357107 with id 12438689 in demo.py module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants