Add packages

This commit is contained in:
nlitkowski 2021-04-07 14:07:28 +02:00
parent ea12e8ac21
commit 4ae00c6660
2 changed files with 8 additions and 5 deletions

View File

@ -1,5 +1,5 @@
{-# LANGUAGE Arrows, NoMonomorphismRestriction, TemplateHaskell #-}
{-# LANGUAGE Arrows, NoMonomorphismRestriction, TemplateHaskell, QuasiQuotes #-}
import ShadowLibrary.Core
import Text.XML.HXT.Core
@ -12,6 +12,8 @@ import Data.List.Utils (replace)
import Text.Printf
import Control.Lens.Regex.Text
import Control.Lens ((^?))
import qualified Data.Text as T
getLinkAndText xpathCondition = proc doc -> do
xpathTrees <- getXPathTrees xpathCondition -< doc
@ -39,17 +41,16 @@ extractRecords = proc startUrl -> do
toShadowItem :: (((String, String), String), String) -> ShadowItem
toShadowItem (((url, releaseTitle), collectionTitle), categoryTitle) =
(defaultShadowItem url title) {
originalDate = Just date,
originalDate = T.unpack <$> date,
itype = "periodical",
format = Just "pdf",
finalUrl = url
}
where title = categoryTitle ++ (" " ++ collectionTitle)
date = releaseTitle
-- date = getDate $ releaseTitle
date = getDate $ T.pack $ releaseTitle
-- getDate txt = txt ^? [regex|19[0-9][0-9]|20[0-9][0-9]|] . match
getDate txt = txt ^? [regex|19[0-9][0-9]|20[0-9][0-9]|] . match
main = do
let start = "http://zborbielawa.pl/archiwum/"

View File

@ -71,6 +71,8 @@ executable zborbielawa
, regex-posix
, shadow-library
, lens-regex-pcre
, lens
, text
default-language: Haskell2010