blob: c143d3c7fa2724a47873214bc3a255e29e85b42e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
module FetchAd
( leboncoin
, ouestFrance
, seLoger
) where
import Data.Either (rights)
import Network.Wreq.Session (Session)
import Model.Ad (Ad)
import Model.URL (URL)
import qualified Parser.LeboncoinParser as LeboncoinParser
import qualified Parser.OuestFranceParser as OuestFranceParser
import qualified Parser.SeLogerParser as SeLogerParser
import qualified Utils.HTTP as HTTP
leboncoin :: Session -> [URL] -> IO [Ad]
leboncoin session urls =
fmap (concat . map LeboncoinParser.parse . rights)
. sequence
. map (HTTP.get session)
$ urls
ouestFrance :: Session -> [URL] -> IO [Ad]
ouestFrance session urls =
fmap (concat . map OuestFranceParser.parse . rights)
. sequence
. map (HTTP.get session)
$ urls
seLoger :: Session -> [URL] -> IO [Ad]
seLoger session urls =
fmap (concat . map SeLogerParser.parse . rights)
. sequence
. map (HTTP.get session)
$ urls
|