This commit is contained in:
s434695 2021-04-19 23:58:35 +02:00
parent cc670f1f7c
commit c77fe1a502

View File

@ -13,18 +13,19 @@ import Text.Printf
extractRecords = extractLinksWithText "//a[@class='image-link']" -- pary adres-tytuł
>>> first (extractLinksWithText "//div/a[contains(@href,'.pdf') and not(@class)]")
>>> first (extractLinksWithText "//div/a[contains(@href,'.pdf') and not(@class)]")
-- ... a tutaj te trójki przerabiamy do docelowej struktury ShadowItem
toShadowItem :: ((String, String),String) -> ShadowItem
toShadowItem ((url, articleTitle), yearlyTitle) =
(defaultShadowItem url title) {
--originalDate = Just date,
itype = "periodical",
format = Just "pdf",
finalUrl = url
}
where title = "Pbsociety "
where title = "Pbsociety " ++ yearlyTitle ++ " " ++ articleTitle
--date = getDate url
getDate url =
case url =~~ "/(19[0-9][0-9]|20[0-9][0-9])/" :: Maybe [[String]] of
Just [[_, year]] -> year