forked from filipg/twilight-library
dziala, ale bez tytulu i daty
This commit is contained in:
parent
fbd7f7e448
commit
cc670f1f7c
@ -13,21 +13,17 @@ import Text.Printf
|
|||||||
|
|
||||||
|
|
||||||
extractRecords = extractLinksWithText "//a[@class='image-link']" -- pary adres-tytuł
|
extractRecords = extractLinksWithText "//a[@class='image-link']" -- pary adres-tytuł
|
||||||
>>> second (arr $ replace "\n" " ")
|
>>> first (extractLinksWithText "//div/a[contains(@href,'.pdf') and not(@class)]")
|
||||||
>>> first (extractLinksWithText "//div/a[contains(@href,'.pdf') and not(@class)]") -- 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)
|
|
||||||
|
|
||||||
-- ... a tutaj te trójki przerabiamy do docelowej struktury ShadowItem
|
-- ... a tutaj te trójki przerabiamy do docelowej struktury ShadowItem
|
||||||
toShadowItem :: ((String, String),String) -> ShadowItem
|
toShadowItem :: ((String, String),String) -> ShadowItem
|
||||||
toShadowItem ((url, articleTitle), yearlyTitle) =
|
toShadowItem ((url, articleTitle), yearlyTitle) =
|
||||||
(defaultShadowItem url title) {
|
(defaultShadowItem url title) {
|
||||||
originalDate = Just date,
|
|
||||||
itype = "periodical",
|
itype = "periodical",
|
||||||
format = Just "pdf",
|
format = Just "pdf",
|
||||||
finalUrl = url
|
finalUrl = url
|
||||||
}
|
}
|
||||||
where title = "Pbsociety " ++ yearlyTitle
|
where title = "Pbsociety "
|
||||||
date = getDate url
|
|
||||||
|
|
||||||
getDate url =
|
getDate url =
|
||||||
case url =~~ "/(19[0-9][0-9]|20[0-9][0-9])/" :: Maybe [[String]] of
|
case url =~~ "/(19[0-9][0-9]|20[0-9][0-9])/" :: Maybe [[String]] of
|
||||||
|
Loading…
Reference in New Issue
Block a user