Closed RaisingK closed 4 years ago
This appears to be a broader issue with uploading from Fanbox in general, as I'm encountering the same issue when using the bookmarklet. When attempting to upload an image from a post (https://pukara.fanbox.cc/posts/242152), the error I get is
IQDB error: Exception: image_error: Unknown image format.
With a direct image link (https://downloads.fanbox.cc/images/post/242152/BgUmbvJzwlVfQRBq22QBGQco.jpeg), I get
HTTP error code: 403 Forbidden
The first error simply seems to be a result of Fanbox changing its URL scheme. Before, post URLs were of the form
https://pixiv.net/fanbox/creator/[CREATOR_ID]/post/[POST_ID]
but now they're of the form
https://[CREATOR_NAME].fanbox.cc/posts/[POST_ID]
There's not a whiff of fanbox.cc
in pixiv.rb or pixiv_api_client.rb, so the parser doesn't even recognize the URLs to begin with.
As far as the API calls are concerned, I think the relevant ones are
https://api.fanbox.cc/post.info?postId=[POST_ID]
https://api.fanbox.cc/creator.get?creatorId=[CREATOR_NAME]
Which yield responses of this nature
post.info
JSONcreator.get
JSONNote that the creator IDs used in the old style of URL are still used internally (the old post URL is https://www.pixiv.net/fanbox/creator/14093123/post/242152 , and that first number corresponds to body.user.userID
in creator.get
). Old post URLs currently redirect to the new style of URLs.
As for the 403, I played around with the request parameters, and it seems like Fanbox will invariably give a 403 if you don't include the FANBOXSESSID
cookie (occasionally it was PHPSESSID
, although the value was of a similar format--not sure why) when attempting to GET an image. However, there seems to be some other stuff going on, and this isn't really my wheelhouse, so I wasn't able to get a full automatic download working after tinkering with it for a little while.
Wish I could have actually written a solution myself, but hopefully that's enough info to get someone started.
I've been trying to write a fix for this, but it doesn't seem like the correct FANBOXSESSID can be extracted via the current pixiv api client, and that's required to see R18 posts like https://brllbrll.fanbox.cc/posts/626093, so that part of the code needs fixing too.
@kuchenmitsahne
Please forgive me asking this question on 6-month-old issue.
Is api.fanbox.cc method still available to get post info? It always returns 'general error' on my chrome browser :( Did I missed a step that I must pass like client login or something like that?
Again, I apologize for my impolite.
The bookmarklet does not work with r-18 works, and it's not possible currently to support them due to how the fanbox login works. That might be why you're having issues.
Other works work fine for me.
Attempting to replace post 3803729 with https://fanbox.pixiv.net/images/post/686294/jlkY26dFjpZCw0LbWJnSpcxZ.jpeg yielded "error: Downloads::File::Error - HTTP error code: 403 Forbidden"
I had to replace the image from File instead.