forked from filipg/twilight-library
WIP
This commit is contained in:
parent
15c2e705b1
commit
0442a8c067
@ -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/"
|
||||
|
Loading…
Reference in New Issue
Block a user