diff --git a/app/kulturaparyska.hs b/app/kulturaparyska.hs index 084ae42..2d308b4 100644 --- a/app/kulturaparyska.hs +++ b/app/kulturaparyska.hs @@ -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) \ No newline at end of file