diff --git a/app/ZborBielawa.hs b/app/ZborBielawa.hs index aba319b..9e646bf 100644 --- a/app/ZborBielawa.hs +++ b/app/ZborBielawa.hs @@ -8,10 +8,12 @@ import Text.XML.HXT.XPath import Data.List import Data.List.Utils (replace) -import Text.Regex.Posix +-- import Text.Regex.Posix import Text.Printf import Control.Lens.Regex.Text +import Control.Lens.Regex +import Control.Lens getLinkAndText xpathCondition = proc doc -> do xpathTrees <- getXPathTrees xpathCondition -< doc @@ -48,12 +50,7 @@ toShadowItem (((url, releaseTitle), collectionTitle), categoryTitle) = date = getDate $ releaseTitle -getDate yearlyTitle = - case yearlyTitle =~~ "/(19[0-9][0-9]|20[0-9][0-9])/" :: Maybe [[String]] of - Just [[_, year]] -> year - -- otherwise -> error $ "unexpected yearlyTitle: " ++ yearlyTitle - otherwise -> yearlyTitle - +getDate txt = txt ^? [regex|19[0-9][0-9]|20[0-9][0-9]|] . match main = do let start = "http://zborbielawa.pl/archiwum/"