forked from filipg/twilight-library
Add packages
This commit is contained in:
parent
ea12e8ac21
commit
4ae00c6660
@ -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/"
|
||||
|
@ -71,6 +71,8 @@ executable zborbielawa
|
||||
, regex-posix
|
||||
, shadow-library
|
||||
, lens-regex-pcre
|
||||
, lens
|
||||
, text
|
||||
default-language: Haskell2010
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user