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
|
||||||
import Data.List.Utils (replace)
|
import Data.List.Utils (replace)
|
||||||
|
|
||||||
import Text.Regex.Posix
|
-- import Text.Regex.Posix
|
||||||
import Text.Printf
|
import Text.Printf
|
||||||
|
|
||||||
import Control.Lens.Regex.Text
|
import Control.Lens.Regex.Text
|
||||||
|
import Control.Lens.Regex
|
||||||
|
import Control.Lens
|
||||||
|
|
||||||
getLinkAndText xpathCondition = proc doc -> do
|
getLinkAndText xpathCondition = proc doc -> do
|
||||||
xpathTrees <- getXPathTrees xpathCondition -< doc
|
xpathTrees <- getXPathTrees xpathCondition -< doc
|
||||||
@ -48,12 +50,7 @@ toShadowItem (((url, releaseTitle), collectionTitle), categoryTitle) =
|
|||||||
date = getDate $ releaseTitle
|
date = getDate $ releaseTitle
|
||||||
|
|
||||||
|
|
||||||
getDate yearlyTitle =
|
getDate txt = txt ^? [regex|19[0-9][0-9]|20[0-9][0-9]|] . match
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
main = do
|
main = do
|
||||||
let start = "http://zborbielawa.pl/archiwum/"
|
let start = "http://zborbielawa.pl/archiwum/"
|
||||||
|
Loading…
Reference in New Issue
Block a user