forked from filipg/twilight-library
for in publication 1 to 11
This commit is contained in:
parent
f79ab1fe01
commit
86b1a0412c
@ -12,12 +12,19 @@ import Text.Regex.Posix
|
||||
import Text.Printf
|
||||
|
||||
|
||||
|
||||
extractRecords = extractLinksWithText "//a[@class='year-anchor ']" -- pary adres-tytuł
|
||||
>>> second (arr $ replace "\r\n " " ") -- czyścimy drugi element pary, czyli tytuł z niepotrzebnych białych znaków
|
||||
-- >>> first (arr ((++"f") . init)) -- modyfikujemy pierwszy element pary, czyli adres URL
|
||||
>>> first (extractLinksWithText "//a[contains(@href,'.pdf')]") -- pobieramy stronę z adresu URL i wyciągamy linki z tej strony pasujące do wyrażenia XPathowego
|
||||
>>> first (extractLinksWithText "//a[@class='pdf-exist'][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)
|
||||
|
||||
-- extractRecords2 = extractLinksWithText "//a[@class='year-anchor']" -- pary adres-tytuł
|
||||
-- >>> second (arr $ replace "\r\n " " ") -- czyścimy drugi element pary, czyli tytuł z niepotrzebnych białych znaków
|
||||
-- -- >>> first (arr ((++"f") . init)) -- modyfikujemy pierwszy element pary, czyli adres URL
|
||||
-- >>> first (extractLinksWithText "//a[ends-with(@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)
|
||||
|
||||
-- ... a tutaj te trójki przerabiamy do docelowej struktury ShadowItem
|
||||
toShadowItem :: ((String, String), String) -> ShadowItem
|
||||
toShadowItem ((url, articleTitle), yearlyTitle) =
|
||||
@ -45,3 +52,45 @@ main = do
|
||||
webpage=start}
|
||||
putStrLn "Program started"
|
||||
extractItemsStartingFromUrl shadowLibrary start (extractRecords >>> arr toShadowItem)
|
||||
|
||||
-- First time using haskell and for loop in haskell is hard
|
||||
|
||||
putStrLn "New link"
|
||||
let start2 = "https://kulturaparyska.com/pl/publication/1/year/1946"
|
||||
extractItemsStartingFromUrl shadowLibrary start2 (extractRecords >>> arr toShadowItem)
|
||||
|
||||
putStrLn "New link"
|
||||
let start2 = "https://kulturaparyska.com/pl/publication/2/year/1946"
|
||||
extractItemsStartingFromUrl shadowLibrary start2 (extractRecords >>> arr toShadowItem)
|
||||
|
||||
putStrLn "New link"
|
||||
let start2 = "https://kulturaparyska.com/pl/publication/3/year/1946"
|
||||
extractItemsStartingFromUrl shadowLibrary start2 (extractRecords >>> arr toShadowItem)
|
||||
|
||||
putStrLn "New link"
|
||||
let start2 = "https://kulturaparyska.com/pl/publication/5/year/1946"
|
||||
extractItemsStartingFromUrl shadowLibrary start2 (extractRecords >>> arr toShadowItem)
|
||||
|
||||
putStrLn "New link"
|
||||
let start2 = "https://kulturaparyska.com/pl/publication/6/year/1946"
|
||||
extractItemsStartingFromUrl shadowLibrary start2 (extractRecords >>> arr toShadowItem)
|
||||
|
||||
putStrLn "New link"
|
||||
let start2 = "https://kulturaparyska.com/pl/publication/7/year/1946"
|
||||
extractItemsStartingFromUrl shadowLibrary start2 (extractRecords >>> arr toShadowItem)
|
||||
|
||||
putStrLn "New link"
|
||||
let start2 = "https://kulturaparyska.com/pl/publication/8/year/1946"
|
||||
extractItemsStartingFromUrl shadowLibrary start2 (extractRecords >>> arr toShadowItem)
|
||||
|
||||
putStrLn "New link"
|
||||
let start2 = "https://kulturaparyska.com/pl/publication/9/year/1946"
|
||||
extractItemsStartingFromUrl shadowLibrary start2 (extractRecords >>> arr toShadowItem)
|
||||
|
||||
putStrLn "New link"
|
||||
let start2 = "https://kulturaparyska.com/pl/publication/10/year/1946"
|
||||
extractItemsStartingFromUrl shadowLibrary start2 (extractRecords >>> arr toShadowItem)
|
||||
|
||||
putStrLn "New link"
|
||||
let start2 = "https://kulturaparyska.com/pl/publication/11/year/1946"
|
||||
extractItemsStartingFromUrl shadowLibrary start2 (extractRecords >>> arr toShadowItem)
|
Loading…
Reference in New Issue
Block a user