Closed chitosai closed 3 years ago
I checked cloudscrap's readme and it looks like it requires a 3rd party captcha solver to deal with the issue?
I am so confused.. I did not change anything on my server, what caused the problem? I see there are some replies recommending using a vpn or proxy, but I am getting the response from both my server at singapore and my computer at canada. It doesn't look like a issue caused by ip address?
We never know what approach Cloudflare has done in terms of anti-bots and cause these captchas. Maybe it checked the cookie, or added a IP greylist, or it was simply random. pixivpy
currently simply uses cloudscraper
to handle some basic situations (#140).
As a monkey patch, you can try:
import cloudscraper
api = AppPixivAPI()
# Override the default cloud scraper created by pixivpy
# Refer to cloudscraper's doc for usage:
# https://github.com/venomous/cloudscraper#3rd-party-captcha-solvers
api.requests = cloudscraper.create_scraper(captcha={...})
# Other stuff as you normally did
api.auth(...)
...
In my personal experience on my own computer (in the US), even if the captcha exists in the first run, but it may disappear in the immediate second run. For me it is a random problem.
@Xdynix Thanks for the explain.
I have a script which runs every one hour, it refreshs access_token by auth() menthod. I looked into my log and about three weeks ago auth() method began to occasionally return
"error": {"user_message": "", "message": "Error occurred at the OAuth process. Please check your Access Token to fix this. Error Message: invalid_grant", "reason": "", "user_message_details": {}}}
I did not notice that and about two weeks ago the error message turned into the captcha one I mentioned above. At first it occured occasionally, and till now it is a 100% captcha failure every hour.
So I guess I should clear my current access_token and try login again, unfortunately then I got
pixivpy3.utils.PixivError: [ERROR] auth() failed! check username and password. HTTP 400: {"has_error":true,"errors":{"system":{"message":"Invalid grant_type parameter or parameter missing","code":1508}},"error":"invalid_grant"}
I searched it and find out it seems to be no longer possible to login in by username & password #158
So my question now has turned to.. how can I login in and get access_token now? I read the readme but it does not provide new methods seemly.
api = AppPixivAPI() # api.login("username", "password") # Not required
So sorry for the long confusing info, it takes some time for me to figure out what happened before...
Due to #158 reason, password login no longer exist. Please use api.auth(refresh_token=REFRESH_TOKEN)
instead
To get refresh_token
, see @ZipFile Pixiv OAuth Flow or OAuth with Selenium/ChromeDriver
@upbit Solved! Thank you so much for the help!
I didn't notice the instruction even it is at the first line..😅
I searched 'captch' in the repo but didn't find any documents on the parament. Can you tell me how to fix the issue?