forked from filipg/twilight-library
remove unused fns
This commit is contained in:
parent
944d67f524
commit
eba9beb68e
@ -12,16 +12,6 @@ import Text.Regex.Posix
|
||||
import Text.Printf
|
||||
import Debug.Trace
|
||||
|
||||
extractNestedLinksWithText xpathCondition = (downloadDocument &&& this)
|
||||
>>> first (getXPathTrees xpathCondition
|
||||
>>> (
|
||||
(getXPathTrees "//a" >>> getAttrValue "href")
|
||||
&&& (listA (deep isText >>> getText)
|
||||
>>> arr (intercalate " "))
|
||||
))
|
||||
>>> arr rotateSecTh -- ((a, b), c) -> ((a, c), b)
|
||||
>>> first expandURIFixed
|
||||
|
||||
|
||||
getLinkAndText xpathCondition = proc doc -> do
|
||||
xpathTrees <- getXPathTrees xpathCondition -< doc
|
||||
@ -30,20 +20,14 @@ getLinkAndText xpathCondition = proc doc -> do
|
||||
returnA -< traceShowId (href, txt)
|
||||
|
||||
|
||||
extractNestedLinksWithText2 xpathCondition = proc url -> do
|
||||
extractNestedLinksWithText xpathCondition = proc url -> do
|
||||
doc <- downloadDocument -< url
|
||||
(link, text) <- getLinkAndText xpathCondition -< doc
|
||||
uriFixed <- expandURIFixed -< (link, url)
|
||||
returnA -< (uriFixed, text)
|
||||
|
||||
|
||||
extractRecords = extractLinksWithText "(//aside[@class='widget widget_maxmegamenu']//a[@class='mega-menu-link'])[1]" -- pary adres-tytuł podstrony
|
||||
>>> first (extractLinksWithText "(//aside[@class='widget widget_maxmegamenu']//a[@class='mega-menu-link'])[1]") -- pobieramy podstronę i kolejne podstrony z menu
|
||||
>>> first (first (extractNestedLinksWithText "//big/a[contains(@href,'.pdf')][img]")) -- pobieramy stronę z adresu URL i wyciągamy linki z tej strony pasujące do wyrażenia XPathowego
|
||||
-- ostatecznie wyjdą krotki (((adres URL, tytuł nr-u), tytuł podstrony 2), tytuł podstrony 1)
|
||||
|
||||
|
||||
extractRecords2 = proc x -> do
|
||||
extractRecords = proc x -> do
|
||||
(a, b) <- extractLinksWithText "(//aside[@class='widget widget_maxmegamenu']//a[@class='mega-menu-link'])[1]" -< x -- pary adres-tytuł podstrony
|
||||
(a', b') <- (extractLinksWithText "(//aside[@class='widget widget_maxmegamenu']//a[@class='mega-menu-link'])[1]") -< a -- pobieramy podstronę i kolejne podstrony z menu
|
||||
a'' <- (extractNestedLinksWithText "//big/a[contains(@href,'.pdf')][img]") -< a' -- pobieramy stronę z adresu URL i wyciągamy linki z tej strony pasujące do wyrażenia XPathowego
|
||||
@ -77,4 +61,4 @@ main = do
|
||||
abbrev="ZboBiel",
|
||||
lLevel=0,
|
||||
webpage=start}
|
||||
extractItemsStartingFromUrl shadowLibrary start (extractRecords2 >>> arr toShadowItem)
|
||||
extractItemsStartingFromUrl shadowLibrary start (extractRecords >>> arr toShadowItem)
|
||||
|
Loading…
Reference in New Issue
Block a user