upbit / pixivpy

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

One endpoint is missing #52

Open dirtyboi opened 6 years ago

dirtyboi commented 6 years ago

I need some additional endpoints for a project of mine ( ͡° ͜ʖ ͡°)

Getting all bookmarks of user with a specific bookmark-tag (Un)Liking posts

I will try to find out myself what the endpoint names are, but it would be cool if someone helps.

upbit commented 6 years ago

Try call def user_bookmarks_illust(user_id, restrict='public', tag=None, req_auth=True): with tag

dirtyboi commented 6 years ago

Cool! This works like i wanted it! Thanks.

For the other problem: How can i like illustrations through the API?

upbit commented 6 years ago

You mean add a bookmark?

https://github.com/upbit/pixivpy/blob/master/pixivpy3/aapi.py#L256

dirtyboi commented 6 years ago

Sorry for not replying right away. I use this account less often.

What i meant was this:

screenshot from 2018-01-07 14-01-22

This was called differently in the past, but nowadays pixiv calls it "Like". You can like each post once a day. It sort of acts like a vote and pixiv uses the votes each post aquired in the last 24 hours to do a global ranking against all other posts.

The thing is: This "Like" counter does not reset. Yes, you can vote only once per day for a single post and this vote is only counted for that day, but the counter you see in the picture will never decrease.

I just wanted to point this out to remove any misunderstandings from the topic.

And this is what i actually want: An API endpoint to like posts. As far as i remember i was able to do it in the mobile app.

DaRealFreak commented 5 years ago

thought I would dig up this issue since I'm currently working with the pixiv API anyways: there is no API endpoint for liking posts, at least not included in the current android client (5.0.156). These are all API functions:

/v1/application-info/android
/v1/edit/novel/draft
/v1/emoji
/v1/feedback
/v1/illust-series/illust
/v1/illust/bookmark/delete
/v1/illust/bookmark/users
/v1/illust/comment/add
/v1/illust/comment/delete
/v1/illust/comment/replies
/v1/illust/delete
/v1/illust/detail
/v1/illust/new
/v1/illust/ranking
/v1/illust/recommended
/v1/illust/series
/v1/live/list
/v1/mail-authentication/send
/v1/manga/recommended
/v1/mute/edit
/v1/mute/list
/v1/notification/new-from-following
/v1/notification/settings
/v1/notification/settings/edit
/v1/notification/user/register
/v1/novel/bookmark/delete
/v1/novel/bookmark/users
/v1/novel/comment/add
/v1/novel/comment/delete
/v1/novel/comment/replies
/v1/novel/delete
/v1/novel/follow
/v1/novel/marker/add
/v1/novel/marker/delete
/v1/novel/mypixiv
/v1/novel/new
/v1/novel/ranking
/v1/novel/recommended
/v1/novel/text
/v1/ppoint/android/add
/v1/ppoint/android/products
/v1/ppoint/can-purchase
/v1/ppoint/expirations
/v1/ppoint/gains
/v1/ppoint/losses
/v1/ppoint/summary
/v1/premium/android/register
/v1/privacy-policy/agreement
/v1/search/bookmark-ranges/illust&include_translated_tag_results=true&merge_plain_keyword_results=true
/v1/search/bookmark-ranges/novel?include_translated_tag_results=true&merge_plain_keyword_results=true
/v1/search/illust&include_translated_tag_results=true&merge_plain_keyword_results=true
/v1/search/novel?include_translated_tag_results=true&merge_plain_keyword_results=true
/v1/search/popular-preview/illust&include_translated_tag_results=true&merge_plain_keyword_results=true
/v1/search/popular-preview/novel?include_translated_tag_results=true&merge_plain_keyword_results=true
/v1/search/user
/v1/spotlight/articles
/v1/trending-tags/illust
/v1/trending-tags/novel
/v1/ugoira/metadata
/v1/upload/illust
/v1/upload/novel
/v1/upload/novel/covers
/v1/upload/novel/draft
/v1/upload/status
/v1/user/bookmark-tags/illust
/v1/user/bookmark-tags/novel
/v1/user/bookmarks/illust
/v1/user/bookmarks/novel
/v1/user/browsing-history/illusts
/v1/user/browsing-history/novels
/v1/user/detail
/v1/user/follow/add
/v1/user/follow/delete
/v1/user/follow/detail
/v1/user/follower
/v1/user/following
/v1/user/illust-series
/v1/user/illusts
/v1/user/me/audience-targeting
/v1/user/me/state
/v1/user/mypixiv
/v1/user/novel-draft-previews
/v1/user/novel/draft/delete
/v1/user/novel/draft/detail
/v1/user/novels
/v1/user/profile/edit
/v1/user/profile/presets
/v1/user/recommended
/v1/user/related
/v1/user/workspace/edit
/v1/walkthrough/illusts

/v2/illust/bookmark/add
/v2/illust/bookmark/detail
/v2/illust/comments
/v2/illust/follow
/v2/illust/mypixiv
/v2/illust/related
/v2/novel/bookmark/add
/v2/novel/bookmark/detail
/v2/novel/comments
/v2/novel/detail
/v2/novel/markers
/v2/novel/series
/v2/search/autocomplete?merge_plain_keyword_results=true
/v2/user/browsing-history/illust/add
/v2/user/browsing-history/novel/add

Quite a few endpoints are actually missing in this project but it doesn't look like there is any "like" endpoint for the API. Haven't found a like function in the android client either, only the bookmark function (in the web interface it does exists). For liking posts you could use cookies to ignore recaptcha v3 during the login and call this:

requests.post(
    "https://www.pixiv.net/ajax/illusts/like",
    headers={
        "Content-Type": "application/json; charset=utf-8",
        "x-csrf-token": "CSRF Token"
    },
    json={
        "illust_id": "123456"
    },
    cookies={
        "PHPSESSID": "...",
        "login_ever": "yes",
        "login_bc": "1",
        "privacy_policy_agreement": "1",
        ...
    }
)

to summarize it would require an additional login function and it's as written not a real endpoint of the API. Except for vote manipulation I don't see any real reason for it either.