forked from filipg/twilight-library
Update file
This commit is contained in:
parent
a844b6d3f4
commit
6b528382ee
@ -11,17 +11,18 @@ import Data.List.Utils (replace)
|
|||||||
import Text.Regex.Posix
|
import Text.Regex.Posix
|
||||||
import Text.Printf
|
import Text.Printf
|
||||||
|
|
||||||
extractRecords = extractLinksWithText "//li/a[contains(@href,'/lata')]"
|
|
||||||
>>> second (arr $ replace "\r\n " " ")
|
|
||||||
>>> first (extractLinksWithText "//p/a[contains(@href, '/archiwum/images/gazety')]")
|
|
||||||
|
|
||||||
toShadowItem :: ((String, String), String) -> ShadowItem
|
extractRecords = extractLinksWithText "//li/a[contains(@href,'/lata')]"
|
||||||
toShadowItem ((url, articleTitle), yearlyTitle) =
|
>>> first (extractLinksWithText "//li/a[contains(@href,'start=')]"
|
||||||
|
>>> first (extractLinksWithText "//a[contains(@href, '/archiwum/images/19') or contains(@href, '/Trybuna')]"))
|
||||||
|
|
||||||
|
|
||||||
|
toShadowItem :: (((String, String), String), String) -> ShadowItem
|
||||||
|
toShadowItem (((url, articleTitle), _), yearlyTitle) =
|
||||||
(defaultShadowItem url title) {
|
(defaultShadowItem url title) {
|
||||||
originalDate = Just date,
|
originalDate = Just date,
|
||||||
itype = "periodical",
|
itype = "periodical",
|
||||||
format = Just form,
|
format = Just form,
|
||||||
-- format = Just "pdf",
|
|
||||||
finalUrl = url
|
finalUrl = url
|
||||||
}
|
}
|
||||||
where title = "Instytut Techniki Gorniczej " ++ yearlyTitle ++ " " ++ (replace "\r\n" "" (replace "\r\n " "" articleTitle))
|
where title = "Instytut Techniki Gorniczej " ++ yearlyTitle ++ " " ++ (replace "\r\n" "" (replace "\r\n " "" articleTitle))
|
||||||
@ -29,7 +30,7 @@ toShadowItem ((url, articleTitle), yearlyTitle) =
|
|||||||
form = unwords $ map stringToLower [getFormat url]
|
form = unwords $ map stringToLower [getFormat 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]).*\\..{3}" :: Maybe [[String]] of
|
||||||
Just [[_, year]] -> year
|
Just [[_, year]] -> year
|
||||||
otherwise -> error $ "unexpected url: " ++ url
|
otherwise -> error $ "unexpected url: " ++ url
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user