Danbooru

Trying to extract metatag info from XML request

Posted under General

Hello all,

I didn't find this question answered in the forums yet, so my apologies if it is redundant.

I am trying to get the metatag info, such as "artist:xxx", "character:xxx", or "ambiguous:xxx", from the XML interface. It seems like the way I am querying strips the type indication off. For reference, I am loading the following URL for my query:

http://danbooru.donmai.us/post/index.xml?tags=status:any+md5:937cb3f0afb8cede20314a59e68142ac

Is there another argument I should pass to that query or another query altogether that I must perform?

Updated

first of all, i'm no expert here, so probably my opinion doesn't matter, but i'm curious as well as i tried doing this.

and based on my limited understanding is it's impossible to do that using post/index.xml alone. that part is used for extracting info about posts not related info about tags. if you want the metatag info, you need to consult /tag/index.xml.

the latter will give you the type and ambiguous values. types are 0, 1, 3, and 4 for general, artist, copyright, and character respectively. ambiguous returns true or false.

you might want to weave these two together in your own program if you want to replicate the color coding scheme which the site provides automatically.

ghostrigger said:
replicate the color coding scheme

According to my interpretation of the API documentation, /tag/index.xml can only return the type of one specific tag at a time if you are not using a name pattern. That would mean at least 10 queries for an average post, and at least 100 for an average tag search result of 20 posts. Be very careful if you want to do this, as this can easily hammer the server (see forum #72300 for a recent case of unintended DDoS).

And it seems that there is no other method beside /tag/index.xml for querying tag types. Perhaps a feature request is in order, for querying the types for a given list of exact tags.

1