Danbooru

Bookmarklet populates artist commentary field with gibberish under certain circumstances when uploading from Nicoseiga

Posted under General

NNescio said:

When using the bookmarklet to upload from NicoNico Seiga Illustrations (i.e. a url in the format seiga.nicovideo.jp/seiga/im[INSERT IMAGE ID]), if the image only has a title but no description (e.g. https://seiga.nicovideo.jp/seiga/im8954314), the description part of the artist commentary will be populated with gibberish taken from fragments of the latest few (~6) user comments.

Yeah, that would be because Danbooru is grabbing the summary from Nicoseiga's API when the description is missing.

https://github.com/r888888888/danbooru/blob/266c7c0d5b0a12f260799fb9554c61815d7f4761/app/logical/nico_seiga_api_client.rb#L23-L25

I'm not positive, but I believe that the summary will never contain commentary put out by the artist.

http://seiga.nicovideo.jp/api/illust/info?id=8954314

Edit:

Created issue #4059.

Updated

NNescio said:

While you're at it, could you take a look at forum #154511? Seems to be a (somewhat) related issue with how Danbooru interacts with Nicoseiga's API.

The issue with that lies with the fact that there is no API endpoint known of that can access the information for manga pages like that. That means that the HTML page would have to be scraped, which would require a lot of work for something that gets rarely used, so it wouldn't ever get implemented.

BrokenEagle98 said:

The issue with that lies with the fact that there is no API endpoint known of that can access the information for manga pages like that. That means that the HTML page would have to be scraped, which would require a lot of work for something that gets rarely used, so it wouldn't ever get implemented.

Is it feasible to add some sort of exception in the code to avoid the API errors though? Like, say, don't call the Nicoseiga API if the source is a manga page? (i.e. in the format "seiga.nicovideo.jp/watch/mg[MANGA ID]") Basically treat the subdirectory like a non-nicoseiga website that Danbooru doesn't have any special support for.

Likewise if the image is retrievable from a lohas.nicoseiga.jp/priv/[ALPHANUMERIC]/[NUMERIC]/[IMAGE ID] url, could the bookmarklet just forge ahead with the upload preview and ignore the 404 error from the Nicoseiga API call?

I mean, it's definitely isn't good practice, but it would seem that if the image is retrievable but the API throws up an error, that means it's not an illustration page and shouldn't be treated as one. (so all the other fields can be left blank)

Basically I'm fine with needing to manually query Nicoseiga for the source, and to swap out the source url post-upload to point to the HTML manga page. It would basically be like uploading from a non-supported website (like from an artist blog or a third party repository). For Nicoseiga though, currently Danbooru's (partial) support seems to assume everything is an Illustration, so it works at cross purposes when trying to upload something (from Nicoseiga) that is not hosted as an Illustration, causing some problems. (e.g. can't use bookmarlet for previewing uploads, unresolvable API error messages)

Updated

1