forked from filipg/twilight-library
Compare commits
No commits in common. "master" and "master" have entirely different histories.
@ -1,39 +0,0 @@
|
||||
|
||||
{-# LANGUAGE Arrows, NoMonomorphismRestriction #-}
|
||||
import ShadowLibrary.Core
|
||||
|
||||
import Text.XML.HXT.Core
|
||||
import Text.XML.HXT.XPath
|
||||
-- import Text.XML.HXT.Curl
|
||||
import Data.List
|
||||
import Data.List.Utils (replace)
|
||||
|
||||
import Text.Regex.Posix
|
||||
import Text.Printf
|
||||
|
||||
|
||||
extractRecords = extractLinks "//a[contains(@href, '.pdf')]"
|
||||
|
||||
|
||||
toShadowItem :: String -> ShadowItem
|
||||
toShadowItem url =
|
||||
(defaultShadowItem url title) {
|
||||
originalDate = Just date,
|
||||
itype = "periodical",
|
||||
format = Just "pdf",
|
||||
finalUrl = url
|
||||
}
|
||||
where
|
||||
date = last $ getAllTextMatches $ url =~ "(19[0-9][0-9]|20[0-9][0-9])" :: String
|
||||
titleToProcess = last $ getAllTextMatches $ url =~ "/[a-zA-Z ]+[-_]" :: String
|
||||
title = titleToProcess =~ "[a-zA-Z ]+" :: String
|
||||
|
||||
|
||||
main = do
|
||||
let start = "http://polunima.pl/teatr-lalek/"
|
||||
let shadowLibrary = ShadowLibrary {logoUrl=Nothing,
|
||||
lname="Teatr Lalek",
|
||||
abbrev="Teatr",
|
||||
lLevel=0,
|
||||
webpage=start}
|
||||
extractItemsStartingFromUrl shadowLibrary start (extractRecords >>> arr toShadowItem)
|
@ -34,19 +34,18 @@ library
|
||||
, tz
|
||||
default-language: Haskell2010
|
||||
|
||||
executable teatrLalek
|
||||
hs-source-dirs: app
|
||||
main-is: teatrLalek.hs
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends: base
|
||||
, hxt
|
||||
, hxt-curl
|
||||
, hxt-xpath
|
||||
, MissingH
|
||||
, regex-posix
|
||||
, shadow-library
|
||||
, regex-tdfa
|
||||
default-language: Haskell2010
|
||||
-- executable maly-modelarz-exe
|
||||
-- hs-source-dirs: app
|
||||
-- main-is: malymodelarz.hs
|
||||
-- ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
-- build-depends: base
|
||||
-- , hxt
|
||||
-- , hxt-curl
|
||||
-- , hxt-xpath
|
||||
-- , MissingH
|
||||
-- , regex-posix
|
||||
-- , shadow-library
|
||||
-- default-language: Haskell2010
|
||||
|
||||
executable almanachmuszyny
|
||||
hs-source-dirs: app
|
||||
|
Loading…
Reference in New Issue
Block a user