diff options
author | Joris Guyonvarch | 2015-04-11 11:50:48 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-04-11 12:03:22 +0200 |
commit | 5977e1454d7738ddb086d37b20337e350e380790 (patch) | |
tree | e03261144e3d534434242c1dd037c2a4e4db5a9f /src/Main.hs |
Fetch first page ads of a given leboncoin url, fetch also the description page of each item.
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Main.hs b/src/Main.hs new file mode 100644 index 0000000..f352a43 --- /dev/null +++ b/src/Main.hs @@ -0,0 +1,27 @@ +module Main + ( main + ) where + +import Data.List (intersperse) + +import Ad (getAds) + +import Model.Ad + +import View.Ad (renderAd) + +import Page +import Parser.Detail + +url :: String +url = "http://www.leboncoin.fr/annonces/offres/corse/" + +main :: IO () +main = do + eitherAds <- getAds url + case eitherAds of + Left error -> + putStrLn error + Right ads -> do + writeFile "result.html" (concat . intersperse "\n\n" . map renderAd $ ads) + putStrLn "Done!" |