add pdf names
This commit is contained in:
parent
d28c055f3b
commit
3ab57f0f58
@ -13,16 +13,17 @@ import Text.Printf
|
||||
|
||||
|
||||
|
||||
extractRecords = extractLinksWithText "//a[@class='title']" -- pary adres-tytuł
|
||||
>>> second (arr $ replace "\n\t\t\t\t\t" "")-- czyścimy drugi element pary, czyli tytuł z niepotrzebnych białych znaków
|
||||
>>> first (extractLinksWithText "//a[@class='obj_galley_link 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)
|
||||
|
||||
extractRecords = extractLinksWithText "//a[@class='title']"
|
||||
>>> second (arr $ replace "\n\t\t\t\t\t" "")
|
||||
>>> first (extractLinksWithText "//div[@class='title']"
|
||||
>>> first (extractLinksWithText"//a[@class='obj_galley_link pdf']"))
|
||||
-- >>> first (extractLinksWithText"//ul[@class='value galleys_links']//a[@class='obj_galley_link pdf']"))
|
||||
-- ... a tutaj te trójki przerabiamy do docelowej struktury ShadowItem
|
||||
|
||||
toShadowItem :: ((String, String), String) -> ShadowItem
|
||||
toShadowItem ((url, articleTitle), yearlyTitle) =
|
||||
toShadowItem :: (((String, String), String),String)-> ShadowItem
|
||||
-- toShadowItem :: ((String, String),String) -> ShadowItem
|
||||
-- toShadowItem ((url, articleTitle), yearlyTitle) =
|
||||
toShadowItem (((url, articleTitle),pdfTitle), yearlyTitle)=
|
||||
(defaultShadowItem url title) {
|
||||
originalDate = Just date,
|
||||
itype = "periodical",
|
||||
@ -30,9 +31,8 @@ toShadowItem ((url, articleTitle), yearlyTitle) =
|
||||
finalUrl = url
|
||||
}
|
||||
|
||||
where title = replace "\n\t\t\t" "" yearlyTitle ++ " " ++ (replace "\n\n\t" "" (replace "\n\n\t\t\n\t" " " articleTitle))
|
||||
where title = replace "\n\t\t\t" " " yearlyTitle ++ (replace "\t\n\t" "" (replace "\n\n\t" " " articleTitle)) ++ (replace "\n\t\t \n\t\t\t" " " (replace "\n\t\t\t\t\t \n\t" "" (replace "\n\t\t\t\t\t\t\t \n\t\t\t\t\t" " " (replace "\n\t\t\t\t " ""pdfTitle))))
|
||||
date = getDate yearlyTitle
|
||||
|
||||
getDate yearlyTitle =
|
||||
case yearlyTitle =~~ "(19[0-9][0-9]|20[0-9][0-9])" :: Maybe [[String]] of
|
||||
Just [[_, year]] -> year
|
||||
@ -45,7 +45,7 @@ main = do
|
||||
let start3 = "https://etyka.uw.edu.pl/index.php/etyka/issue/archive/3"
|
||||
let shadowLibrary = ShadowLibrary {logoUrl=Nothing,
|
||||
lname="Tom",
|
||||
abbrev="AlmMusz",
|
||||
abbrev="Etyka",
|
||||
lLevel=0,
|
||||
webpage=start}
|
||||
extractItemsStartingFromUrl shadowLibrary start (extractRecords >>> arr toShadowItem)
|
||||
|
Loading…
Reference in New Issue
Block a user