h-booru- Haskell library for retrieving data from various booru image sites

Safe HaskellNone



| Many booru sites use the same engine (Gelbooru engine) so instead of having identical parsers across many modules, we simply alias our GenericPost to whatever we need.



parsePost :: ArrowXml cat => cat XmlTree GenericPostSource

Fairly naïve parser for all attributes in sites running vanilla Gelbooru engine. While it catches all attributes in a typical XML post result, we trust that they are consistent and use read to deserialise some values. For sites with non-default replies, custom parsers have to be written.

parseRating :: String -> RatingSource

Parses a string returned from a Gelbooru-like site into one of the commonly used Ratings. Note that this is a partial function so you should make sure that the site in question only ever returns the values in a format specified in the function

parseTags :: String -> [Tag]Source

Splits returned tag string into separate Tags. For Gelbooru-like sites, this is just the question of splitting on whitespace.

parseBool :: String -> Maybe BoolSource

Reads a lowercase Bool string representation into its Haskell type. If we can't parse the boolean, return Nothing.