{-# 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 = extractLinksWithText "//td/a[contains(@href,'.pdf')]" toShadowItem :: (String, String) -> ShadowItem toShadowItem (url, text) = (defaultShadowItem url text) { originalDate = Just date, itype = "periodical", format = Just "pdf", finalUrl = url } where title = "" date = "" main = do let start = "https://www.pip.gov.pl/pl/inspektor-pracy/66546,archiwum-inspektora-pracy-.html" let shadowLibrary = ShadowLibrary {logoUrl=Nothing, lname="Inspektor Pracy", abbrev="InspPrac", lLevel=0, webpage=start} extractItemsStartingFromUrl shadowLibrary start (extractRecords >>> arr toShadowItem)