the visual novel database

A New API

Posted in

#51 by Jair4x
2023-02-06 at 22:04
< report >Oh, now I get it. Got it to randomize even with the requested language.

Thank you!
#52 by dowun
2023-02-22 at 00:45
< report >Hello, Yorhel.
I'm currently working on a frontend application to better visualize some visual novel details, but I missed the developer field. Do you think it's still too early to implement this on the /vn endpoint?
#53 by Yorhel
2023-02-22 at 06:55
< report >Well, there kind of is no developer field for VNs in the current data schema, that information comes from releases and is available through the API (/releases -> producers.developer). The vn 'developer' filter is a lie. :)

I could add a fake 'developer' field to VNs to make it easier to grab that data, but I'm also wondering if it isn't better to fix the underlying schema. That's a very big can of worms though.Last modified on 2023-02-22 at 06:58
#54 by gdstua
2023-03-17 at 13:26
< report >can voiced be added again?
#55 by hubb2001
2023-03-30 at 22:35
< report >Wanted to express my thanks for this API, I've been making a discord bot with a ton of vndb-connected features recently. Including queries and even a VN guessing game using random screenshots. (Thanks #49, #50, and #51 for the randomization explanation btw). Good stuff!
#56 by Jair4x
2023-04-05 at 06:23
< report >Hey! Hello again, people! I've seen #55 is working in his own bot. That's good!

I'm here yet again to ask something. Because I've been getting a recurrent error in the VN search, which is Wrong VN result (I suppose)

Let's say, for example, you search for "Ao no Kanata no Four Rhythm", the full name of Aokana.
What do you get? Well, check this or this screenshot, where you can clearly see what I'm searching for and what do I get as result.

But here's the thing, if you search for "Aokana", it does give you Ao no Kanata no Four Rhythm, as seen in this screenshot

Maybe Yorhel can explain this, but as of now, I couldn't find any solution to prevent this error from happening.
#57 by Yorhel
2023-04-05 at 06:35
< report >Well, that's easy to explain. Koi to Senkyo to Chocolate matches the search query because of r58170 and it has a lower ID than Ao no Kanata no Four Rhythm so that's what the bot will select. One possible solution is to use search result ranking, which I've only recently implemented on the site and I'm still trying to figure out how to expose in the API.
#58 by Jair4x
2023-04-05 at 06:57
< report >Whoa, quick response.

Alright then! I'll wait until you give confirmation on the implementation of the search result ranking in the API. Thanks!

Pulled an all-nighter coding and doing API related research for the Discord bot. I can't believe I've put so much effort in this little project I've decided I wanted to do at 2 am on a random day in february...
#59 by Yorhel
2023-04-05 at 14:01
< report >Alrighty, wasn't as tricky to implement as I had expected. You can now sort by "searchrank":
curl https://api.vndb.org/kana/vn --header 'Content-Type: application/json' --data '{
"fields": "title",
"filters": ["search","=","Ao no Kanata no Four Rhythm"],
"sort": "searchrank",
"results": 1
}'

EDIT: As a disclaimer, the ranking algorithm isn't perfect, you may still see odd results here and there.Last modified on 2023-04-05 at 14:04
#60 by Jair4x
2023-04-05 at 16:42
< report >Already implemented on the bot searching command.
Works really well! Thanks!
#61 by hubb2001
2023-04-08 at 03:13
< report >I've found a minor shortfall, popularity only accepts full integer sets from 1-100, but the vast majority (literally like 95%) of VNs are sub-1 popularity. If I set my popular search to >= 1 it'll return somewhere in the range of 1200 results valid. but if I wanted say the top 2500 results, roughly around .88, it's not possible on the current API without iterating over stuff manually.
#62 by Yorhel
2023-04-08 at 10:26
< report >There's the workaround of using a votecount filter instead, though the results will be slightly different.
#63 by a-9570
2023-04-09 at 08:26
< report >Since yesterday I only can add one label at a time to any novel. If I try to select 2 or more the circle that indicates that the changes are being saved now doesn't disappear and the only workaround is to add just 1 label, reload the page, add the next label and so on. I suppose that this has some relation to the new API so I comment the issue here.Last modified on 2023-04-09 at 08:27
#64 by Yorhel
2023-04-09 at 08:38
< report >That's very unrelated to the API, but it should be fixed now.
(t2520 is usually the place to report such issues)Last modified on 2023-04-09 at 08:45
#65 by hungofhydra
2023-04-10 at 01:44
< report >#56 One of temporary fix is that to make a list of return results and let the user choose them, like in this screenshot[url]
#66 by Jair4x
2023-04-12 at 21:43
< report >Haven't thought of a contextual menu. That's a nice approach!
#67 by hubb2001
2023-04-14 at 18:50
< report >#66 #65 this is also how I handle it, although I do pagination on python to return 10 most likely results and let the user flip through them. link
#68 by Jair4x
2023-04-15 at 00:38
< report >#67, nice embed structure, I think 10 results are too much, maybe 5 could be optimal.

I suggest you type the URL in the title of the embed.

(Discord.js)
let VNLink = `https://vndb.org/${VNID}`;

// After declaring your embed...
embed.setURL(`${VNLink}`);

(Discord.py)
VNLink = f"https://vndb.org/{VNID}"

# In the initialization of the embed...
embed = discord.Embed(title="whatever", url=VNLink, ...)

Also, filter the source (the [extracted from ...] and its variants) out the description, it's useless information for the bot to have it in the embed.

Filtering the description was a nightmare, but I got it in... 69 lines. Nice, funny number. Good luck with that if you do it.
#69 by hubb2001
2023-04-15 at 03:13
< report >I admit I forgot url was an embed option, so fixed that.

As for filtering the source, it's left in intentionally as the embed is meant to just be an expansion of available vndb info. Although in case anyone else wants it, I did have to make a regex to fix the URL formatting. "\[url=(.*?)\](.*?)\[/url\]", r"[\2](\1)" (grabs the URL, replaces it to [text](URL) formatting) just in case anyone else wants a quick solution for that in future.
#70 by Jair4x
2023-04-17 at 04:19
< report >In my (not at all) humble opinion, I'd prefer to keep the description clean, without any source info.

Also remember that embed fields exist, it would look way better organized with fields, being able to see clean info and such. Here's an example, although it'll change a little in a couple weeks

Reply

You must be logged in to reply to this thread.