Zaktualizuj 'app/swidnik.hs'

This commit is contained in:
Adrian Charkiewicz 2022-03-18 01:46:52 +01:00
parent ebfaa72b53
commit 98e1b69b8b
1 changed files with 3 additions and 4 deletions

View File

@ -13,7 +13,6 @@ swidnik
extractRecords = extractLinksWithText "//a/div[@src='http://www.bibliotekaswidnik.pl/images/banners/pdf_klik.jpg"']" -- pary adres-tytuł
>>> second (arr $ replace "\r\n " " ") -- czyścimy drugi element pary, czyli tytuł z niepotrzebnych białych znaków
>>> first (arr ((++"tr") . init)) -- modyfikujemy pierwszy element pary, czyli adres URL
>>> first (extractLinksWithText "//li/a[contains(@href,'.pdf')]") -- pobieramy stronę z adresu URL i wyciągamy linki z tej strony pasujące do wyrażenia XPathowego
-- ostatecznie wyjdą trójki ((adres URL, tytuł artykułu), tytuł rocznika)
@ -26,7 +25,7 @@ toShadowItem ((url, articleTitle), yearlyTitle) =
format = Just "pdf",
finalUrl = url
}
where title = "Almanach Muszyny " ++ yearlyTitle ++ " " ++ (replace "\r\n" "" (replace "\r\n " "" articleTitle))
where title = "Glos " ++ yearlyTitle ++ " " ++ (replace "\r\n" "" (replace "\r\n " "" articleTitle))
date = getDate url
getDate url =
@ -38,8 +37,8 @@ getDate url =
main = do
let start = "s.bibliotekaswidnik.pl/index.php/116-glos-swidnika
let shadowLibrary = ShadowLibrary {logoUrl=Nothing,
lname="Almanach Muszyny",
abbrev="AlmMusz",
lname="Glos",
abbrev="Glos",
lLevel=0,
webpage=start}
extractItemsStartingFromUrl shadowLibrary start (extractRecords >>> arr toShadowItem)