hareku / fanbox-dl

Pixiv Fanbox Downloader
MIT License
151 stars 20 forks source link

json: cannot unmarshal array into Go struct field ListCreatorResponse.body of type fanbox.ListCreatorResponseBody #40

Closed Onedshow closed 3 months ago

Onedshow commented 3 months ago

The version is v0.22.1. Error when GET https://api.fanbox.cc/post.listCreator?creatorId=<creator-id>&limit=50. The log is listed as below:

[fanbox-dl] 2024/08/06 20:55:40 [INFO] Launching Pixiv FANBOX Downloader!
[fanbox-dl] 2024/08/06 20:55:40 [INFO] Use input creator IDs: [<creator-id>]
[fanbox-dl] 2024/08/06 20:55:40 [INFO] Started downloading of "<creator-id>".
[fanbox-dl] 2024/08/06 20:55:40 [DEBUG] performing request%!(EXTRA string=method, string=GET, string=url, string=https://api.fanbox.cc/post.listCreator?creatorId=<creator-id>&limit=50)
2024/08/06 20:55:41 ===== ERROR LOG =====
2024/08/06 20:55:41 fanbox-dl error: failed downloading of "<creator-id>": list posts of "<creator-id>": json decoding error: json: cannot unmarshal array into Go struct field ListCreatorResponse.body of type fanbox.ListCreatorResponseBody
2024/08/06 20:55:41 =====================
2024/08/06 20:55:41 The error log seems a bug, please open an issue on GitHub: https://github.com/hareku/fanbox-dl/issues.

I have tried curl and find the with the following minimal header the GET request could be accepted:

Origin: https://www.fanbox.cc
Cookie: FANBOXSESSID=<sess-id>

Also, I find that the response is gzip compressed by default when accessing using Firefox. I wonder if the gzip encoding crashes the downloader or the header.

BeatButton commented 3 months ago

It seems that instead of post.listCreator returning "body": {"items": [...], "nextUrl": "..."} the API now just returns "body": [...] with up to 50 posts

hareku commented 3 months ago

Fanbox has changed its API specifications. I'm working on it.

hareku commented 3 months ago

New version is here: https://github.com/hareku/fanbox-dl/releases/tag/v0.23.0