module HBooru.Parsers.Yandere where
import Data.List
import qualified HBooru.Parsers.GenericBooru as G
import HBooru.Parsers.GenericBooru.TH (makePost)
import HBooru.Types
import Language.Haskell.TH (mkName)
import Text.XML.HXT.Core hiding (mkName)
$(makePost (mkName "YanderePost"))
data Yandere = Yandere
instance Postable Yandere XML where
postUrl _ _ ts =
let tags = intercalate "+" ts
in "https://yande.re/post/index.xml?tags=" ++ tags
hardLimit _ = Limit 100
instance Site Yandere where
instance PostParser Yandere XML where
type ImageTy Yandere XML = YanderePost
parseResponse _ = map (`betweenPosts` YanderePost)
. runLA (xreadDoc /> G.parsePost) . getResponse
instance Counted Yandere XML where
parseCount _ = read . head . runLA (xreadDoc >>> hasName "posts"
>>> getAttrValue "count") . getResponse